Fixed zoomend event code; changed semantics of the argument to moveToNewExtent to make the argument be the *previous* zoom level. Added tests.

git-svn-id: http://svn.openlayers.org/trunk/openlayers@66 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Schuyler Erle
2006-05-16 23:46:41 +00:00
parent c494b8ef2d
commit ed9b57b6df
2 changed files with 24 additions and 17 deletions
+12 -2
View File
@@ -54,17 +54,27 @@
t.eq( map.maxResolution, 3.14159, "map.maxResolution set correctly via options hash" );
}
function test_05_Map_center(t) {
t.plan(5);
t.plan(4);
map = new OpenLayers.Map($('map'));
map.setCenter(new OpenLayers.LatLon(1,2), 0);
map.zoomIn();
t.ok( map.getCenter() instanceof OpenLayers.LatLon, "map.getCenter returns a LatLon");
t.eq( map.getZoom(), 1, "map.zoom is correct after calling setCenter,zoom in");
t.eq( map.getCenter().lat, 1, "map center lat is correct after calling setCenter,zoom in");
t.eq( map.getCenter().lon, 2, "map center lon is correct after calling setCenter, zoom in");
map.zoomOut();
t.eq( map.getZoom(), 0, "map.zoom is correct after calling setCenter,zoom in, zoom out");
}
function test_06_Map_zoomend_event (t) {
t.plan(3);
map = new OpenLayers.Map('map');
map.events.register("zoomend", {count: 0}, function() {
this.count++;
t.ok(true, "zoomend event was triggered " + this.count + " times");
});
map.setCenter(new OpenLayers.LatLon(1,2), 0);
map.zoomIn();
map.zoomOut();
}
function test_99_Map_destroy (t) {
t.plan( 2 );
map = new OpenLayers.Map($('map'));