[OpenLayers-Commits] r10972 - trunk/openlayers/tests/Format

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Thu Dec 16 14:31:10 EST 2010


Author: tschaub
Date: 2010-12-16 11:31:10 -0800 (Thu, 16 Dec 2010)
New Revision: 10972

Modified:
   trunk/openlayers/tests/Format/WKT.html
Log:
Making it clearer what WKT read does with a geometry collection.

Modified: trunk/openlayers/tests/Format/WKT.html
===================================================================
--- trunk/openlayers/tests/Format/WKT.html	2010-12-16 19:14:44 UTC (rev 10971)
+++ trunk/openlayers/tests/Format/WKT.html	2010-12-16 19:31:10 UTC (rev 10972)
@@ -188,7 +188,7 @@
     }
 
     function test_Format_WKT_read(t) { 
-        t.plan(6); 
+        t.plan(12); 
 
         var format = new OpenLayers.Format.WKT(); 
          
@@ -220,7 +220,16 @@
         // test a multipolygon 
         t.ok(multipolygon.geometry.equals(format.read(format.write(multipolygon)).geometry), 
              "format correctly reads MultiPolygon WKT"); 
-         
+             
+        // test a collection
+        var wkt = format.write(collection);
+        var got = format.read(wkt);
+        t.ok(got instanceof Array, "by default, reading a collection returns an array");
+        t.eq(got.length, 2, "read two items");
+        t.ok(got[0] instanceof OpenLayers.Feature.Vector, "first item is a feature");
+        t.geom_eq(got[0].geometry, points[0].geometry, "first feature's geometry is the correct point");
+        t.ok(got[1] instanceof OpenLayers.Feature.Vector, "second item is a feature");
+        t.geom_eq(got[1].geometry, linestrings[0].geometry, "second feature's geometry is the correct linestring");
  
     }
 



More information about the Commits mailing list