Revert r6710: The new popup coe is going to need to change tests, so this
needs to wait. git-svn-id: http://svn.openlayers.org/trunk/openlayers@6711 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -0,0 +1,139 @@
|
||||
<html>
|
||||
<head>
|
||||
<script src="../../lib/OpenLayers.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
var name = "Vector Layer";
|
||||
|
||||
function test_Layer_WFS_constructor(t) {
|
||||
t.plan(3);
|
||||
|
||||
var layer = new OpenLayers.Layer.WFS(name, "url", {});
|
||||
t.ok(layer instanceof OpenLayers.Layer.WFS, "new OpenLayers.Layer.Vector returns correct object" );
|
||||
t.eq(layer.name, name, "layer name is correctly set");
|
||||
t.ok(layer.renderer.CLASS_NAME, "layer has a renderer");
|
||||
|
||||
}
|
||||
|
||||
function test_Layer_WFS_destroy(t) {
|
||||
t.plan(13);
|
||||
|
||||
var tVectorDestroy = OpenLayers.Layer.Vector.prototype.destroy;
|
||||
OpenLayers.Layer.Vector.prototype.destroy = function() {
|
||||
g_VectorDestroyed = true;
|
||||
}
|
||||
|
||||
var tMarkersDestroy = OpenLayers.Layer.Markers.prototype.destroy;
|
||||
OpenLayers.Layer.Markers.prototype.destroy = function() {
|
||||
g_MarkersDestroyed = true;
|
||||
}
|
||||
|
||||
var layer = {
|
||||
'vectorMode': true,
|
||||
'tile': {
|
||||
'destroy': function() {
|
||||
t.ok(true, "wfs layer's tile is destroyed");
|
||||
}
|
||||
},
|
||||
'ratio': {},
|
||||
'featureClass': {},
|
||||
'format': {},
|
||||
'formatObject': {
|
||||
'destroy': function() {
|
||||
t.ok(true, "wfs layer's format object is destroyed");
|
||||
}
|
||||
},
|
||||
'formatOptions': {},
|
||||
'encodeBBOX': {},
|
||||
'extractAttributes': {}
|
||||
};
|
||||
|
||||
//this call should set off two tests (destroys for tile and format object)
|
||||
g_VectorDestroyed = null;
|
||||
g_MarkersDestroyed = null;
|
||||
OpenLayers.Layer.WFS.prototype.destroy.apply(layer, []);
|
||||
|
||||
t.ok(g_VectorDestroyed && !g_MarkersDestroyed, "when vector mode is set to true, the default vector layer's destroy() method is called");
|
||||
t.eq(layer.vectorMode, null, "'vectorMode' property nullified");
|
||||
t.eq(layer.tile, null, "'tile' property nullified");
|
||||
t.eq(layer.ratio, null, "'ratio' property nullified");
|
||||
t.eq(layer.featureClass, null, "'featureClass' property nullified");
|
||||
t.eq(layer.format, null, "'format' property nullified");
|
||||
t.eq(layer.formatObject, null, "'formatObject' property nullified");
|
||||
t.eq(layer.formatOptions, null, "'formatOptions' property nullified");
|
||||
t.eq(layer.encodeBBOX, null, "'encodeBBOX' property nullified");
|
||||
t.eq(layer.extractAttributes, null, "'extractAttributes' property nullified");
|
||||
|
||||
layer.vectorMode = false;
|
||||
|
||||
//this call will *not* set off two tests (tile and format object are null)
|
||||
g_VectorDestroyed = null;
|
||||
g_MarkersDestroyed = null;
|
||||
OpenLayers.Layer.WFS.prototype.destroy.apply(layer, []);
|
||||
t.ok(!g_VectorDestroyed && g_MarkersDestroyed, "when vector mode is set to false, the default markers layer's destroy() method is called");
|
||||
|
||||
OpenLayers.Layer.Vector.prototype.destroy = tVectorDestroy;
|
||||
OpenLayers.Layer.Markers.prototype.destroy = tMarkersDestroy;
|
||||
}
|
||||
|
||||
function test_Layer_WFS_mapresizevector(t) {
|
||||
t.plan(2);
|
||||
|
||||
var map = new OpenLayers.Map("map");
|
||||
map.addLayer(new OpenLayers.Layer.WMS("WMS", "url", {}));
|
||||
var layer = new OpenLayers.Layer.WFS(name, "url", {});
|
||||
t.ok(layer.renderer.CLASS_NAME, "layer has a renderer");
|
||||
map.addLayer(layer);
|
||||
setSize = false;
|
||||
layer.renderer.setSize = function() { setSize = true; }
|
||||
layer.onMapResize();
|
||||
t.eq(setSize, true, "Renderer resize called on map size change.");
|
||||
map.destroy();
|
||||
|
||||
}
|
||||
function test_Layer_WFS_drawmap(t) {
|
||||
t.plan(2);
|
||||
var map = new OpenLayers.Map('map');
|
||||
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
||||
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
|
||||
map.addLayer(layer);
|
||||
|
||||
layer = new OpenLayers.Layer.WFS( "Owl Survey",
|
||||
"http://www.bsc-eoc.org/cgi-bin/bsc_ows.asp?",
|
||||
{typename: "OWLS", maxfeatures: 10},
|
||||
{ featureClass: OpenLayers.Feature.WFS});
|
||||
map.addLayer(layer);
|
||||
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||
try {
|
||||
map.setCenter(new OpenLayers.LonLat(-100, 60), 3);
|
||||
} catch (Exception) {
|
||||
}
|
||||
t.eq(layer.tile.url, "http://www.bsc-eoc.org/cgi-bin/bsc_ows.asp?typename=OWLS&maxfeatures=10&SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&SRS=EPSG%3A4326&BBOX=-187.890625,-36.6796875,-12.109375,156.6796875", "Tile URL is set correctly when not encoded");
|
||||
map.destroy();
|
||||
var map = new OpenLayers.Map('map');
|
||||
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
|
||||
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'}
|
||||
);
|
||||
map.addLayer(layer);
|
||||
|
||||
layer = new OpenLayers.Layer.WFS( "Owl Survey",
|
||||
"http://www.bsc-eoc.org/cgi-bin/bsc_ows.asp?",
|
||||
{typename: "OWLS", maxfeatures: 10},
|
||||
{ featureClass: OpenLayers.Feature.WFS, 'encodeBBOX': true});
|
||||
map.addLayer(layer);
|
||||
map.addControl(new OpenLayers.Control.LayerSwitcher());
|
||||
try {
|
||||
map.setCenter(new OpenLayers.LonLat(-100, 60), 3);
|
||||
} catch (Exception) {
|
||||
}
|
||||
t.eq(layer.tile.url, "http://www.bsc-eoc.org/cgi-bin/bsc_ows.asp?typename=OWLS&maxfeatures=10&SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&SRS=EPSG%3A4326&BBOX=-187.890625%2C-36.679687%2C-12.109375%2C156.679688", "Tile URL is set correctly when not encoded");
|
||||
map.destroy();
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="map" style="width:500px;height:550px"></div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user