fix for #549 - clearing out of map div on map.destroy(). this fixes many opera tests
git-svn-id: http://svn.openlayers.org/trunk/openlayers@2836 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -225,6 +225,7 @@ OpenLayers.Map.prototype = {
|
|||||||
}
|
}
|
||||||
this.controls = null;
|
this.controls = null;
|
||||||
}
|
}
|
||||||
|
this.div.innerHTML = "";
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
t.eq( parseInt(control.div.style.zIndex), map.Z_INDEX_BASE['Control'] + 4, "Control div zIndexed properly" );
|
t.eq( parseInt(control.div.style.zIndex), map.Z_INDEX_BASE['Control'] + 4, "Control div zIndexed properly" );
|
||||||
t.eq( parseInt(map.viewPortDiv.lastChild.style.zIndex), map.Z_INDEX_BASE['Control'] + 4, "Viewport div contains control div" );
|
t.eq( parseInt(map.viewPortDiv.lastChild.style.zIndex), map.Z_INDEX_BASE['Control'] + 4, "Viewport div contains control div" );
|
||||||
|
|
||||||
|
map.destroy();
|
||||||
}
|
}
|
||||||
function test_03_Control_PanZoom_control_events (t) {
|
function test_03_Control_PanZoom_control_events (t) {
|
||||||
t.plan( 10 );
|
t.plan( 10 );
|
||||||
@@ -64,6 +65,7 @@
|
|||||||
t.eq(overviewCenter.lat, 0, "Overviewmap center lat correct -- second zoom");
|
t.eq(overviewCenter.lat, 0, "Overviewmap center lat correct -- second zoom");
|
||||||
t.eq(overviewZoom, 0, "Overviewmap zoomcorrect -- second zoom");
|
t.eq(overviewZoom, 0, "Overviewmap zoomcorrect -- second zoom");
|
||||||
|
|
||||||
|
map.destroy();
|
||||||
|
|
||||||
}
|
}
|
||||||
// -->
|
// -->
|
||||||
|
|||||||
@@ -62,6 +62,7 @@
|
|||||||
url + "?" + OpenLayers.Util.getParameterString(tParams),
|
url + "?" + OpenLayers.Util.getParameterString(tParams),
|
||||||
"div first child is correct image object" );
|
"div first child is correct image object" );
|
||||||
t.eq( tile.position.toString(), "x=5,y=6", "Position of tile is set correctly." );
|
t.eq( tile.position.toString(), "x=5,y=6", "Position of tile is set correctly." );
|
||||||
|
map.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_03_Layer_WMS_inittiles (t) {
|
function test_03_Layer_WMS_inittiles (t) {
|
||||||
@@ -72,7 +73,7 @@
|
|||||||
map.setCenter(new OpenLayers.LonLat(0,0),5);
|
map.setCenter(new OpenLayers.LonLat(0,0),5);
|
||||||
t.eq( layer.grid.length, 7, "Grid rows is correct." );
|
t.eq( layer.grid.length, 7, "Grid rows is correct." );
|
||||||
t.eq( layer.grid[0].length, 6, "Grid cols is correct." );
|
t.eq( layer.grid[0].length, 6, "Grid cols is correct." );
|
||||||
|
map.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -101,6 +102,7 @@
|
|||||||
t.eq( clone.alpha, layer.alpha, "alpha copied correctly");
|
t.eq( clone.alpha, layer.alpha, "alpha copied correctly");
|
||||||
|
|
||||||
layer.grid = null;
|
layer.grid = null;
|
||||||
|
map.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_05_Layer_WMS_isBaseLayer(t) {
|
function test_05_Layer_WMS_isBaseLayer(t) {
|
||||||
@@ -142,6 +144,7 @@
|
|||||||
newParams.CHICKPEAS = 151;
|
newParams.CHICKPEAS = 151;
|
||||||
|
|
||||||
t.eq( layer.params.CHICKPEAS, "image/png", "mergeNewParams() makes clean copy of hashtable");
|
t.eq( layer.params.CHICKPEAS, "image/png", "mergeNewParams() makes clean copy of hashtable");
|
||||||
|
map.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_07_Layer_WMS_getFullRequestString (t) {
|
function test_07_Layer_WMS_getFullRequestString (t) {
|
||||||
@@ -171,6 +174,7 @@
|
|||||||
t.eq(str,
|
t.eq(str,
|
||||||
tUrl + "?" + OpenLayers.Util.getParameterString(tParams),
|
tUrl + "?" + OpenLayers.Util.getParameterString(tParams),
|
||||||
"getFullRequestString() by default does *not* add SRS value if projection is 'none'");
|
"getFullRequestString() by default does *not* add SRS value if projection is 'none'");
|
||||||
|
map.destroy();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,22 +200,25 @@
|
|||||||
tile.draw();
|
tile.draw();
|
||||||
t.eq(parseFloat(tile.imgDiv.style.opacity), 0.6, "Tile opacity is set correctly");
|
t.eq(parseFloat(tile.imgDiv.style.opacity), 0.6, "Tile opacity is set correctly");
|
||||||
|
|
||||||
|
map.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_20_Layer_WMS_Reproject (t) {
|
function test_20_Layer_WMS_Reproject (t) {
|
||||||
t.plan(5);
|
t.plan(5);
|
||||||
|
|
||||||
var map = new OpenLayers.Map('map');
|
var map = new OpenLayers.Map('map');
|
||||||
var layer = new OpenLayers.Layer.Google("Google");
|
var layer = new OpenLayers.Layer.Google("Google");
|
||||||
map.addLayer(layer);
|
map.addLayer(layer);
|
||||||
layer = new OpenLayers.Layer.WMS(name, url, params, {isBaseLayer: false});
|
wmslayer = new OpenLayers.Layer.WMS(name, url, params, {isBaseLayer: false});
|
||||||
layer.isBaseLayer=false;
|
wmslayer.isBaseLayer=false;
|
||||||
map.addLayer(layer);
|
map.addLayer(wmslayer);
|
||||||
map.setCenter(new OpenLayers.LonLat(0,0), 5);
|
map.setCenter(new OpenLayers.LonLat(0,0), 5);
|
||||||
var tile = layer.grid[0][0];
|
var tile = layer.grid[0][0];
|
||||||
t.eq( tile.bounds.left, -22.5, "left side matches" );
|
t.eq( tile.bounds.left, -22.5, "left side matches" );
|
||||||
t.eq( tile.bounds.right, -11.25, "top side matches" );
|
t.eq( tile.bounds.right, -11.25, "top side matches" );
|
||||||
t.eq( tile.bounds.bottom.toFixed(6), '11.178402', "bottom side matches" );
|
t.eq( tile.bounds.bottom.toFixed(6), '11.178402', "bottom side matches" );
|
||||||
t.eq( tile.bounds.top.toFixed(6), '21.943046', "top side matches" );
|
t.eq( tile.bounds.top.toFixed(6), '21.943046', "top side matches" );
|
||||||
|
map.destroy();
|
||||||
|
|
||||||
var map = new OpenLayers.Map('map');
|
var map = new OpenLayers.Map('map');
|
||||||
layer = new OpenLayers.Layer.WMS(name, url, params);
|
layer = new OpenLayers.Layer.WMS(name, url, params);
|
||||||
@@ -219,6 +226,8 @@
|
|||||||
map.setCenter(new OpenLayers.LonLat(0,0), 5);
|
map.setCenter(new OpenLayers.LonLat(0,0), 5);
|
||||||
var tile = layer.grid[0][0];
|
var tile = layer.grid[0][0];
|
||||||
t.ok( tile.bounds.equals(new OpenLayers.Bounds(-33.75, 33.75, -22.5, 45)), "okay");
|
t.ok( tile.bounds.equals(new OpenLayers.Bounds(-33.75, 33.75, -22.5, 45)), "okay");
|
||||||
|
|
||||||
|
map.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_99_Layer_WMS_destroy (t) {
|
function test_99_Layer_WMS_destroy (t) {
|
||||||
|
|||||||
+2
-1
@@ -318,11 +318,12 @@
|
|||||||
|
|
||||||
|
|
||||||
function test_99_Map_destroy (t) {
|
function test_99_Map_destroy (t) {
|
||||||
t.plan( 2 );
|
t.plan( 3 );
|
||||||
map = new OpenLayers.Map('map');
|
map = new OpenLayers.Map('map');
|
||||||
map.destroy();
|
map.destroy();
|
||||||
t.eq( map.layers, null, "map.layers is null after destroy" );
|
t.eq( map.layers, null, "map.layers is null after destroy" );
|
||||||
t.eq( map.controls, null, "map.controls is null after destroy" );
|
t.eq( map.controls, null, "map.controls is null after destroy" );
|
||||||
|
t.eq( map.div.innerHTML, "", "map's div cleared out");
|
||||||
}
|
}
|
||||||
// -->
|
// -->
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
mlayer.addMarker(marker2);
|
mlayer.addMarker(marker2);
|
||||||
|
|
||||||
t.ok( !marker2.onScreen(), "marker knows it's offscreen" );
|
t.ok( !marker2.onScreen(), "marker knows it's offscreen" );
|
||||||
|
map.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_03_Marker_setOpacity(t) {
|
function test_03_Marker_setOpacity(t) {
|
||||||
@@ -70,6 +70,7 @@
|
|||||||
marker.setOpacity(0.5);
|
marker.setOpacity(0.5);
|
||||||
|
|
||||||
t.eq(parseFloat(marker.icon.imageDiv.style.opacity), 0.5, "marker.setOpacity() works");
|
t.eq(parseFloat(marker.icon.imageDiv.style.opacity), 0.5, "marker.setOpacity() works");
|
||||||
|
map.destroy();
|
||||||
}
|
}
|
||||||
function test_04_Marker_moveTo(t) {
|
function test_04_Marker_moveTo(t) {
|
||||||
t.plan( 6 );
|
t.plan( 6 );
|
||||||
@@ -101,6 +102,7 @@
|
|||||||
marker.moveTo(new OpenLayers.Pixel(0,0));
|
marker.moveTo(new OpenLayers.Pixel(0,0));
|
||||||
t.eq(marker.lonlat.lon, map.getExtent().left, "on left edge of map");
|
t.eq(marker.lonlat.lon, map.getExtent().left, "on left edge of map");
|
||||||
t.eq(marker.lonlat.lat, map.getExtent().top, "on top edge of map");
|
t.eq(marker.lonlat.lat, map.getExtent().top, "on top edge of map");
|
||||||
|
map.destroy();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user