Destroying what we create.
git-svn-id: http://svn.openlayers.org/trunk/openlayers@10042 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -33,6 +33,8 @@
|
||||
t.ok( map.events instanceof OpenLayers.Events, "map.events is an OpenLayers.Events" );
|
||||
t.ok( map.getMaxExtent() instanceof OpenLayers.Bounds, "map.maxExtent is an OpenLayers.Bounds" );
|
||||
t.ok( map.getNumZoomLevels() > 0, "map has a default numZoomLevels" );
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
function test_Map_constructor_late_rendering(t) {
|
||||
@@ -56,6 +58,9 @@
|
||||
|
||||
t.ok(map.div == mapDiv, "Map is now rendered to the 'map' div.")
|
||||
t.ok( OpenLayers.Element.hasClass(map.div, "olMap"), "Map div has olMap class");
|
||||
|
||||
map.destroy();
|
||||
|
||||
}
|
||||
|
||||
function test_Map_constructor_renderTo(t) {
|
||||
@@ -71,6 +76,8 @@
|
||||
|
||||
var mapDiv = document.getElementById("map");
|
||||
t.ok(map.div == mapDiv, "Map is rendered to the 'map' div.")
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
function test_Map_setOptions(t) {
|
||||
@@ -81,6 +88,8 @@
|
||||
t.eq(map.theme, 'foo', "theme is correctly set by setOptions");
|
||||
t.ok(map.maxExtent.equals(new OpenLayers.Bounds(100, 200, 300, 400)),
|
||||
"maxExtent is correct after calling setOptions");
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
function test_Map_add_layers(t) {
|
||||
@@ -113,7 +122,8 @@
|
||||
layer3.name = 'pleaseadd';
|
||||
map.addLayers([layer3]);
|
||||
t.eq(map.layers.length, 3, "layer is added since preaddlayer returns true");
|
||||
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
function test_Map_options(t) {
|
||||
@@ -122,6 +132,8 @@
|
||||
t.eq( map.numZoomLevels, 6, "map.numZoomLevels set correctly via options hashtable" );
|
||||
t.eq( map.maxResolution, 3.14159, "map.maxResolution set correctly via options hashtable" );
|
||||
t.eq( map.theme, 'foo', "map theme set correctly." );
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
function test_eventListeners(t) {
|
||||
@@ -181,6 +193,8 @@
|
||||
|
||||
map.getCenter().lon = 10;
|
||||
t.ok( map.getCenter().equals(ll), "map.getCenter returns a clone of map.center");
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
function test_Map_zoomend_event (t) {
|
||||
@@ -198,6 +212,8 @@
|
||||
map.setCenter(new OpenLayers.LonLat(2, 1), 0);
|
||||
map.zoomIn();
|
||||
map.zoomOut();
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
function test_Map_add_remove_popup (t) {
|
||||
@@ -242,6 +258,8 @@
|
||||
}
|
||||
}
|
||||
t.ok(!found, "popup.div successfully removed from the map's viewPort");
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
function test_Map_add_popup_exclusive(t) {
|
||||
@@ -268,6 +286,8 @@
|
||||
new OpenLayers.Size(200,200));
|
||||
map.addPopup(popup, true);
|
||||
t.eq(map.popups.length, 1, "addPopup exclusive mode works");
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
|
||||
@@ -319,6 +339,8 @@
|
||||
t.ok( !map.isValidLonLat(null), "null lonlat is not valid" );
|
||||
t.ok( map.isValidLonLat(new OpenLayers.LonLat(33862, 717606)), "lonlat outside max extent is valid" );
|
||||
t.ok( !map.isValidLonLat(new OpenLayers.LonLat(10, 10)), "lonlat outside max extent is not valid" );
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
function test_Map_getLayer(t) {
|
||||
@@ -340,6 +362,8 @@
|
||||
|
||||
var gotLayer = OpenLayers.Map.prototype.getLayer.apply(m, ["chicken"]);
|
||||
t.ok( gotLayer == null, "getLayer correctly returns null when layer not found");
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
function test_Map_getLayersBy(t) {
|
||||
@@ -638,6 +662,7 @@
|
||||
|
||||
t.eq( map.layers.length, 1, "Map does not allow double adding of layers." );
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
function test_Map_setBaseLayer(t) {
|
||||
@@ -667,6 +692,8 @@
|
||||
|
||||
map.setBaseLayer(wmslayer2);
|
||||
t.ok(map.baseLayer == wmslayer2, "setbaselayer correctly sets 'baseLayer' property");
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
function test_Map_removeLayer(t) {
|
||||
@@ -717,6 +744,8 @@
|
||||
map.removeLayer(layer0);
|
||||
t.eq(map.getResolution(), layer0.resolutions[1],
|
||||
"correct resolution after removal");
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
function test_Map_removeLayer_zindex(t) {
|
||||
@@ -735,6 +764,8 @@
|
||||
"correct z-index after removeLayer");
|
||||
t.eq(parseInt(layer2.div.style.zIndex), map.Z_INDEX_BASE['Overlay'] + 5,
|
||||
"correct z-index after removeLayer");
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
function test_Map_setBaseLayer_after_pan (t) {
|
||||
@@ -754,6 +785,8 @@
|
||||
map.pan(0, -200, {animate:false});
|
||||
map.setBaseLayer(wmsLayer);
|
||||
t.eq(map.layerContainerDiv.style.top, "0px", "layerContainer is recentered after setBaseLayer");
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
function test_Map_moveLayer (t) {
|
||||
@@ -794,6 +827,8 @@
|
||||
"layer div has the right zIndex after moving up" );
|
||||
t.eq( map.getLayerIndex(wmslayer3), 0, "top layer is now on the bottom" );
|
||||
t.eq( ct, 3, "raiseLayer triggered changelayer the right # of times" );
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
function test_Map_moveTo(t) {
|
||||
@@ -816,6 +851,8 @@
|
||||
var ll = new OpenLayers.LonLat(-100,-150);
|
||||
map.moveTo(ll, 2);
|
||||
t.ok(map.getCenter().equals(new OpenLayers.LonLat(0,0)), "safely sets out-of-bounds lonlat");
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
function test_Map_defaultTheme(t) {
|
||||
@@ -840,6 +877,8 @@
|
||||
map = new OpenLayers.Map('map');
|
||||
t.eq(links.length, document.getElementsByTagName('link').length,
|
||||
"calling the map constructor twice with the same theme doesn't add duplicate link nodes");
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
function test_Map_customTheme(t) {
|
||||
@@ -864,6 +903,8 @@
|
||||
t.ok(themeNode != null, "a link node with the theme href was added");
|
||||
t.eq(themeNode.rel, "stylesheet", "node added has rel set to stylesheet");
|
||||
t.eq(themeNode.type, "text/css", "node added has type set to text/css");
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
function test_Map_noTheme(t) {
|
||||
@@ -876,6 +917,8 @@
|
||||
map = new OpenLayers.Map('map', options);
|
||||
|
||||
t.eq(nodeCount, head.childNodes.length, "with no theme, a node is not added to document head" );
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
function test_Map_getControl(t) {
|
||||
@@ -891,6 +934,8 @@
|
||||
|
||||
gotControl = map1.getControl("bogus id");
|
||||
t.ok(gotControl == null, "getControl() for bad id returns null");
|
||||
|
||||
map1.destroy();
|
||||
}
|
||||
|
||||
function test_Map_removeControl(t) {
|
||||
@@ -939,6 +984,9 @@
|
||||
map1.removeControl(control);
|
||||
newNumControls = map1.controls.length;
|
||||
t.ok( newNumControls == oldNumControls, "removing bad controlid doesnt crash or decrease control count")
|
||||
|
||||
map1.destroy();
|
||||
|
||||
}
|
||||
|
||||
function test_Map_restrictedExtent(t) {
|
||||
@@ -1035,6 +1083,8 @@
|
||||
t.eq(map.getExtent().getCenterLonLat().toString(),
|
||||
se.toString(),
|
||||
"map extent not restricted with null restrictedExtent for se");
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
function test_Map_getResolutionForZoom(t) {
|
||||
@@ -1418,6 +1468,8 @@
|
||||
size = new OpenLayers.Size(600, 300);
|
||||
map.updateSize();
|
||||
t.eq(moveToCnt, 1, "updateSize move the map if it has a center");
|
||||
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
function test_invisible_map(t) {
|
||||
|
||||
Reference in New Issue
Block a user