Adding test to make sure we don't pan.
This commit is contained in:
@@ -380,11 +380,13 @@
|
||||
*/
|
||||
|
||||
function test_Map_isValidZoomLevel(t) {
|
||||
t.plan(4);
|
||||
t.plan(5);
|
||||
var map = new OpenLayers.Map("map");
|
||||
map.addLayer(new OpenLayers.Layer(null, {
|
||||
isBaseLayer: true, numZoomLevels: 19
|
||||
}))
|
||||
isBaseLayer: true, wrapDateLine: true, numZoomLevels: 19
|
||||
}));
|
||||
map.zoomToMaxExtent();
|
||||
|
||||
var valid;
|
||||
|
||||
valid = OpenLayers.Map.prototype.isValidZoomLevel.apply(map, [-1]);
|
||||
@@ -398,6 +400,9 @@
|
||||
|
||||
valid = OpenLayers.Map.prototype.isValidZoomLevel.apply(map, [19]);
|
||||
t.eq(valid, false, "19 is not a valid zoomLevel");
|
||||
|
||||
map.moveTo([16, 48], 0);
|
||||
t.eq(map.getCenter().toShortString(), "0, 0", "no panning when moveTo is called with invalid zoom");
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
@@ -1966,7 +1971,7 @@
|
||||
}
|
||||
|
||||
function test_adjustZoom(t) {
|
||||
t.plan(3);
|
||||
t.plan(4);
|
||||
var map = new OpenLayers.Map({
|
||||
div: 'map',
|
||||
layers: [
|
||||
@@ -1981,6 +1986,9 @@
|
||||
|
||||
t.eq(map.adjustZoom(9), 9, "valid zoom maintained");
|
||||
t.eq(map.adjustZoom(1), 2, "zoom adjusted to not exceed world width");
|
||||
|
||||
map.moveTo([16, 48], 0);
|
||||
t.eq(map.getCenter().toShortString(), "0, 0", "no panning when moveTo is called with invalid zoom");
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user