[Commits] r1335 - in sandbox/camptocamp/geobretagne: lib/GeoExt/data tests/lib/GeoExt/data

commits at geoext.org commits at geoext.org
Mon Aug 24 13:13:46 CEST 2009


Author: elemoine
Date: 2009-08-24 13:13:46 +0200 (Mon, 24 Aug 2009)
New Revision: 1335

Modified:
   sandbox/camptocamp/geobretagne/lib/GeoExt/data/WMSCapabilitiesReader.js
   sandbox/camptocamp/geobretagne/tests/lib/GeoExt/data/LayerReader.html
   sandbox/camptocamp/geobretagne/tests/lib/GeoExt/data/WMSCapabilitiesReader.html
Log:
apply patch_150-r1334-A2.diff from #150


Modified: sandbox/camptocamp/geobretagne/lib/GeoExt/data/WMSCapabilitiesReader.js
===================================================================
--- sandbox/camptocamp/geobretagne/lib/GeoExt/data/WMSCapabilitiesReader.js	2009-08-24 11:02:13 UTC (rev 1334)
+++ sandbox/camptocamp/geobretagne/lib/GeoExt/data/WMSCapabilitiesReader.js	2009-08-24 11:13:46 UTC (rev 1335)
@@ -160,28 +160,29 @@
         for(var i=0, len=capability.layers.length; i<len; i++){
             layer = capability.layers[i];
             if(layer.name) {
+                var l = new OpenLayers.Layer.WMS(
+                    layer.title || layer.name,
+                    url, {
+                        layers: layer.name, 
+                        exceptions: this.serviceExceptionFormat(
+                            capability.exception.formats
+                        ),
+                        format: this.imageFormat(layer),
+                        transparent: this.imageTransparent(layer),
+                        version: data.version
+                    }, {
+                        minScale: layer.minScale != undefined ? 
+                            layer.minScale : undefined,
+                        maxScale: layer.maxScale != undefined ? 
+                            layer.maxScale : undefined,
+                        attribution: layer.attribution ?
+                            this.attributionMarkup(layer.attribution) :
+                            undefined
+                    }
+                );
                 records.push(new this.recordType(Ext.apply(layer, {
-                    layer: new OpenLayers.Layer.WMS(
-                        layer.title || layer.name,
-                        url, {
-                            layers: layer.name, 
-                            exceptions: this.serviceExceptionFormat(
-                                capability.exception.formats
-                            ),
-                            format: this.imageFormat(layer),
-                            transparent: this.imageTransparent(layer),
-                            version: data.version
-                        }, {
-                            minScale: layer.minScale != undefined ? 
-                                layer.minScale : undefined,
-                            maxScale: layer.maxScale != undefined ? 
-                                layer.maxScale : undefined,
-                            attribution: layer.attribution ?
-                                this.attributionMarkup(layer.attribution) :
-                                undefined
-                        }
-                    )
-                })));
+                    layer: l
+                }), l.id));
             }
         }
         

Modified: sandbox/camptocamp/geobretagne/tests/lib/GeoExt/data/LayerReader.html
===================================================================
--- sandbox/camptocamp/geobretagne/tests/lib/GeoExt/data/LayerReader.html	2009-08-24 11:02:13 UTC (rev 1334)
+++ sandbox/camptocamp/geobretagne/tests/lib/GeoExt/data/LayerReader.html	2009-08-24 11:13:46 UTC (rev 1335)
@@ -33,7 +33,7 @@
     }
 
     function test_readRecords(t) {
-        t.plan(5);
+        t.plan(6);
 
         var reader, layers, data;
 
@@ -50,6 +50,8 @@
              "readRecords returns expected number of records");
         t.ok(data.records[0] instanceof GeoExt.data.LayerRecord,
              "readRecords returns records of expected type");
+        t.ok(data.records[0].id == layers[0].id,
+             "readRecords returns records with expected \"id\"");
         t.ok(data.records[0].get("layer") == layers[0],
              "readRecords returns records with expected \"layer\" field");
         t.eq(data.records[0].get("title"), layers[0].name,

Modified: sandbox/camptocamp/geobretagne/tests/lib/GeoExt/data/WMSCapabilitiesReader.html
===================================================================
--- sandbox/camptocamp/geobretagne/tests/lib/GeoExt/data/WMSCapabilitiesReader.html	2009-08-24 11:02:13 UTC (rev 1334)
+++ sandbox/camptocamp/geobretagne/tests/lib/GeoExt/data/WMSCapabilitiesReader.html	2009-08-24 11:13:46 UTC (rev 1335)
@@ -33,7 +33,7 @@
                  'field values set from configuration are correct');
         }
         function test_read(t) {
-            t.plan(34);
+            t.plan(35);
 
             var reader = new GeoExt.data.WMSCapabilitiesReader();
 
@@ -44,6 +44,10 @@
             
             var record, layer;
 
+            //1 test -- testing value of record id
+            record = records.records[2];
+            t.ok(record.id == record.get("layer").id, "[2] correct record id");
+
             //22 tests -- testing the fields of a record
             record = records.records[2];
             t.eq(record.get("name"), "tiger:tiger_roads", "[2] correct layer name");



More information about the Commits mailing list