OpenLayers OpenLayers

root/trunk/openlayers/tests/Control/PanZoomBar.html

Revision 6799, 2.7 kB (checked in by crschmidt, 9 months ago)

2.6 accidentally broke behavior when clicking on the panzoombar. Thanks to Linda Rawson's report of this issue, this is now fixed, by moving the Math.floor call to a different part of the code. r=euzuro (Pullup #1486)

  • Property svn:mime-type set to text/html
  • Property svn:eol-style set to native
Line 
1 <html>
2 <head>
3   <script src="../../lib/OpenLayers.js"></script>
4   <script type="text/javascript">
5     var map;
6     function test_Control_PanZoomBar_constructor (t) {
7         t.plan( 4 );
8    
9         control = new OpenLayers.Control.PanZoomBar({position: new OpenLayers.Pixel(100,100)});
10         t.ok( control instanceof OpenLayers.Control.PanZoomBar, "new OpenLayers.Control.PanZoomBar returns object" );
11         t.eq( control.displayClass,  "olControlPanZoomBar", "displayClass is correct" );
12         t.eq( control.position.x, 100, "PanZoom X Set correctly.");
13         t.eq( control.position.y, 100, "PanZoom y Set correctly.");
14     }
15     function test_Control_PanZoomBar_addControl (t) {
16         t.plan( 8 );
17         map = new OpenLayers.Map('map', {controls:[]});
18         var layer = new OpenLayers.Layer.WMS("Test Layer",
19             "http://octo.metacarta.com/cgi-bin/mapserv?",
20             {map: "/mapdata/vmap_wms.map", layers: "basic"});
21         map.addLayer(layer);
22         control = new OpenLayers.Control.PanZoomBar();
23         t.ok( control instanceof OpenLayers.Control.PanZoomBar, "new OpenLayers.Control.PanZoomBar returns object" );
24         t.ok( map instanceof OpenLayers.Map, "new OpenLayers.Map creates map" );
25         map.addControl(control);
26         t.ok( control.map === map, "Control.map is set to the map object" );
27         t.ok( map.controls[0] === control, "map.controls contains control" );
28         t.eq( parseInt(control.div.style.zIndex), 1001, "Control div zIndexed properly" );
29         t.eq( parseInt(map.viewPortDiv.lastChild.style.zIndex), 1001, "Viewport div contains control div" );
30         t.eq( control.div.style.top, "4px", "Control div top located correctly by default");
31
32         var control2 = new OpenLayers.Control.PanZoomBar();
33         map.addControl(control2, new OpenLayers.Pixel(100,100));
34         t.eq( control2.div.style.top, "100px", "2nd control div is located correctly");
35     }
36     function test_Control_PanZoomBar_divClick (t) {
37         t.plan(2);
38         map = new OpenLayers.Map('map', {controls:[]});
39         var layer = new OpenLayers.Layer.WMS("Test Layer",
40             "http://octo.metacarta.com/cgi-bin/mapserv?",
41             {map: "/mapdata/vmap_wms.map", layers: "basic"});
42         map.addLayer(layer);
43         control = new OpenLayers.Control.PanZoomBar();
44         map.addControl(control);
45         control.divClick({'xy': {'x': 0, 'y': 50}, which: 1});
46         t.eq(map.zoom, 11, "zoom is correct on standard map");
47
48         map.fractionalZoom = true;
49         control.divClick({'xy': {'x': 0, 'y': 49}, which: 1});
50         t.eq(map.zoom.toFixed(3), '10.545', "zoom is correct on fractional zoom map");
51    
52     }
53
54   </script>
55 </head>
56 <body>
57     <div id="map" style="width: 1024px; height: 512px;"/>
58 </body>
59 </html>
Note: See TracBrowser for help on using the browser.