Pullup r2999:3087 for RC2.
svn merge trunk/openlayers/@2999 trunk/openlayers/@HEAD branches/openlayers/2.4/ git-svn-id: http://svn.openlayers.org/branches/openlayers/2.4@3088 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -36,29 +36,84 @@
|
||||
//ie can't simulate mouseclicks
|
||||
t.plan(0)
|
||||
} else {
|
||||
t.plan( 7 );
|
||||
t.plan(35);
|
||||
t.open_window( "Control/test_PanZoom.html", function( wnd ) {
|
||||
t.delay_call( 3, function() {
|
||||
simulateClick(wnd, wnd.control.buttons[0]);
|
||||
var flag;
|
||||
function setFlag(evt) {
|
||||
flag[evt.type] = true;
|
||||
}
|
||||
function resetFlags() {
|
||||
flag = {
|
||||
mousedown: false,
|
||||
mouseup: false,
|
||||
click: false,
|
||||
dblclick: false
|
||||
};
|
||||
}
|
||||
resetFlags();
|
||||
|
||||
wnd.mapper.events.register("mousedown", mapper, setFlag);
|
||||
wnd.mapper.events.register("mouseup", mapper, setFlag);
|
||||
wnd.mapper.events.register("click", mapper, setFlag);
|
||||
wnd.mapper.events.register("dblclick", mapper, setFlag);
|
||||
|
||||
simulateClick(wnd, wnd.control.buttons[0]);
|
||||
t.ok( wnd.mapper.getCenter().lat > wnd.centerLL.lat, "Pan up works correctly" );
|
||||
t.ok(!flag.mousedown, "mousedown does not get to the map");
|
||||
t.ok(!flag.mouseup, "mouseup does not get to the map");
|
||||
t.ok(!flag.click, "click does not get to the map");
|
||||
t.ok(!flag.dblclick, "dblclick does not get to the map");
|
||||
resetFlags();
|
||||
|
||||
simulateClick(wnd, wnd.control.buttons[1]);
|
||||
t.ok( wnd.mapper.getCenter().lon < wnd.centerLL.lon, "Pan left works correctly" );
|
||||
t.ok(!flag.mousedown, "mousedown does not get to the map");
|
||||
t.ok(!flag.mouseup, "mouseup does not get to the map");
|
||||
t.ok(!flag.click, "click does not get to the map");
|
||||
t.ok(!flag.dblclick, "dblclick does not get to the map");
|
||||
resetFlags();
|
||||
|
||||
simulateClick(wnd, wnd.control.buttons[2]);
|
||||
t.ok( wnd.mapper.getCenter().lon == wnd.centerLL.lon, "Pan right works correctly" );
|
||||
t.ok(!flag.mousedown, "mousedown does not get to the map");
|
||||
t.ok(!flag.mouseup, "mouseup does not get to the map");
|
||||
t.ok(!flag.click, "click does not get to the map");
|
||||
t.ok(!flag.dblclick, "dblclick does not get to the map");
|
||||
resetFlags();
|
||||
|
||||
simulateClick(wnd, wnd.control.buttons[3]);
|
||||
t.ok( wnd.mapper.getCenter().lat == wnd.centerLL.lat, "Pan down works correctly" );
|
||||
t.ok(!flag.mousedown, "mousedown does not get to the map");
|
||||
t.ok(!flag.mouseup, "mouseup does not get to the map");
|
||||
t.ok(!flag.click, "click does not get to the map");
|
||||
t.ok(!flag.dblclick, "dblclick does not get to the map");
|
||||
resetFlags();
|
||||
|
||||
simulateClick(wnd, wnd.control.buttons[4]);
|
||||
t.eq( wnd.mapper.getZoom(), 6, "zoomin works correctly" );
|
||||
t.ok(!flag.mousedown, "mousedown does not get to the map");
|
||||
t.ok(!flag.mouseup, "mouseup does not get to the map");
|
||||
t.ok(!flag.click, "click does not get to the map");
|
||||
t.ok(!flag.dblclick, "dblclick does not get to the map");
|
||||
resetFlags();
|
||||
|
||||
simulateClick(wnd, wnd.control.buttons[6]);
|
||||
t.eq( wnd.mapper.getZoom(), 5, "zoomout works correctly" );
|
||||
t.ok(!flag.mousedown, "mousedown does not get to the map");
|
||||
t.ok(!flag.mouseup, "mouseup does not get to the map");
|
||||
t.ok(!flag.click, "click does not get to the map");
|
||||
t.ok(!flag.dblclick, "dblclick does not get to the map");
|
||||
resetFlags();
|
||||
|
||||
simulateClick(wnd, wnd.control.buttons[5]);
|
||||
t.eq( wnd.mapper.getZoom(), 2, "zoomworld works correctly" );
|
||||
t.ok(!flag.mousedown, "mousedown does not get to the map");
|
||||
t.ok(!flag.mouseup, "mouseup does not get to the map");
|
||||
t.ok(!flag.click, "click does not get to the map");
|
||||
t.ok(!flag.dblclick, "dblclick does not get to the map");
|
||||
resetFlags();
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -67,7 +122,19 @@
|
||||
function simulateClick(wnd, elem) {
|
||||
var evt = wnd.document.createEvent("MouseEvents");
|
||||
evt.initMouseEvent("mousedown", true, true, wnd, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
|
||||
var canceled = !elem.dispatchEvent(evt);
|
||||
elem.dispatchEvent(evt);
|
||||
|
||||
evt = wnd.document.createEvent("MouseEvents");
|
||||
evt.initMouseEvent("mouseup", true, true, wnd, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
|
||||
elem.dispatchEvent(evt);
|
||||
|
||||
evt = wnd.document.createEvent("MouseEvents");
|
||||
evt.initMouseEvent("click", true, true, wnd, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
|
||||
elem.dispatchEvent(evt);
|
||||
|
||||
evt = wnd.document.createEvent("MouseEvents");
|
||||
evt.initMouseEvent("dblclick", true, true, wnd, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
|
||||
elem.dispatchEvent(evt);
|
||||
}
|
||||
|
||||
function loader() {
|
||||
|
||||
Reference in New Issue
Block a user