[OpenLayers-Commits] r2007 - sandbox/vector/tests
commits at openlayers.org
commits at openlayers.org
Tue Dec 5 05:01:44 EST 2006
Author: pgiraud
Date: 2006-12-05 05:01:44 -0500 (Tue, 05 Dec 2006)
New Revision: 2007
Added:
sandbox/vector/tests/test_Geometry_LineString.html
sandbox/vector/tests/test_Geometry_MultiPoint.html
sandbox/vector/tests/test_Geometry_MultiPolygon.html
sandbox/vector/tests/test_Geometry_Point.html
sandbox/vector/tests/test_Geometry_Polygon.html
Removed:
sandbox/vector/tests/test_Feature_Geometry_Curve.html
sandbox/vector/tests/test_Feature_Geometry_LinearRing.html
sandbox/vector/tests/test_Feature_Geometry_Polygon.html
sandbox/vector/tests/test_Feature_Geometry_Surface.html
Modified:
sandbox/vector/tests/list-tests.html
Log:
new unit tests for geometries
need to be completed
Modified: sandbox/vector/tests/list-tests.html
===================================================================
--- sandbox/vector/tests/list-tests.html 2006-12-05 08:53:58 UTC (rev 2006)
+++ sandbox/vector/tests/list-tests.html 2006-12-05 10:01:44 UTC (rev 2007)
@@ -7,10 +7,11 @@
<li>test_Marker.html</li>
<li>test_Popup.html</li>
<li>test_Feature.html</li>
- <li>test_Feature_Geometry_Curve.html</li>
- <li>test_Feature_Geometry_LinearRing.html</li>
- <li>test_Feature_Geometry_Polygon.html</li>
- <li>test_Feature_Geometry_Surface.html</li>
+ <li>test_Geometry_Point.html</li>
+ <li>test_Geometry_LineString.html</li>
+ <li>test_Geometry_Polygon.html</li>
+ <li>test_Geometry_MultiPoint.html</li>
+ <li>test_Geometry_MultiPolygon.html</li>
<li>test_Bounds.html</li>
<li>test_Events.html</li>
<li>test_Util.html</li>
Deleted: sandbox/vector/tests/test_Feature_Geometry_Curve.html
===================================================================
--- sandbox/vector/tests/test_Feature_Geometry_Curve.html 2006-12-05 08:53:58 UTC (rev 2006)
+++ sandbox/vector/tests/test_Feature_Geometry_Curve.html 2006-12-05 10:01:44 UTC (rev 2007)
@@ -1,101 +0,0 @@
-<html>
-<head>
- <script src="../lib/OpenLayers.js"></script>
- <script type="text/javascript"><!--
-
- var curve;
- var points = [new OpenLayers.Feature.Geometry.Point(0, 0),
- new OpenLayers.Feature.Geometry.Point(100, 100),
- new OpenLayers.Feature.Geometry.Point(200, 0)];
-
- function test_01_Curve_constructor (t) {
- t.plan( 4 );
- curve = new OpenLayers.Feature.Geometry.Curve();
- t.ok( curve instanceof OpenLayers.Feature.Geometry.Curve, "new OpenLayers.Feature.Geometry.Curve returns curve object" );
- t.eq( curve.CLASS_NAME, "OpenLayers.Feature.Geometry.Curve", "curve.CLASS_NAME is set correctly");
- t.eq( curve.path, [], "curve.path is set correctly");
- t.eq( curve.extent, null, "curve.extent is set correctly");
- }
-
- function test_01a_Curve_constructor (t) {
- t.plan( 4 );
- curve = new OpenLayers.Feature.Geometry.Curve(points);
- t.ok( curve instanceof OpenLayers.Feature.Geometry.Curve, "new OpenLayers.Feature.Geometry.Curve returns curve object" );
- t.eq( curve.CLASS_NAME, "OpenLayers.Feature.Geometry.Curve", "curve.CLASS_NAME is set correctly");
-//FIXME t.eq( curve.path, , "curve.path is set correctly");
- t.ok( curve.extent instanceof OpenLayers.Bounds, "curve.extant type is set correctly");
- t.ok( curve.extent.equals(new OpenLayers.Bounds(0, 0, 200, 100)) , "curve.extant is set correctly");
- }
-
-/*
- function test_02_Curve_toString(t) {
- t.plan( 1 );
- curve = new OpenLayers.Curve(5,6);
- t.eq( curve.toString(), "lon=5,lat=6", "curve.toString() returns correctly");
- }
-
- function test_02A_Curve_toShortString(t) {
- t.plan( 1 );
- curve = new OpenLayers.Curve(5,6);
- t.eq( curve.toShortString(), "5, 6", "curve.toShortString() returns correctly");
- }
-
- function test_03_Curve_clone(t) {
- t.plan( 3 );
- oldCurve = new OpenLayers.Curve(5,6);
- curve = oldCurve.clone();
- t.ok( curve instanceof OpenLayers.Curve, "clone returns new OpenLayers.Curve object" );
- t.ok( curve.equals(oldCurve), "curve is set correctly");
-
- oldCurve.lon = 100;
- t.eq( curve.lon, 5, "changing oldCurve.lon doesn't change curve.lon");
- }
-
- function test_04_Curve_add(t) {
- t.plan( 2 );
-
- curveA = new OpenLayers.Curve(10,100);
-
- addpx = curveA.add(5, 50);
- var ll = new OpenLayers.Curve(10,100);
- t.ok( curveA.equals(ll), "curveA is not modified by add operation");
-
- var ll = new OpenLayers.Curve(15,150);
- t.ok( addpx.equals(ll), "addpx is set correctly");
- }
-
- function test_06_Curve_equals(t) {
- t.plan( 5 );
- curve = new OpenLayers.Curve(5,6);
-
- ll = new OpenLayers.Curve(5,6);
- t.eq( curve.equals(ll), true, "(5,6) equals (5,6)");
-
- ll = new OpenLayers.Curve(1,6);
- t.eq( curve.equals(ll), false, "(5,6) does not equal (1,6)");
-
- ll = new OpenLayers.Curve(5,2);
- t.eq( curve.equals(ll), false, "(5,6) does not equal (5,2)");
-
- ll = new OpenLayers.Curve(1,2);
- t.eq( curve.equals(ll), false, "(5,6) does not equal (1,2)");
-
- t.ok( !curve.equals(null), "equals() returns false on comparison to null");
-
- }
-
- function test_07_Curve_fromString(t) {
- t.plan( 2 );
- curve = OpenLayers.Curve.fromString("6,5");
- t.ok( curve instanceof OpenLayers.Curve, "new OpenLayers.Curve returns Curve object" );
-
- var ll = new OpenLayers.Curve(6, 5);
- t.ok( curve.equals(ll), "curve is set correctly");
- }
-*/
- // -->
- </script>
-</head>
-<body>
-</body>
-</html>
Deleted: sandbox/vector/tests/test_Feature_Geometry_LinearRing.html
===================================================================
--- sandbox/vector/tests/test_Feature_Geometry_LinearRing.html 2006-12-05 08:53:58 UTC (rev 2006)
+++ sandbox/vector/tests/test_Feature_Geometry_LinearRing.html 2006-12-05 10:01:44 UTC (rev 2007)
@@ -1,94 +0,0 @@
-<html>
-<head>
- <script src="../lib/OpenLayers.js"></script>
- <script type="text/javascript"><!--
-
- var linear_ring;
-
- function test_01_Linear_Ring_constructor (t) {
- t.plan( 2 );
- linear_ring = new OpenLayers.Feature.Geometry.LinearRing();
- t.ok( linear_ring instanceof OpenLayers.Feature.Geometry.LinearRing, "new OpenLayers.Feature.Geometry.LinearRing returns linear ring object" );
- t.eq( linear_ring.CLASS_NAME, "OpenLayers.Feature.Geometry.LinearRing", "Linear Ring CLASS_NAME is set correctly");
- }
-/*
- function test_01a_Linear_Ring_constructorFromStrings (t) {
- t.plan( 4 );
- linear_ring = new OpenLayers.Linear_Ring("6", "5");
- t.ok( linear_ring instanceof OpenLayers.Linear_Ring, "new OpenLayers.Linear_Ring returns Linear_Ring object" );
- t.eq( linear_ring.CLASS_NAME, "OpenLayers.Linear_Ring", "linear_ring.CLASS_NAME is set correctly");
- t.eq( linear_ring.lon, 6, "linear_ring.lon is set correctly");
- t.eq( linear_ring.lat, 5, "linear_ring.lat is set correctly");
- }
-
- function test_02_Linear_Ring_toString(t) {
- t.plan( 1 );
- linear_ring = new OpenLayers.Linear_Ring(5,6);
- t.eq( linear_ring.toString(), "lon=5,lat=6", "linear_ring.toString() returns correctly");
- }
-
- function test_02A_Linear_Ring_toShortString(t) {
- t.plan( 1 );
- linear_ring = new OpenLayers.Linear_Ring(5,6);
- t.eq( linear_ring.toShortString(), "5, 6", "linear_ring.toShortString() returns correctly");
- }
-
- function test_03_Linear_Ring_clone(t) {
- t.plan( 3 );
- oldLinear_Ring = new OpenLayers.Linear_Ring(5,6);
- linear_ring = oldLinear_Ring.clone();
- t.ok( linear_ring instanceof OpenLayers.Linear_Ring, "clone returns new OpenLayers.Linear_Ring object" );
- t.ok( linear_ring.equals(oldLinear_Ring), "linear_ring is set correctly");
-
- oldLinear_Ring.lon = 100;
- t.eq( linear_ring.lon, 5, "changing oldLinear_Ring.lon doesn't change linear_ring.lon");
- }
-
- function test_04_Linear_Ring_add(t) {
- t.plan( 2 );
-
- linear_ringA = new OpenLayers.Linear_Ring(10,100);
-
- addpx = linear_ringA.add(5, 50);
- var ll = new OpenLayers.Linear_Ring(10,100);
- t.ok( linear_ringA.equals(ll), "linear_ringA is not modified by add operation");
-
- var ll = new OpenLayers.Linear_Ring(15,150);
- t.ok( addpx.equals(ll), "addpx is set correctly");
- }
-
- function test_06_Linear_Ring_equals(t) {
- t.plan( 5 );
- linear_ring = new OpenLayers.Linear_Ring(5,6);
-
- ll = new OpenLayers.Linear_Ring(5,6);
- t.eq( linear_ring.equals(ll), true, "(5,6) equals (5,6)");
-
- ll = new OpenLayers.Linear_Ring(1,6);
- t.eq( linear_ring.equals(ll), false, "(5,6) does not equal (1,6)");
-
- ll = new OpenLayers.Linear_Ring(5,2);
- t.eq( linear_ring.equals(ll), false, "(5,6) does not equal (5,2)");
-
- ll = new OpenLayers.Linear_Ring(1,2);
- t.eq( linear_ring.equals(ll), false, "(5,6) does not equal (1,2)");
-
- t.ok( !linear_ring.equals(null), "equals() returns false on comparison to null");
-
- }
-
- function test_07_Linear_Ring_fromString(t) {
- t.plan( 2 );
- linear_ring = OpenLayers.Linear_Ring.fromString("6,5");
- t.ok( linear_ring instanceof OpenLayers.Linear_Ring, "new OpenLayers.Linear_Ring returns Linear_Ring object" );
-
- var ll = new OpenLayers.Linear_Ring(6, 5);
- t.ok( linear_ring.equals(ll), "linear_ring is set correctly");
- }
-*/
- // -->
- </script>
-</head>
-<body>
-</body>
-</html>
Deleted: sandbox/vector/tests/test_Feature_Geometry_Polygon.html
===================================================================
--- sandbox/vector/tests/test_Feature_Geometry_Polygon.html 2006-12-05 08:53:58 UTC (rev 2006)
+++ sandbox/vector/tests/test_Feature_Geometry_Polygon.html 2006-12-05 10:01:44 UTC (rev 2007)
@@ -1,29 +0,0 @@
-<html>
-<head>
- <script src="../lib/OpenLayers.js"></script>
- <script type="text/javascript"><!--
- var Polygon;
- var path = [new OpenLayers.Feature.Geometry.Point(10,10), new OpenLayers.Feature.Geometry.Point(0,0)]
-
- function test_01_Polygon_constructor (t) {
- t.plan( 3 );
- polygon = new OpenLayers.Feature.Geometry.Polygon();
- t.ok( polygon instanceof OpenLayers.Feature.Geometry.Polygon, "new OpenLayers.Feature.Geometry.Polygon returns polygon object" );
- t.eq( polygon.CLASS_NAME, "OpenLayers.Feature.Geometry.Polygon", "polygon.CLASS_NAME is set correctly");
- t.eq( polygon.linearRings, [], "polygon.linearRings is set correctly");
- }
-
- function test_01a_Polygon_constructor (t) {
- t.plan( 2 );
- polygon = new OpenLayers.Feature.Geometry.Polygon(path);
- t.ok( polygon instanceof OpenLayers.Feature.Geometry.Polygon, "new OpenLayers.Feature.Geometry.Polygon returns polygon object" );
- t.eq( polygon.CLASS_NAME, "OpenLayers.Feature.Geometry.Polygon", "polygon.CLASS_NAME is set correctly");
-//FIXME t.eq( polygon.linearRings, path, "polygon.linearRings is set correctly");
- }
-
- // -->
- </script>
-</head>
-<body>
-</body>
-</html>
Deleted: sandbox/vector/tests/test_Feature_Geometry_Surface.html
===================================================================
--- sandbox/vector/tests/test_Feature_Geometry_Surface.html 2006-12-05 08:53:58 UTC (rev 2006)
+++ sandbox/vector/tests/test_Feature_Geometry_Surface.html 2006-12-05 10:01:44 UTC (rev 2007)
@@ -1,20 +0,0 @@
-<html>
-<head>
- <script src="../lib/OpenLayers.js"></script>
- <script type="text/javascript"><!--
-
- var surface;
-
- function test_01_Surface_constructor (t) {
- t.plan( 2 );
- surface = new OpenLayers.Feature.Geometry.Surface();
- t.ok( surface instanceof OpenLayers.Feature.Geometry.Surface, "new OpenLayers.Feature.Geometry.Surface returns Surface object" );
- t.eq( surface.CLASS_NAME, "OpenLayers.Feature.Geometry.Surface", "surface.CLASS_NAME is set correctly");
- }
-
- // -->
- </script>
-</head>
-<body>
-</body>
-</html>
Added: sandbox/vector/tests/test_Geometry_LineString.html
===================================================================
--- sandbox/vector/tests/test_Geometry_LineString.html (rev 0)
+++ sandbox/vector/tests/test_Geometry_LineString.html 2006-12-05 10:01:44 UTC (rev 2007)
@@ -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/tests/test_Geometry_MultiPoint.html
===================================================================
--- sandbox/vector/tests/test_Geometry_MultiPoint.html (rev 0)
+++ sandbox/vector/tests/test_Geometry_MultiPoint.html 2006-12-05 10:01:44 UTC (rev 2007)
@@ -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/tests/test_Geometry_MultiPolygon.html
===================================================================
--- sandbox/vector/tests/test_Geometry_MultiPolygon.html (rev 0)
+++ sandbox/vector/tests/test_Geometry_MultiPolygon.html 2006-12-05 10:01:44 UTC (rev 2007)
@@ -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/tests/test_Geometry_Point.html
===================================================================
--- sandbox/vector/tests/test_Geometry_Point.html (rev 0)
+++ sandbox/vector/tests/test_Geometry_Point.html 2006-12-05 10:01:44 UTC (rev 2007)
@@ -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/tests/test_Geometry_Polygon.html
===================================================================
--- sandbox/vector/tests/test_Geometry_Polygon.html (rev 0)
+++ sandbox/vector/tests/test_Geometry_Polygon.html 2006-12-05 10:01:44 UTC (rev 2007)
@@ -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>
More information about the Commits
mailing list