[OpenLayers-Commits] r11154 -
sandbox/elemoine/draw-feature/tests/Handler
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Sun Feb 20 11:44:06 EST 2011
Author: erilem
Date: 2011-02-20 08:44:06 -0800 (Sun, 20 Feb 2011)
New Revision: 11154
Modified:
sandbox/elemoine/draw-feature/tests/Handler/Polygon.html
Log:
refactor the Polygon handler tests a bit
Modified: sandbox/elemoine/draw-feature/tests/Handler/Polygon.html
===================================================================
--- sandbox/elemoine/draw-feature/tests/Handler/Polygon.html 2011-02-20 16:43:53 UTC (rev 11153)
+++ sandbox/elemoine/draw-feature/tests/Handler/Polygon.html 2011-02-20 16:44:06 UTC (rev 11154)
@@ -683,7 +683,56 @@
map.destroy();
}
- function test_stopDown_true(t) {
+ function test_Handler_Polygon_destroy(t) {
+ t.plan(8);
+ var map = new OpenLayers.Map('map');
+ map.addLayer(new OpenLayers.Layer.WMS("", "", {}));
+ map.zoomToMaxExtent();
+ var control = new OpenLayers.Control();
+ map.addControl(control);
+ var handler = new OpenLayers.Handler.Polygon(control, {foo: 'bar'});
+
+ handler.activate();
+ var evt = {xy: new OpenLayers.Pixel(150, 75), which: 1};
+ handler.mousedown(evt);
+
+ t.ok(handler.layer,
+ "handler has a layer prior to destroy");
+ t.ok(handler.point,
+ "handler has a point prior to destroy");
+ t.ok(handler.line,
+ "handler has a line prior to destroy");
+ t.ok(handler.polygon,
+ "handler has a polygon prior to destroy");
+ handler.destroy();
+ t.eq(handler.layer, null,
+ "handler.layer is null after destroy");
+ t.eq(handler.point, null,
+ "handler.point is null after destroy");
+ t.eq(handler.line, null,
+ "handler.line is null after destroy");
+ t.eq(handler.polygon, null,
+ "handler.polygon is null after destroy");
+ map.destroy();
+ }
+
+ //
+ // Sequence tests
+ //
+ // Sequence tests basically involve executing a sequence of events
+ // and testing the resulting geometry.
+ //
+ // Below are tests for various drawing sequences. Tests can be
+ // added here each a non-working sequence is found.
+ //
+
+ // stopDown:true, stopUp:true
+ // a) click on (0, 0)
+ // b) mousedown on (0.5, 0.5)
+ // c) mouseup on (1, 1)
+ // d) click on (0, 10)
+ // e) dblclick on (10, 10)
+ function test_sequence1(t) {
t.plan(1);
var map = new OpenLayers.Map("map", {
resolutions: [1]
@@ -748,7 +797,13 @@
]), "geometry is correct");
}
- function test_stopDown_false(t) {
+ // stopDown:false, stopUp:false
+ // a) click on (0, 0)
+ // b) mousedown on (0.5, 0.5)
+ // c) mouseup on (1, 1)
+ // d) click on (0, 10)
+ // e) dblclick on (10, 10)
+ function test_sequence2(t) {
t.plan(1);
var map = new OpenLayers.Map("map", {
resolutions: [1]
@@ -813,41 +868,6 @@
]), "geometry is correct");
}
- function test_Handler_Polygon_destroy(t) {
- t.plan(8);
- var map = new OpenLayers.Map('map');
- map.addLayer(new OpenLayers.Layer.WMS("", "", {}));
- map.zoomToMaxExtent();
- var control = new OpenLayers.Control();
- map.addControl(control);
- var handler = new OpenLayers.Handler.Polygon(control, {foo: 'bar'});
-
- handler.activate();
- var evt = {xy: new OpenLayers.Pixel(150, 75), which: 1};
- handler.mousedown(evt);
-
- t.ok(handler.layer,
- "handler has a layer prior to destroy");
- t.ok(handler.point,
- "handler has a point prior to destroy");
- t.ok(handler.line,
- "handler has a line prior to destroy");
- t.ok(handler.polygon,
- "handler has a polygon prior to destroy");
- handler.destroy();
- t.eq(handler.layer, null,
- "handler.layer is null after destroy");
- t.eq(handler.point, null,
- "handler.point is null after destroy");
- t.eq(handler.line, null,
- "handler.line is null after destroy");
- t.eq(handler.polygon, null,
- "handler.polygon is null after destroy");
- map.destroy();
- }
-
-
-
</script>
</head>
<body>
More information about the Commits
mailing list