[Commits] r1397 - in core/trunk/geoext: lib/GeoExt/data tests/lib/GeoExt/data
commits at geoext.org
commits at geoext.org
Thu Oct 8 21:53:18 CEST 2009
Author: bbinet
Date: 2009-10-08 21:53:18 +0200 (Thu, 08 Oct 2009)
New Revision: 1397
Modified:
core/trunk/geoext/lib/GeoExt/data/WMSCapabilitiesReader.js
core/trunk/geoext/tests/lib/GeoExt/data/LayerReader.html
core/trunk/geoext/tests/lib/GeoExt/data/WMSCapabilitiesReader.html
Log:
LayerRecord should have consistent id when generated by LayerReader or WMSCapabilitiesReader. r=elemoine (closes #150)
Modified: core/trunk/geoext/lib/GeoExt/data/WMSCapabilitiesReader.js
===================================================================
--- core/trunk/geoext/lib/GeoExt/data/WMSCapabilitiesReader.js 2009-10-08 18:49:48 UTC (rev 1396)
+++ core/trunk/geoext/lib/GeoExt/data/WMSCapabilitiesReader.js 2009-10-08 19:53:18 UTC (rev 1397)
@@ -170,25 +170,26 @@
for(var i=0, len=capability.layers.length; i<len; i++){
layer = layers[i];
if(layer.name) {
+ var l = new OpenLayers.Layer.WMS(
+ layer.title || layer.name,
+ url,
+ {
+ layers: layer.name,
+ exceptions: exceptions,
+ format: this.imageFormat(layer),
+ transparent: this.imageTransparent(layer),
+ version: version
+ }, {
+ attribution: layer.attribution ?
+ this.attributionMarkup(layer.attribution) :
+ undefined,
+ minScale: layer.minScale,
+ maxScale: layer.maxScale
+ }
+ );
records.push(new this.recordType(Ext.apply(layer, {
- layer: new OpenLayers.Layer.WMS(
- layer.title || layer.name,
- url,
- {
- layers: layer.name,
- exceptions: exceptions,
- format: this.imageFormat(layer),
- transparent: this.imageTransparent(layer),
- version: version
- }, {
- attribution: layer.attribution ?
- this.attributionMarkup(layer.attribution) :
- undefined,
- minScale: layer.minScale,
- maxScale: layer.maxScale
- }
- )
- })));
+ layer: l
+ }), l.id));
}
}
Modified: core/trunk/geoext/tests/lib/GeoExt/data/LayerReader.html
===================================================================
--- core/trunk/geoext/tests/lib/GeoExt/data/LayerReader.html 2009-10-08 18:49:48 UTC (rev 1396)
+++ core/trunk/geoext/tests/lib/GeoExt/data/LayerReader.html 2009-10-08 19:53:18 UTC (rev 1397)
@@ -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: core/trunk/geoext/tests/lib/GeoExt/data/WMSCapabilitiesReader.html
===================================================================
--- core/trunk/geoext/tests/lib/GeoExt/data/WMSCapabilitiesReader.html 2009-10-08 18:49:48 UTC (rev 1396)
+++ core/trunk/geoext/tests/lib/GeoExt/data/WMSCapabilitiesReader.html 2009-10-08 19:53:18 UTC (rev 1397)
@@ -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