Changeset 5463
- Timestamp:
- 12/17/07 01:29:46 (1 year ago)
- Files:
-
- trunk/openlayers/tests/Control/test_PanZoom.html (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/openlayers/tests/Control/test_PanZoom.html
r4337 r5463 33 33 34 34 function test_03_Control_PanZoom_control_events (t) { 35 35 loader(); 36 36 if ( !window.document.createEvent ) { 37 37 //ie can't simulate mouseclicks … … 39 39 } else { 40 40 t.plan(35); 41 t.open_window( "Control/test_PanZoom.html", function( wnd ) { 42 t.delay_call( 3, function() { 41 t.delay_call( 1, function() { 43 42 var flag; 44 43 function setFlag(evt) { … … 55 54 resetFlags(); 56 55 57 w nd.mapper.events.register("mousedown", mapper, setFlag);58 w nd.mapper.events.register("mouseup", mapper, setFlag);59 w nd.mapper.events.register("click", mapper, setFlag);60 w nd.mapper.events.register("dblclick", mapper, setFlag);56 window.mapper.events.register("mousedown", mapper, setFlag); 57 window.mapper.events.register("mouseup", mapper, setFlag); 58 window.mapper.events.register("click", mapper, setFlag); 59 window.mapper.events.register("dblclick", mapper, setFlag); 61 60 62 simulateClick(w nd, wnd.control.buttons[0]);63 t.ok( w nd.mapper.getCenter().lat > wnd.centerLL.lat, "Pan up works correctly" );61 simulateClick(window, window.control.buttons[0]); 62 t.ok( window.mapper.getCenter().lat > window.centerLL.lat, "Pan up works correctly" ); 64 63 t.ok(!flag.mousedown, "mousedown does not get to the map"); 65 64 t.ok(flag.mouseup, "mouseup does get to the map"); … … 68 67 resetFlags(); 69 68 70 simulateClick(w nd, wnd.control.buttons[1]);71 t.ok( w nd.mapper.getCenter().lon < wnd.centerLL.lon, "Pan left works correctly" );69 simulateClick(window, window.control.buttons[1]); 70 t.ok( window.mapper.getCenter().lon < window.centerLL.lon, "Pan left works correctly" ); 72 71 t.ok(!flag.mousedown, "mousedown does not get to the map"); 73 72 t.ok(flag.mouseup, "mouseup does get to the map"); … … 76 75 resetFlags(); 77 76 78 simulateClick(w nd, wnd.control.buttons[2]);79 t.ok( w nd.mapper.getCenter().lon == wnd.centerLL.lon, "Pan right works correctly" );77 simulateClick(window, window.control.buttons[2]); 78 t.ok( window.mapper.getCenter().lon == window.centerLL.lon, "Pan right works correctly" ); 80 79 t.ok(!flag.mousedown, "mousedown does not get to the map"); 81 80 t.ok(flag.mouseup, "mouseup does get to the map"); … … 84 83 resetFlags(); 85 84 86 simulateClick(w nd, wnd.control.buttons[3]);87 t.ok( w nd.mapper.getCenter().lat == wnd.centerLL.lat, "Pan down works correctly" );85 simulateClick(window, window.control.buttons[3]); 86 t.ok( window.mapper.getCenter().lat == window.centerLL.lat, "Pan down works correctly" ); 88 87 t.ok(!flag.mousedown, "mousedown does not get to the map"); 89 88 t.ok(flag.mouseup, "mouseup does get to the map"); … … 92 91 resetFlags(); 93 92 94 simulateClick(w nd, wnd.control.buttons[4]);95 t.eq( w nd.mapper.getZoom(), 6, "zoomin works correctly" );93 simulateClick(window, window.control.buttons[4]); 94 t.eq( window.mapper.getZoom(), 6, "zoomin works correctly" ); 96 95 t.ok(!flag.mousedown, "mousedown does not get to the map"); 97 96 t.ok(flag.mouseup, "mouseup does get to the map"); … … 100 99 resetFlags(); 101 100 102 simulateClick(w nd, wnd.control.buttons[6]);103 t.eq( w nd.mapper.getZoom(), 5, "zoomout works correctly" );101 simulateClick(window, window.control.buttons[6]); 102 t.eq( window.mapper.getZoom(), 5, "zoomout works correctly" ); 104 103 t.ok(!flag.mousedown, "mousedown does not get to the map"); 105 104 t.ok(flag.mouseup, "mouseup does get to the map"); … … 108 107 resetFlags(); 109 108 110 simulateClick(w nd, wnd.control.buttons[5]);111 t.eq( w nd.mapper.getZoom(), 2, "zoomworld works correctly" );109 simulateClick(window, window.control.buttons[5]); 110 t.eq( window.mapper.getZoom(), 2, "zoomworld works correctly" ); 112 111 t.ok(!flag.mousedown, "mousedown does not get to the map"); 113 112 t.ok(flag.mouseup, "mouseup does get to the map"); … … 117 116 118 117 }); 119 });120 118 } 121 119 } 122 120 123 function simulateClick(w nd, elem) {124 var evt = w nd.document.createEvent("MouseEvents");125 evt.initMouseEvent("mousedown", true, true, w nd, 0, 0, 0, 0, 0, false, false, false, false, 0, null);121 function simulateClick(window, elem) { 122 var evt = window.document.createEvent("MouseEvents"); 123 evt.initMouseEvent("mousedown", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); 126 124 elem.dispatchEvent(evt); 127 125 128 evt = w nd.document.createEvent("MouseEvents");129 evt.initMouseEvent("mouseup", true, true, w nd, 0, 0, 0, 0, 0, false, false, false, false, 0, null);126 evt = window.document.createEvent("MouseEvents"); 127 evt.initMouseEvent("mouseup", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); 130 128 elem.dispatchEvent(evt); 131 129 132 evt = w nd.document.createEvent("MouseEvents");133 evt.initMouseEvent("click", true, true, w nd, 0, 0, 0, 0, 0, false, false, false, false, 0, null);130 evt = window.document.createEvent("MouseEvents"); 131 evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); 134 132 elem.dispatchEvent(evt); 135 133 136 evt = w nd.document.createEvent("MouseEvents");137 evt.initMouseEvent("dblclick", true, true, w nd, 0, 0, 0, 0, 0, false, false, false, false, 0, null);134 evt = window.document.createEvent("MouseEvents"); 135 evt.initMouseEvent("dblclick", true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null); 138 136 elem.dispatchEvent(evt); 139 137 } … … 157 155 </script> 158 156 </head> 159 <body onload="loader()">157 <body> 160 158 <div id="map" style="width: 1024px; height: 512px;"/> 161 159 </body>
