Making it so moveTo is only called once when creating a map with center and layers options. r=crschmidt (closes #3114)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@11480 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2011-02-25 11:47:41 +00:00
parent 269749ec23
commit f7fcb86ee9
2 changed files with 17 additions and 1 deletions

View File

@@ -1602,7 +1602,7 @@
}
function test_center_option(t) {
t.plan(6);
t.plan(7);
var map, msg;
@@ -1625,6 +1625,12 @@
map.destroy();
}
var log = [];
var meth = OpenLayers.Layer.prototype.moveTo;
OpenLayers.Layer.prototype.moveTo = function() {
log.push(arguments);
meth.apply(this, arguments);
};
// set center without zoom
var center = new OpenLayers.LonLat(1, 2);
@@ -1635,8 +1641,10 @@
});
t.ok(center.equals(map.getCenter()), "map center set without zoom");
t.eq(log.length, 1, "moveTo called once");
map.destroy();
OpenLayers.Layer.prototype.moveTo = meth;
// set center and zoom
var zoom = 3;