[OpenLayers-Commits] r12310 - sandbox/camptocamp/clientzoom/tests/Layer

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Thu Sep 1 03:14:44 EDT 2011


Author: erilem
Date: 2011-09-01 00:14:43 -0700 (Thu, 01 Sep 2011)
New Revision: 12310

Modified:
   sandbox/camptocamp/clientzoom/tests/Layer/Grid.html
Log:
better tests for Grid.transformDiv

Modified: sandbox/camptocamp/clientzoom/tests/Layer/Grid.html
===================================================================
--- sandbox/camptocamp/clientzoom/tests/Layer/Grid.html	2011-08-31 20:17:35 UTC (rev 12309)
+++ sandbox/camptocamp/clientzoom/tests/Layer/Grid.html	2011-09-01 07:14:43 UTC (rev 12310)
@@ -704,25 +704,39 @@
 
     function test_transformDiv(t) {
 
-        t.plan(6);
+        t.plan(8);
 
-        var map = new OpenLayers.Map('map');
+        var map = new OpenLayers.Map('map4');
         var layer = new OpenLayers.Layer.WMS('', '', {}, {
             isBaseLayer: true
         });
         map.addLayer(layer);
         map.zoomToMaxExtent();
 
-        var tile = layer.grid[1][1];
-        t.eq(tile.frame.style.left, '122%', 'tile (1,1) expected left');
-        t.eq(tile.frame.style.top, '83%', 'tile (1, 1) expected top');
+        // the layer container's dimensions are 100px width 100px height
+        // the position of the viewport center is 384, 256
 
-        layer.transformDiv(1.5);
-        t.eq(layer.div.style.width, '150%', 'layer div has correct width');
-        t.eq(layer.div.style.height, '150%', 'layer div has correct height');
-        t.eq(layer.div.style.left, '-124.75%', 'layer div has correct left');
-        t.eq(layer.div.style.top, '-137.25%', 'layer div has correct top');
+        layer.transformDiv(2);
 
+        t.eq(layer.div.style.width, '200%', '[1] layer div has correct width');
+        t.eq(layer.div.style.height, '200%', '[1] layer div has correct height');
+
+        t.eq(layer.div.style.left, '-384%', '[1] layer div has correct left');
+        t.eq(layer.div.style.top, '-256%', '[1] layer div has correct top');
+
+        // now move the layer container and test again
+
+        map.layerContainerDiv.style.left = '-1024px';
+        map.layerContainerDiv.style.top = '768px';
+
+        layer.transformDiv(2);
+
+        t.eq(layer.div.style.width, '200%', '[2] layer div has correct width');
+        t.eq(layer.div.style.height, '200%', '[2] layer div has correct height');
+
+        t.eq(layer.div.style.left, '-1408%', '[2] layer div has correct left');
+        t.eq(layer.div.style.top, '512%', '[2] layer div has correct top');
+
         map.destroy();
     }
 
@@ -732,5 +746,6 @@
 <div id="map" style="width:499px;height:549px;display:none"></div>
 <div id="map2" style="width:500px;height:550px;display:none"></div>
 <div id="map3" style="width:594px;height:464px;display:none"></div>
+<div id="map4" style="width:768px;height:512px;display:none"></div>
 </body>
 </html>



More information about the Commits mailing list