Make WMSGetFeature control respect layer projection if it equals the map projection. r=bartvde (closes #2918)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@10948 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2010-12-04 13:51:11 +00:00
parent 492a6d930b
commit b125e045d1
2 changed files with 44 additions and 5 deletions

View File

@@ -451,6 +451,37 @@
t.eq(count, 2, "We expect 2 requests to go off");
map.destroy();
}
function test_GetFeatureInfo_buildWMSOptions(t) {
t.plan(3);
var map = new OpenLayers.Map("map", {
getExtent: function() {return(new OpenLayers.Bounds(-180,-90,180,90));},
projection: "EPSG:900913"
});
var a = new OpenLayers.Layer.WMS("dummy", "http://localhost/wms", {
layers: "a"
}, {projection: "EPSG:3857"});
var b = new OpenLayers.Layer.WMS("dummy", "http://localhost/wms", {
layers: "b"
});
var c = new OpenLayers.Layer.WMS("dummy", "http://localhost/wms", {
layers: "c"
}, {projection: "EPSG:4326"});
map.addLayers([a, b, c]);
var gfi = new OpenLayers.Control.WMSGetFeatureInfo();
map.addControl(gfi);
gfi.activate();
var options = gfi.buildWMSOptions("http://localhost/wms", [a], {xy: {x: 50, y: 50}}, "text/html");
t.eq(options.params.SRS, "EPSG:3857", "layer projection used if provided and equal map projection");
options = gfi.buildWMSOptions("http://localhost/wms", [b], {xy: {x: 50, y: 50}}, "text/html");
t.eq(options.params.SRS, "EPSG:900913", "map projection used if layer has no projection configured");
options = gfi.buildWMSOptions("http://localhost/wms", [b], {xy: {x: 50, y: 50}}, "text/html");
t.eq(options.params.SRS, "EPSG:900913", "map projection used if layer configured with an incompatible projection");
}
function test_GetFeatureInfo_WMS13(t) {
t.plan(4);