[OpenLayers-Commits] r12064 - in trunk/openlayers: lib/OpenLayers/Format/WMSCapabilities tests/Format/WMSCapabilities

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Tue Jun 7 16:44:08 EDT 2011


Author: ahocevar
Date: 2011-06-07 13:44:06 -0700 (Tue, 07 Jun 2011)
New Revision: 12064

Modified:
   trunk/openlayers/lib/OpenLayers/Format/WMSCapabilities/v1.js
   trunk/openlayers/tests/Format/WMSCapabilities/v1_1_1.html
Log:
fixing href regression introduced with r11978. r=bartvde (see #3351)

Modified: trunk/openlayers/lib/OpenLayers/Format/WMSCapabilities/v1.js
===================================================================
--- trunk/openlayers/lib/OpenLayers/Format/WMSCapabilities/v1.js	2011-06-07 20:23:58 UTC (rev 12063)
+++ trunk/openlayers/lib/OpenLayers/Format/WMSCapabilities/v1.js	2011-06-07 20:44:06 UTC (rev 12064)
@@ -305,15 +305,22 @@
             "Get": function(node, obj) {
                 obj.get = {};
                 this.readChildNodes(node, obj.get);
+                // backwards compatibility
+                if (!obj.href) {
+                    obj.href = obj.get.href;
+                }
             },
             "Post": function(node, obj) {
                 obj.post = {};
                 this.readChildNodes(node, obj.post);
+                // backwards compatibility
+                if (!obj.href) {
+                    obj.href = obj.get.href;
+                }
             },
             "GetMap": function(node, obj) {
                 obj.getmap = {formats: []};
                 this.readChildNodes(node, obj.getmap);
-                obj.getmap.href = obj.getmap.get.href || obj.getmap.post.href; // backwards compatibility
             },
             "GetFeatureInfo": function(node, obj) {
                 obj.getfeatureinfo = {formats: []};

Modified: trunk/openlayers/tests/Format/WMSCapabilities/v1_1_1.html
===================================================================
--- trunk/openlayers/tests/Format/WMSCapabilities/v1_1_1.html	2011-06-07 20:23:58 UTC (rev 12063)
+++ trunk/openlayers/tests/Format/WMSCapabilities/v1_1_1.html	2011-06-07 20:44:06 UTC (rev 12064)
@@ -5,7 +5,7 @@
     
     function test_read(t) {
         
-        t.plan(17);
+        t.plan(23);
 
         var xml = document.getElementById("gssample").firstChild.nodeValue;
         var doc = new OpenLayers.Format.XML().read(xml);
@@ -32,7 +32,41 @@
             undefined,
             "getmap.post not available"
         );
+
+        var describelayer = capability.request.describelayer;
+        t.eq(
+            describelayer.href,
+            "http://publicus.opengeo.org:80/geoserver/wms?SERVICE=WMS&",
+            "describelayer href parsed"
+        );
+        t.eq(
+            describelayer.get.href,
+            describelayer.href,
+            "describelayer.get.href parsed"
+        );
+        t.eq(
+            describelayer.post,
+            undefined,
+            "describelayer.post not available"
+        );
         
+        var getfeatureinfo = capability.request.getfeatureinfo;
+        t.eq(
+            getfeatureinfo.href,
+            "http://publicus.opengeo.org:80/geoserver/wms?SERVICE=WMS&",
+            "getfeatureinfo href parsed"
+        );
+        t.eq(
+            getfeatureinfo.get.href,
+            getfeatureinfo.href,
+            "getmap.get.href parsed"
+        );
+        t.eq(
+            getfeatureinfo.post.href,
+            "http://publicus.opengeo.org:80/geoserver/wms?SERVICE=WMS&",
+            "getfeatureinfo.post set correctly"
+        );
+        
         t.ok(capability.layers, "layers parsed");
         t.eq(capability.layers.length, 22, "correct number of layers parsed");
         



More information about the Commits mailing list