diff options
Diffstat (limited to 'misc/openlayers/tests/Geometry/MultiPolygon.html')
-rw-r--r-- | misc/openlayers/tests/Geometry/MultiPolygon.html | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/misc/openlayers/tests/Geometry/MultiPolygon.html b/misc/openlayers/tests/Geometry/MultiPolygon.html new file mode 100644 index 0000000..f44de93 --- /dev/null +++ b/misc/openlayers/tests/Geometry/MultiPolygon.html @@ -0,0 +1,34 @@ +<html> +<head> + <script src="../OLLoader.js"></script> + <script type="text/javascript"> + var polygon; + var components = [new OpenLayers.Geometry.Point(10,10), new OpenLayers.Geometry.Point(0,0)]; + var components2 = [new OpenLayers.Geometry.Point(10,10), new OpenLayers.Geometry.Point(0,0), new OpenLayers.Geometry.Point(10,0), new OpenLayers.Geometry.Point(10,10)]; + var linearRing = new OpenLayers.Geometry.LinearRing(components); + var linearRing2 = new OpenLayers.Geometry.LinearRing(components2); + + var polygon = new OpenLayers.Geometry.Polygon([linearRing]); + var polygon2 = new OpenLayers.Geometry.Polygon([linearRing2]); + + function test_MultiPolygon_constructor (t) { + t.plan( 2 ); + multipolygon = new OpenLayers.Geometry.MultiPolygon(); + t.ok( multipolygon instanceof OpenLayers.Geometry.MultiPolygon, "new OpenLayers.Geometry.MultiPolygon returns multipolygon object" ); + t.eq( multipolygon.CLASS_NAME, "OpenLayers.Geometry.MultiPolygon", "multipolygon.CLASS_NAME is set correctly"); + } + + function test_MultiPolygon_constructor (t) { + t.plan( 3 ); + multipolygon = new OpenLayers.Geometry.MultiPolygon([polygon, polygon2]); + t.ok( multipolygon instanceof OpenLayers.Geometry.MultiPolygon, "new OpenLayers.Geometry.MultiPolygon returns multipolygon object" ); + t.eq( multipolygon.CLASS_NAME, "OpenLayers.Geometry.MultiPolygon", "multipolygon.CLASS_NAME is set correctly"); + t.eq( multipolygon.components.length, 2, "multipolygon.components.length is set correctly"); + } + + + </script> +</head> +<body> +</body> +</html> |