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