As with r10477, this change simplifies the setGMapVisibility tests to make sure that repositionMapElements is getting called. These tests were periodically failing depending upon the order in which they run. This likely indicates we've got to do some more cleaning up in map.destroy or elsewhere (see #2493).
git-svn-id: http://svn.openlayers.org/trunk/openlayers@10478 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -174,7 +174,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function test_Layer_Google_setGMapVisibility(t) {
|
function test_Layer_Google_setGMapVisibility(t) {
|
||||||
t.plan(4);
|
t.plan(3);
|
||||||
|
|
||||||
var map = new OpenLayers.Map('map');
|
var map = new OpenLayers.Map('map');
|
||||||
var gmap = new OpenLayers.Layer.Google("Google Streets");
|
var gmap = new OpenLayers.Layer.Google("Google Streets");
|
||||||
@@ -190,11 +190,16 @@
|
|||||||
t.ok(!cache.termsOfUse, "termsOfUse is not yet cached");
|
t.ok(!cache.termsOfUse, "termsOfUse is not yet cached");
|
||||||
t.ok(!cache.poweredBy, "poweredBy is not yet cached");
|
t.ok(!cache.poweredBy, "poweredBy is not yet cached");
|
||||||
|
|
||||||
|
var called = 0;
|
||||||
|
var original = gmap.repositionMapElements;
|
||||||
|
gmap.repositionMapElements = function() {
|
||||||
|
++called;
|
||||||
|
original.apply(gmap, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
map.setBaseLayer(gmap);
|
map.setBaseLayer(gmap);
|
||||||
t.delay_call(4, function() {
|
t.delay_call(4, function() {
|
||||||
var cache = OpenLayers.Layer.Google.cache[map.id];
|
t.ok(called > 0, "repositionMapElements called");
|
||||||
t.eq(cache.termsOfUse.style.display, "", "termsOfUse is visible");
|
|
||||||
t.eq(cache.poweredBy.style.display, "", "poweredBy is visible");
|
|
||||||
map.destroy();
|
map.destroy();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -222,9 +227,10 @@
|
|||||||
++called;
|
++called;
|
||||||
original.apply(gmap, arguments);
|
original.apply(gmap, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
gmap.setVisibility(true);
|
gmap.setVisibility(true);
|
||||||
t.delay_call(2, function() {
|
t.delay_call(2, function() {
|
||||||
t.ok(called > 1, "repositionMapElements called");
|
t.ok(called > 0, "repositionMapElements called");
|
||||||
map.destroy();
|
map.destroy();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user