[OpenLayers-Commits] r11835 - trunk/openlayers/tests/Control
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Thu Mar 31 07:35:16 EDT 2011
Author: erilem
Date: 2011-03-31 04:35:15 -0700 (Thu, 31 Mar 2011)
New Revision: 11835
Modified:
trunk/openlayers/tests/Control/Measure.html
Log:
better tests for Measure test_cancel, thanks jorix for reporting this (in #3195)
Modified: trunk/openlayers/tests/Control/Measure.html
===================================================================
--- trunk/openlayers/tests/Control/Measure.html 2011-03-31 11:35:08 UTC (rev 11834)
+++ trunk/openlayers/tests/Control/Measure.html 2011-03-31 11:35:15 UTC (rev 11835)
@@ -36,7 +36,7 @@
map.addControl(control);
control.activate();
-
+
try {
control.cancel();
t.ok(true, "calling cancel before drawing works");
@@ -51,22 +51,26 @@
xy: new OpenLayers.Pixel(x, y)
})
};
+
+ // keep a reference to the line being drawn
+ var line = control.handler.line;
+
trigger("mousemove", 0, 0);
trigger("mousedown", 0, 0);
trigger("mouseup", 0, 0);
trigger("mousemove", 10, 10);
trigger("mousedown", 10, 10);
trigger("mouseup", 10, 10);
+ trigger("dblclick", 10, 10);
+
+ // the geometry is finalized, we first confirm that it is persisted
+ t.ok(line.layer === control.handler.layer, "feature persists");
- // confirm that the sketch persists
- t.eq(control.handler.layer.features.length, 1, "feature persists");
- // cancel and see that sketch is gone (do not forget that
- // cancel will create the new feature)
+ // cancel and see that sketch is gone
control.cancel();
- t.eq(control.handler.layer.features.length, 2, "feature is gone after cancel");
-
+ t.eq(line.layer, null, "feature is gone after cancel");
+
map.destroy();
-
}
// test for <http://trac.openlayers.org/ticket/2691>
More information about the Commits
mailing list