fix up sequence of elements in Web Map Context 1.1 Format when writing, thanks trondmm for the catch and initial patch, r=tschaub (closes #2174)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@9614 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
bartvde
2009-08-07 15:59:43 +00:00
parent 01d4330c81
commit 5964a8db60
4 changed files with 58 additions and 26 deletions
+22 -15
View File
@@ -1,20 +1,20 @@
<html>
<head>
<script src="../../../lib/OpenLayers.js"></script>
<html>
<head>
<script src="../../../lib/OpenLayers.js"></script>
<script type="text/javascript">
function test_write_wmc_Layer(t) {
if (OpenLayers.Util.getBrowserName() == "safari") {
t.plan(0);
t.debug_print("Safari has wierd behavior with getElementsByTagNameNS: the result is that we can't run these tests there. Patches welcome.");
return;
}
t.plan(10);
t.plan(12);
// direct construction of a parser for a unit test
var wmc = new OpenLayers.Format.WMC.v1_1_0();
var sldNS = wmc.namespaces["sld"];
// test that Min/MaxScaleDenominator is not written out when no
// resolution related options are set
var layer = new OpenLayers.Layer.WMS(
@@ -45,7 +45,7 @@
t.eq(maxList.length, 1, "(resolutions) node written with MaxScaleDenominator");
t.eq(layer.minScale.toPrecision(10), wmc.getChildValue(maxList[0]),
"(resolutions) node written with correct MaxScaleDenominator value");
layer = new OpenLayers.Layer.WMS(
"test", "http://foo", {},
{scales: [4, 2, 1], maxExtent: new OpenLayers.Bounds(1, 2, 3, 4)}
@@ -62,13 +62,20 @@
t.eq(maxList.length, 1, "(scales) node written with MaxScaleDenominator");
t.eq(layer.minScale.toPrecision(10), wmc.getChildValue(maxList[0]),
"(scales) node written with correct MaxScaleDenominator value");
}
</script>
</head>
layer.metadataURL = 'http://foo';
node = wmc.write_wmc_Layer(layer);
t.eq(node.childNodes[3].localName || node.childNodes[3].nodeName.split(":").pop(),
'MetadataURL', "MinScaleDenominator is written after MetadataURL, so third node should be MetadataURL");
t.eq(node.childNodes[4].localName || node.childNodes[4].nodeName.split(":").pop(),
'MinScaleDenominator', "MinScaleDenominator is written after MetadataURL, so fourth node should be MinScaleDenominator");
}
</script>
</head>
<body>
<div id="map" style="width: 512px; height: 256px;"></div>
</body>
</html>
</body>
</html>