make it easier to change the delay passed to the delay_call func, test only, no functional change
git-svn-id: http://svn.openlayers.org/trunk/openlayers@8778 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -47,6 +47,7 @@
|
|||||||
map.addControl(control);
|
map.addControl(control);
|
||||||
|
|
||||||
var STARTING_ZOOM_LEVEL = 4;
|
var STARTING_ZOOM_LEVEL = 4;
|
||||||
|
var DELAY = 2;
|
||||||
|
|
||||||
var centerLL = new OpenLayers.LonLat(0,0);
|
var centerLL = new OpenLayers.LonLat(0,0);
|
||||||
map.setCenter(centerLL, STARTING_ZOOM_LEVEL);
|
map.setCenter(centerLL, STARTING_ZOOM_LEVEL);
|
||||||
@@ -55,56 +56,56 @@
|
|||||||
evt.keyCode = OpenLayers.Event.KEY_LEFT;
|
evt.keyCode = OpenLayers.Event.KEY_LEFT;
|
||||||
control.defaultKeyPress(evt);
|
control.defaultKeyPress(evt);
|
||||||
t.delay_call(
|
t.delay_call(
|
||||||
2, function() {
|
DELAY, function() {
|
||||||
t.ok( map.getCenter().lon < centerLL.lon, "key left works correctly" );
|
t.ok( map.getCenter().lon < centerLL.lon, "key left works correctly" );
|
||||||
|
|
||||||
// Start new test.
|
// Start new test.
|
||||||
evt.keyCode = OpenLayers.Event.KEY_RIGHT;
|
evt.keyCode = OpenLayers.Event.KEY_RIGHT;
|
||||||
control.defaultKeyPress(evt);
|
control.defaultKeyPress(evt);
|
||||||
},
|
},
|
||||||
2, function() {
|
DELAY, function() {
|
||||||
t.eq( map.getCenter().lon, centerLL.lon, "key right works correctly" );
|
t.eq( map.getCenter().lon, centerLL.lon, "key right works correctly" );
|
||||||
|
|
||||||
// Start new test.
|
// Start new test.
|
||||||
evt.keyCode = OpenLayers.Event.KEY_UP;
|
evt.keyCode = OpenLayers.Event.KEY_UP;
|
||||||
control.defaultKeyPress(evt);
|
control.defaultKeyPress(evt);
|
||||||
},
|
},
|
||||||
2, function() {
|
DELAY, function() {
|
||||||
t.ok( map.getCenter().lat > centerLL.lat, "key up works correctly" );
|
t.ok( map.getCenter().lat > centerLL.lat, "key up works correctly" );
|
||||||
|
|
||||||
// Start new test.
|
// Start new test.
|
||||||
evt.keyCode = OpenLayers.Event.KEY_DOWN;
|
evt.keyCode = OpenLayers.Event.KEY_DOWN;
|
||||||
control.defaultKeyPress(evt);
|
control.defaultKeyPress(evt);
|
||||||
},
|
},
|
||||||
2, function() {
|
DELAY, function() {
|
||||||
t.ok( map.getCenter().lat == centerLL.lat, "key down works correctly" );
|
t.ok( map.getCenter().lat == centerLL.lat, "key down works correctly" );
|
||||||
|
|
||||||
// Start new test.
|
// Start new test.
|
||||||
evt.keyCode = 33; //page up
|
evt.keyCode = 33; //page up
|
||||||
control.defaultKeyPress(evt);
|
control.defaultKeyPress(evt);
|
||||||
},
|
},
|
||||||
2, function() {
|
DELAY, function() {
|
||||||
t.ok( map.getCenter().lat > centerLL.lat, "key page up works correctly" );
|
t.ok( map.getCenter().lat > centerLL.lat, "key page up works correctly" );
|
||||||
|
|
||||||
// Start new test.
|
// Start new test.
|
||||||
evt.keyCode = 34; //page down
|
evt.keyCode = 34; //page down
|
||||||
control.defaultKeyPress(evt);
|
control.defaultKeyPress(evt);
|
||||||
},
|
},
|
||||||
2, function() {
|
DELAY, function() {
|
||||||
t.ok( map.getCenter().lat == centerLL.lat, "key page down works correctly" );
|
t.ok( map.getCenter().lat == centerLL.lat, "key page down works correctly" );
|
||||||
|
|
||||||
// Start new test.
|
// Start new test.
|
||||||
evt.keyCode = 35; //end
|
evt.keyCode = 35; //end
|
||||||
control.defaultKeyPress(evt);
|
control.defaultKeyPress(evt);
|
||||||
},
|
},
|
||||||
2, function() {
|
DELAY, function() {
|
||||||
t.ok( map.getCenter().lon > centerLL.lon, "key end works correctly" );
|
t.ok( map.getCenter().lon > centerLL.lon, "key end works correctly" );
|
||||||
|
|
||||||
// Start new test.
|
// Start new test.
|
||||||
evt.keyCode = 36; //home
|
evt.keyCode = 36; //home
|
||||||
control.defaultKeyPress(evt);
|
control.defaultKeyPress(evt);
|
||||||
},
|
},
|
||||||
2, function() {
|
DELAY, function() {
|
||||||
t.ok( map.getCenter().lon == centerLL.lon, "key home works correctly");
|
t.ok( map.getCenter().lon == centerLL.lon, "key home works correctly");
|
||||||
|
|
||||||
// Start new test.
|
// Start new test.
|
||||||
|
|||||||
Reference in New Issue
Block a user