From 64f111a30842874f3fd372475d01aa9ebac1d922 Mon Sep 17 00:00:00 2001 From: Bart van den Eijnden Date: Mon, 10 Oct 2011 08:24:24 +0200 Subject: [PATCH] add infoFormats to WMSCapabilities Format, r=ahocevar (closes #3539) --- lib/OpenLayers/Format/WMSCapabilities/v1.js | 3 +++ tests/Format/WMSCapabilities/v1_1_1.html | 3 ++- tests/Format/WMSCapabilities/v1_3_0.html | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/OpenLayers/Format/WMSCapabilities/v1.js b/lib/OpenLayers/Format/WMSCapabilities/v1.js index 7283760ec1..dd3c498b6c 100644 --- a/lib/OpenLayers/Format/WMSCapabilities/v1.js +++ b/lib/OpenLayers/Format/WMSCapabilities/v1.js @@ -112,6 +112,9 @@ OpenLayers.Format.WMSCapabilities.v1 = OpenLayers.Class( if (layer.formats === undefined) { layer.formats = capability.request.getmap.formats; } + if (layer.infoFormats === undefined && capability.request.getfeatureinfo) { + layer.infoFormats = capability.request.getfeatureinfo.formats; + } var i, len; diff --git a/tests/Format/WMSCapabilities/v1_1_1.html b/tests/Format/WMSCapabilities/v1_1_1.html index cc0c784469..8309bd75ad 100644 --- a/tests/Format/WMSCapabilities/v1_1_1.html +++ b/tests/Format/WMSCapabilities/v1_1_1.html @@ -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"); diff --git a/tests/Format/WMSCapabilities/v1_3_0.html b/tests/Format/WMSCapabilities/v1_3_0.html index 9d7eecdac5..7120b8c1a4 100644 --- a/tests/Format/WMSCapabilities/v1_3_0.html +++ b/tests/Format/WMSCapabilities/v1_3_0.html @@ -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],