From 697ee375b8ecc948cbdec8cd1b5f26602fe2bfba Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 16 Dec 2010 19:31:10 +0000 Subject: [PATCH] Making it clearer what WKT read does with a geometry collection. git-svn-id: http://svn.openlayers.org/trunk/openlayers@10972 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- tests/Format/WKT.html | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/Format/WKT.html b/tests/Format/WKT.html index 9a24bd71e8..1dce0d897c 100644 --- a/tests/Format/WKT.html +++ b/tests/Format/WKT.html @@ -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"); }