3 <script src="../../lib/OpenLayers.js"></script>
4 <script type="text/javascript">
6 function test_Control_MouseToolbar_constructor (t) {
9 control = new OpenLayers.Control.MouseToolbar();
10 t.ok( control instanceof OpenLayers.Control.MouseToolbar, "new OpenLayers.Control.MouseToolbar returns object" );
12 function test_Control_MouseToolbar_addControl (t) {
14 map = new OpenLayers.Map('map');
15 control = new OpenLayers.Control.MouseToolbar();
16 t.ok( control instanceof OpenLayers.Control.MouseToolbar, "new OpenLayers.Control.MouseToolbar returns object" );
17 t.ok( map instanceof OpenLayers.Map, "new OpenLayers.Map creates map" );
18 map.addControl(control);
19 t.ok( control.map === map, "Control.map is set to the map object" );
20 t.ok( map.controls[4] === control, "map.controls contains control" );
21 t.eq( parseInt(control.div.style.zIndex), map.Z_INDEX_BASE['Control'] + 5, "Control div zIndexed properly" );
22 t.eq( parseInt(map.viewPortDiv.lastChild.style.zIndex), map.Z_INDEX_BASE['Control'] + 5, "Viewport div contains control div" );
23 t.eq( control.div.style.left, "6px", "Control div left located correctly by default");
24 t.eq( control.div.style.top, "300px", "Control div top located correctly by default");
27 function test_Control_MouseToolbar_control_events (t) {
29 if ((navigator.userAgent.indexOf("compatible") == -1)) {
30 var evt = {which: 1}; // control expects left-click
31 map = new OpenLayers.Map('map');
32 var layer = new OpenLayers.Layer.WMS("Test Layer",
33 "http://octo.metacarta.com/cgi-bin/mapserv?",
34 {map: "/mapdata/vmap_wms.map", layers: "basic"});
37 control = new OpenLayers.Control.MouseToolbar();
38 map.addControl(control);
40 var centerLL = new OpenLayers.LonLat(0,0);
41 map.setCenter(centerLL, 5);
44 evt.xy = new OpenLayers.Size(5,5);
45 control.defaultMouseDown(evt);
46 evt.xy = new OpenLayers.Size(15,15);
47 control.defaultMouseUp(evt);
48 t.eq(map.getZoom(), 6, "Map zoom set correctly after zoombox");
50 t.ok(true, "IE does not run this test.")
57 <div id="map" style="width: 1024px; height: 512px;"/>