From 701e171081ccadfe5550c464cccb1955d983d1ca Mon Sep 17 00:00:00 2001 From: ahocevar Date: Fri, 16 Dec 2011 11:48:08 +0100 Subject: [PATCH] Adding test to make sure we don't pan. --- tests/Map.html | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/Map.html b/tests/Map.html index 856434ac6d..faad0b30c7 100644 --- a/tests/Map.html +++ b/tests/Map.html @@ -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"); }