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:
euzuro
2007-03-21 19:03:09 +00:00
parent 4bd131c882
commit 7425a06550
5 changed files with 21 additions and 6 deletions

View File

@@ -225,6 +225,7 @@ OpenLayers.Map.prototype = {
}
this.controls = null;
}
this.div.innerHTML = "";
},
/**

View File

@@ -21,6 +21,7 @@
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" );
map.destroy();
}
function test_03_Control_PanZoom_control_events (t) {
t.plan( 10 );
@@ -64,6 +65,7 @@
t.eq(overviewCenter.lat, 0, "Overviewmap center lat correct -- second zoom");
t.eq(overviewZoom, 0, "Overviewmap zoomcorrect -- second zoom");
map.destroy();
}
// -->

View File

@@ -62,6 +62,7 @@
url + "?" + OpenLayers.Util.getParameterString(tParams),
"div first child is correct image object" );
t.eq( tile.position.toString(), "x=5,y=6", "Position of tile is set correctly." );
map.destroy();
}
function test_03_Layer_WMS_inittiles (t) {
@@ -72,7 +73,7 @@
map.setCenter(new OpenLayers.LonLat(0,0),5);
t.eq( layer.grid.length, 7, "Grid rows 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");
layer.grid = null;
map.destroy();
}
function test_05_Layer_WMS_isBaseLayer(t) {
@@ -142,6 +144,7 @@
newParams.CHICKPEAS = 151;
t.eq( layer.params.CHICKPEAS, "image/png", "mergeNewParams() makes clean copy of hashtable");
map.destroy();
}
function test_07_Layer_WMS_getFullRequestString (t) {
@@ -171,6 +174,7 @@
t.eq(str,
tUrl + "?" + OpenLayers.Util.getParameterString(tParams),
"getFullRequestString() by default does *not* add SRS value if projection is 'none'");
map.destroy();
}
@@ -196,22 +200,25 @@
tile.draw();
t.eq(parseFloat(tile.imgDiv.style.opacity), 0.6, "Tile opacity is set correctly");
map.destroy();
}
function test_20_Layer_WMS_Reproject (t) {
t.plan(5);
var map = new OpenLayers.Map('map');
var layer = new OpenLayers.Layer.Google("Google");
map.addLayer(layer);
layer = new OpenLayers.Layer.WMS(name, url, params, {isBaseLayer: false});
layer.isBaseLayer=false;
map.addLayer(layer);
wmslayer = new OpenLayers.Layer.WMS(name, url, params, {isBaseLayer: false});
wmslayer.isBaseLayer=false;
map.addLayer(wmslayer);
map.setCenter(new OpenLayers.LonLat(0,0), 5);
var tile = layer.grid[0][0];
t.eq( tile.bounds.left, -22.5, "left 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.top.toFixed(6), '21.943046', "top side matches" );
map.destroy();
var map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.WMS(name, url, params);
@@ -219,6 +226,8 @@
map.setCenter(new OpenLayers.LonLat(0,0), 5);
var tile = layer.grid[0][0];
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) {

View File

@@ -318,11 +318,12 @@
function test_99_Map_destroy (t) {
t.plan( 2 );
t.plan( 3 );
map = new OpenLayers.Map('map');
map.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.div.innerHTML, "", "map's div cleared out");
}
// -->
</script>

View File

@@ -42,7 +42,7 @@
mlayer.addMarker(marker2);
t.ok( !marker2.onScreen(), "marker knows it's offscreen" );
map.destroy();
}
function test_03_Marker_setOpacity(t) {
@@ -70,6 +70,7 @@
marker.setOpacity(0.5);
t.eq(parseFloat(marker.icon.imageDiv.style.opacity), 0.5, "marker.setOpacity() works");
map.destroy();
}
function test_04_Marker_moveTo(t) {
t.plan( 6 );
@@ -101,6 +102,7 @@
marker.moveTo(new OpenLayers.Pixel(0,0));
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");
map.destroy();
}