[geos-commits] r3044 - trunk/php/test

svn_geos at osgeo.org svn_geos at osgeo.org
Sun Jun 20 20:06:07 EDT 2010


Author: strk
Date: 2010-06-21 00:06:07 +0000 (Mon, 21 Jun 2010)
New Revision: 3044

Modified:
   trunk/php/test/test.php
Log:
Test numGeometries

Modified: trunk/php/test/test.php
===================================================================
--- trunk/php/test/test.php	2010-06-21 00:01:46 UTC (rev 3043)
+++ trunk/php/test/test.php	2010-06-21 00:06:07 UTC (rev 3044)
@@ -1302,4 +1302,43 @@
         $this->assertEquals(2, $g->getSRID());
     }
 
+    public function testGeometry_numGeometries()
+    {
+        $reader = new GEOSWKTReader();
+
+        $g = $reader->read('POINT(0 0)');
+        $this->assertEquals(1, $g->numGeometries());
+
+        $g = $reader->read('MULTIPOINT (0 1, 2 3)');
+        $this->assertEquals(2, $g->numGeometries());
+
+        $g = $reader->read('LINESTRING (0 0, 2 3)');
+        $this->assertEquals(1, $g->numGeometries());
+
+        $g = $reader->read('MULTILINESTRING ((0 1, 2 3), (10 10, 3 4))');
+        $this->assertEquals(2, $g->numGeometries());
+
+        $g = $reader->read('POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))');
+        $this->assertEquals(1, $g->numGeometries());
+
+        $g = $reader->read('MULTIPOLYGON (
+            ((0 0, 1 0, 1 1, 0 1, 0 0)),
+            ((10 10, 10 14, 14 14, 14 10, 10 10),
+                (11 11, 11 12, 12 12, 12 11, 11 11)))');
+        $this->assertEquals(2, $g->numGeometries());
+
+        $g = $reader->read('GEOMETRYCOLLECTION (
+            MULTIPOLYGON (
+                ((0 0, 1 0, 1 1, 0 1, 0 0)),
+                ((10 10, 10 14, 14 14, 14 10, 10 10),
+                    (11 11, 11 12, 12 12, 12 11, 11 11))
+            ),
+            POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)),
+            MULTILINESTRING ((0 0, 2 3), (10 10, 3 4)),
+            LINESTRING (0 0, 2 3),
+            MULTIPOINT (0 0, 2 3),
+            POINT (9 0))');
+        $this->assertEquals(6, $g->numGeometries());
+    }
+
 }



More information about the geos-commits mailing list