[OpenLayers-Commits] r11984 - in trunk/openlayers:
lib/OpenLayers/Layer tests/Layer
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Fri May 20 07:24:23 EDT 2011
Author: ahocevar
Date: 2011-05-20 04:24:19 -0700 (Fri, 20 May 2011)
New Revision: 11984
Modified:
trunk/openlayers/lib/OpenLayers/Layer/WMS.js
trunk/openlayers/tests/Layer/WMS.html
Log:
making TRANSPARENT param values all UPPERCASE to conform to the WMS spec. r=bartvde (closes #3304)
Modified: trunk/openlayers/lib/OpenLayers/Layer/WMS.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Layer/WMS.js 2011-05-20 10:58:55 UTC (rev 11983)
+++ trunk/openlayers/lib/OpenLayers/Layer/WMS.js 2011-05-20 11:24:19 UTC (rev 11984)
@@ -245,6 +245,10 @@
} else {
this.params.SRS = value;
}
+
+ if (typeof this.params.TRANSPARENT == "boolean") {
+ newParams.TRANSPARENT = this.params.TRANSPARENT ? "TRUE" : "FALSE";
+ }
return OpenLayers.Layer.Grid.prototype.getFullRequestString.apply(
this, arguments);
Modified: trunk/openlayers/tests/Layer/WMS.html
===================================================================
--- trunk/openlayers/tests/Layer/WMS.html 2011-05-20 10:58:55 UTC (rev 11983)
+++ trunk/openlayers/tests/Layer/WMS.html 2011-05-20 11:24:19 UTC (rev 11984)
@@ -80,13 +80,11 @@
var tParams = OpenLayers.Util.extend({},
OpenLayers.Util.upperCaseObject(params));
tParams = OpenLayers.Util.extend(tParams, {
- SERVICE: "WMS", VERSION: "1.1.1",
- REQUEST: "GetMap", STYLES: "",
- SRS: "EPSG:4326", BBOX: [1,2,3,4],
+ BBOX: [1,2,3,4],
WIDTH: "256", HEIGHT: "256"
});
t.eq( img.src,
- url + "?" + OpenLayers.Util.getParameterString(tParams),
+ layer.getFullRequestString(tParams),
"image src is created correctly via addtile" );
t.eq( tile.frame.style.top, "6px", "image top is set correctly via addtile" );
t.eq( tile.frame.style.left, "5px", "image top is set correctly via addtile" );
@@ -97,7 +95,7 @@
else
t.ok( firstChild instanceof HTMLElement, "div first child is an image object" );
t.eq( firstChild.src,
- url + "?" + OpenLayers.Util.getParameterString(tParams),
+ layer.getFullRequestString(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();
@@ -118,13 +116,11 @@
var tParams = OpenLayers.Util.extend({},
OpenLayers.Util.upperCaseObject(params));
tParams = OpenLayers.Util.extend(tParams, {
- SERVICE: "WMS", VERSION: "1.1.1",
- REQUEST: "GetMap", STYLES: "",
- SRS: "EPSG:4326", BBOX: "1,2,3,4",
+ BBOX: "1,2,3,4",
WIDTH: "256", HEIGHT: "256"
});
t.eq( img.src,
- url + "?" + OpenLayers.Util.getParameterString(tParams),
+ layer.getFullRequestString(tParams),
"image src is created correctly via addtile" );
t.eq( tile.frame.style.top, "6px", "image top is set correctly via addtile" );
t.eq( tile.frame.style.left, "5px", "image top is set correctly via addtile" );
@@ -135,7 +131,7 @@
else
t.ok( firstChild instanceof HTMLElement, "div first child is an image object" );
t.eq( firstChild.src,
- url + "?" + OpenLayers.Util.getParameterString(tParams),
+ layer.getFullRequestString(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();
@@ -544,8 +540,30 @@
map.destroy();
}
+
+ function test_transparent(t) {
+ t.plan(5);
+ var map = new OpenLayers.Map("map", {allOverlays: true});
+ var layer = new OpenLayers.Layer.WMS(
+ "OpenLayers WMS",
+ "http://myserver.org/wms?",
+ {layers: 'mylayer', transparent: true}
+ );
+ map.addLayer(layer);
+ t.eq(typeof layer.params.TRANSPARENT, "boolean", "transparent param is boolean");
+ t.ok(layer.getFullRequestString({}).indexOf("TRANSPARENT=TRUE") != -1, "Boolean transparent param value is uppercase TRUE");
+ layer.mergeNewParams({transparent: false});
+ t.ok(layer.getFullRequestString({}).indexOf("TRANSPARENT=FALSE") != -1, "Boolean transparent param value is uppercase FALSE");
+ layer.mergeNewParams({transparent: "true"});
+ t.eq(typeof layer.params.TRANSPARENT, "string", "transparent param is string");
+ t.ok(layer.getFullRequestString({}).indexOf("TRANSPARENT=true") != -1, "transparent param value passed as provided if String");
+
+ map.destroy();
+ }
+
+
</script>
</head>
<body>
More information about the Commits
mailing list