[OpenLayers-Commits] r2343 - in sandbox/vector-2.4/tests: . Geometry
commits at openlayers.org
commits at openlayers.org
Mon Mar 5 15:33:51 EST 2007
Author: sderle
Date: 2007-03-05 15:33:50 -0500 (Mon, 05 Mar 2007)
New Revision: 2343
Added:
sandbox/vector-2.4/tests/Geometry/
sandbox/vector-2.4/tests/Geometry/test_LineString.html
sandbox/vector-2.4/tests/Geometry/test_MultiPoint.html
sandbox/vector-2.4/tests/Geometry/test_MultiPolygon.html
sandbox/vector-2.4/tests/Geometry/test_Point.html
sandbox/vector-2.4/tests/Geometry/test_Polygon.html
Modified:
sandbox/vector-2.4/tests/list-tests.html
Log:
Copy over Geometry.* tests and integrate with new test setup.
Added: sandbox/vector-2.4/tests/Geometry/test_LineString.html
===================================================================
--- sandbox/vector-2.4/tests/Geometry/test_LineString.html (rev 0)
+++ sandbox/vector-2.4/tests/Geometry/test_LineString.html 2007-03-05 20:33:50 UTC (rev 2343)
@@ -0,0 +1,31 @@
+<html>
+<head>
+ <script src="../../lib/OpenLayers.js"></script>
+ <script type="text/javascript"><!--
+ var line;
+ var path = [new OpenLayers.Geometry.Point(10,10), new OpenLayers.Geometry.Point(0,0)];
+
+ function test_01_LineString_constructor (t) {
+ t.plan( 3 );
+ line = new OpenLayers.Geometry.LineString();
+ t.ok( line instanceof OpenLayers.Geometry.LineString, "new OpenLayers.Geometry.LineString returns line object" );
+ t.eq( line.CLASS_NAME, "OpenLayers.Geometry.LineString", "line.CLASS_NAME is set correctly");
+ t.eq( line.path, [], "line.path is set correctly");
+ }
+
+ function test_01a_LineString_constructor (t) {
+ t.plan( 3 );
+ line = new OpenLayers.Geometry.LineString(path);
+ t.ok( line instanceof OpenLayers.Geometry.LineString, "new OpenLayers.Geometry.LineString returns line object" );
+ t.eq( line.CLASS_NAME, "OpenLayers.Geometry.LineString", "line.CLASS_NAME is set correctly");
+ // TBD FIXME, recursion
+ // t.eq( line.path, path, "line.path is set correctly");
+ t.eq( line.path.length, 2, "line.path.length is set correctly");
+ }
+
+ // -->
+ </script>
+</head>
+<body>
+</body>
+</html>
Added: sandbox/vector-2.4/tests/Geometry/test_MultiPoint.html
===================================================================
--- sandbox/vector-2.4/tests/Geometry/test_MultiPoint.html (rev 0)
+++ sandbox/vector-2.4/tests/Geometry/test_MultiPoint.html 2007-03-05 20:33:50 UTC (rev 2343)
@@ -0,0 +1,28 @@
+<html>
+<head>
+ <script src="../../lib/OpenLayers.js"></script>
+ <script type="text/javascript"><!--
+ var point = new OpenLayers.Geometry.Point(10, 10);
+
+
+ function test_01_MultiPoint_constructor (t) {
+ t.plan( 2 );
+ multipoint = new OpenLayers.Geometry.MultiPoint();
+ t.ok( multipoint instanceof OpenLayers.Geometry.MultiPoint, "new OpenLayers.Geometry.MultiPoint returns multipoint object" );
+ t.eq( multipoint.CLASS_NAME, "OpenLayers.Geometry.MultiPoint", "multipoint.CLASS_NAME is set correctly");
+ }
+
+ function test_01a_MultiPoint_constructor (t) {
+ t.plan( 3 );
+ multipoint = new OpenLayers.Geometry.MultiPoint([point]);
+ t.ok( multipoint instanceof OpenLayers.Geometry.MultiPoint, "new OpenLayers.Geometry.MultiPoint returns multipoint object" );
+ t.eq( multipoint.CLASS_NAME, "OpenLayers.Geometry.MultiPoint", "multipoint.CLASS_NAME is set correctly");
+ t.eq( multipoint.components.length, 1, "multipolygon.components.length is set correctly");
+ }
+
+ // -->
+ </script>
+</head>
+<body>
+</body>
+</html>
Added: sandbox/vector-2.4/tests/Geometry/test_MultiPolygon.html
===================================================================
--- sandbox/vector-2.4/tests/Geometry/test_MultiPolygon.html (rev 0)
+++ sandbox/vector-2.4/tests/Geometry/test_MultiPolygon.html 2007-03-05 20:33:50 UTC (rev 2343)
@@ -0,0 +1,34 @@
+<html>
+<head>
+ <script src="../../lib/OpenLayers.js"></script>
+ <script type="text/javascript"><!--
+ var polygon;
+ var path = [new OpenLayers.Geometry.Point(10,10), new OpenLayers.Geometry.Point(0,0)];
+ var path2 = [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(path);
+ var linearRing2 = new OpenLayers.Geometry.LinearRing(path2);
+
+ var polygon = new OpenLayers.Geometry.Polygon([linearRing]);
+ var polygon2 = new OpenLayers.Geometry.Polygon([linearRing2]);
+
+ function test_01_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_01a_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>
Added: sandbox/vector-2.4/tests/Geometry/test_Point.html
===================================================================
--- sandbox/vector-2.4/tests/Geometry/test_Point.html (rev 0)
+++ sandbox/vector-2.4/tests/Geometry/test_Point.html 2007-03-05 20:33:50 UTC (rev 2343)
@@ -0,0 +1,28 @@
+<html>
+<head>
+ <script src="../../lib/OpenLayers.js"></script>
+ <script type="text/javascript"><!--
+ var point;
+
+ function test_01_Point_constructor (t) {
+ t.plan( 2 );
+ point = new OpenLayers.Geometry.Point();
+ t.ok( point instanceof OpenLayers.Geometry.Point, "new OpenLayers.Geometry.Point returns point object" );
+ t.eq( point.CLASS_NAME, "OpenLayers.Geometry.Point", "point.CLASS_NAME is set correctly");
+ }
+
+ function test_01a_Point_constructor (t) {
+ t.plan( 4 );
+ point = new OpenLayers.Geometry.Point(10, 20);
+ t.ok( point instanceof OpenLayers.Geometry.Point, "new OpenLayers.Geometry.Point returns point object" );
+ t.eq( point.CLASS_NAME, "OpenLayers.Geometry.Point", "point.CLASS_NAME is set correctly");
+ t.eq( point.lon, 10, "point.lon is set correctly");
+ t.eq( point.lat, 20, "point.lat is set correctly");
+ }
+
+ // -->
+ </script>
+</head>
+<body>
+</body>
+</html>
Added: sandbox/vector-2.4/tests/Geometry/test_Polygon.html
===================================================================
--- sandbox/vector-2.4/tests/Geometry/test_Polygon.html (rev 0)
+++ sandbox/vector-2.4/tests/Geometry/test_Polygon.html 2007-03-05 20:33:50 UTC (rev 2343)
@@ -0,0 +1,40 @@
+<html>
+<head>
+ <script src="../../lib/OpenLayers.js"></script>
+ <script type="text/javascript"><!--
+ var polygon;
+ var path = [new OpenLayers.Geometry.Point(10,10), new OpenLayers.Geometry.Point(0,0)];
+ var path2 = [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(path);
+ var linearRing2 = new OpenLayers.Geometry.LinearRing(path2);
+
+ function test_01_Polygon_constructor (t) {
+ t.plan( 3 );
+ polygon = new OpenLayers.Geometry.Polygon();
+ t.ok( polygon instanceof OpenLayers.Geometry.Polygon, "new OpenLayers.Geometry.Polygon returns polygon object" );
+ t.eq( polygon.CLASS_NAME, "OpenLayers.Geometry.Polygon", "polygon.CLASS_NAME is set correctly");
+ t.eq( polygon.components, undefined, "polygon.components is set correctly");
+ }
+
+ function test_01a_Polygon_constructor (t) {
+ t.plan( 3 );
+ polygon = new OpenLayers.Geometry.Polygon([linearRing]);
+ t.ok( polygon instanceof OpenLayers.Geometry.Polygon, "new OpenLayers.Geometry.Polygon returns polygon object" );
+ t.eq( polygon.CLASS_NAME, "OpenLayers.Geometry.Polygon", "polygon.CLASS_NAME is set correctly");
+ t.eq( polygon.components.length, 1, "polygon.components.length is set correctly");
+ }
+
+ function test_01b_Polygon_constructor (t) {
+ t.plan( 3 );
+ polygon = new OpenLayers.Geometry.Polygon([linearRing, linearRing2]);
+ t.ok( polygon instanceof OpenLayers.Geometry.Polygon, "new OpenLayers.Geometry.Polygon returns polygon object" );
+ t.eq( polygon.CLASS_NAME, "OpenLayers.Geometry.Polygon", "polygon.CLASS_NAME is set correctly");
+ t.eq( polygon.components.length, 2, "polygon.components.length is set correctly");
+ }
+
+ // -->
+ </script>
+</head>
+<body>
+</body>
+</html>
Modified: sandbox/vector-2.4/tests/list-tests.html
===================================================================
--- sandbox/vector-2.4/tests/list-tests.html 2007-03-05 20:23:11 UTC (rev 2342)
+++ sandbox/vector-2.4/tests/list-tests.html 2007-03-05 20:33:50 UTC (rev 2343)
@@ -4,6 +4,11 @@
<li>BaseTypes/test_Size.html</li>
<li>BaseTypes/test_LonLat.html</li>
<li>BaseTypes/test_Bounds.html</li>
+ <li>Geometry/test_MultiPoint.html</li>
+ <li>Geometry/test_MultiPolygon.html</li>
+ <li>Geometry/test_Point.html</li>
+ <li>Geometry/test_Polygon.html</li>
+ <li>Geometry/test_LineString.html</li>
<li>test_Icon.html</li>
<li>test_Marker.html</li>
<li>test_Popup.html</li>
More information about the Commits
mailing list