Merge branch 'master' of github.com:openlayers/openlayers into 3526

This commit is contained in:
tschaub
2011-10-11 09:42:49 -06:00
9 changed files with 43 additions and 19 deletions
+7 -7
View File
@@ -348,7 +348,7 @@
);
t.eq(
log.options && log.options.params.STYLES.join(","),
"a,b,c,d,a,b,c,d,,,,,,,,",
",,,,,,,,a,b,c,d,a,b,c,d",
"Styles merged correctly"
);
@@ -424,7 +424,7 @@
control.layerUrls = ["http://a.mirror/wms", "http://b.mirror/wms"];
control.getInfoForClick({xy: {x: 50, y: 50}});
t.eq(log.options && log.options.url, "http://host/wms", "some match, request issued");
t.eq(log.options && log.options.params["QUERY_LAYERS"].join(","), "a,b", "selected layers queried");
t.eq(log.options && log.options.params["QUERY_LAYERS"].join(","), "b,a", "selected layers queried");
// show that a layer can be matched if it has a urls array itself (first needs to be matched)
log = {};
@@ -508,13 +508,13 @@
var _request = OpenLayers.Request.GET;
OpenLayers.Request.GET = function(options) {
count++;
if (count == 1) {
if (count == 2) {
t.eq(options.params["INFO_FORMAT"], "application/vnd.ogc.gml", "Default info format of the control is used");
t.eq(options.params["QUERY_LAYERS"].join(","), "a,c", "Layers should be grouped by service url");
t.eq(options.url, "http://localhost/wms", "Correct url used for first request");
} else if (count == 2) {
t.eq(options.params["QUERY_LAYERS"].join(","), "c,a", "Layers should be grouped by service url");
t.eq(options.url, "http://localhost/wms", "Correct url used for second request");
} else if (count == 1) {
t.eq(options.params["INFO_FORMAT"], "text/xml", "Overridden info format is used instead of the control's infoFormat");
t.eq(options.url, "http://myhost/wms", "Correct url used for second request");
t.eq(options.url, "http://myhost/wms", "Correct url used for first request");
}
};
click.activate();
+2 -1
View File
@@ -14,7 +14,7 @@
function test_read(t) {
t.plan(23);
t.plan(24);
var xml = document.getElementById("gssample").firstChild.nodeValue;
var doc = new OpenLayers.Format.XML().read(xml);
@@ -80,6 +80,7 @@
t.eq(capability.layers.length, 22, "correct number of layers parsed");
var layer = capability.layers[2];
t.eq(layer.infoFormats, ["text/plain", "text/html", "application/vnd.ogc.gml"], "infoFormats set on layer");
t.eq(layer.name, "tiger:tiger_roads", "[2] correct layer name");
t.eq(layer.prefix, "tiger", "[2] correct layer prefix");
t.eq(layer.title, "Manhattan (NY) roads", "[2] correct layer title");
+2 -2
View File
@@ -14,7 +14,7 @@
function test_layers(t) {
t.plan(24);
t.plan(25);
var xml = document.getElementById("ogcsample").firstChild.nodeValue;
var doc = new OpenLayers.Format.XML().read(xml);
@@ -40,7 +40,7 @@
t.eq(layers["Temperature"].srs,
{"CRS:84": true},
"Inheritance of SRS handled correctly when redeclaring an inherited SRS");
t.eq(layers["Temperature"].infoFormats, ["text/xml", "text/plain", "text/html"], "infoFormats set correctly on layer");
var bbox = layers["ROADS_RIVERS"].bbox["EPSG:26986"];
t.eq(bbox.bbox,
[189000, 834000, 285000, 962000],
+1 -1
View File
@@ -66,7 +66,7 @@
t.eq(layer.map.layers.length, 1, "layer added to the map successfully");
layer.destroy();
t.eq(layer.map, null, "layer.map is null after destroy");
t.eq(layer.getFeatureFromEvent({'target':'map'}), null, "getFeatureIdFromEvent doesn't cause an error when called on layer which has been destroyed.");
t.ok(!layer.renderer, "layer.renderer is falsey after destroy");
}
+9 -3
View File
@@ -575,7 +575,7 @@
}
function test_Layer_Vector_destroy (t) {
t.plan(5);
t.plan(6);
var options = {protocol: new OpenLayers.Protocol(),
strategies: [new OpenLayers.Strategy(), new OpenLayers.Strategy()]}
@@ -584,8 +584,14 @@
map.addLayer(layer);
layer.destroy();
t.eq(layer.map, null, "layer.map is null after destroy");
t.eq(layer.getFeatureFromEvent({'target':'map'}), null,
"getFeatureIdFromEvent doesn't cause an error when called on layer which has been destroyed.");
t.ok(!layer.renderer, "layer.renderer is falsey");
var err;
try {
layer.getFeatureFromEvent({target: "map"});
} catch (ex) {
err = ex;
}
t.ok(err, "Error thrown when calling getFeatureFromEvent on destroyed layer");
t.eq(layer.protocol, null, "layer.protocol is null after destroy");
t.eq(layer.strategies, null, "layer.strategies is null after destroy");