[OpenLayers-Commits] r11391 - in sandbox/bartvde/sencha/openlayers: . build examples lib lib/OpenLayers lib/OpenLayers/Control lib/OpenLayers/Handler tests tests/Control tests/Handler tests/Layer

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Thu Feb 24 05:17:43 EST 2011


Author: bartvde
Date: 2011-02-24 02:17:43 -0800 (Thu, 24 Feb 2011)
New Revision: 11391

Added:
   sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Handler/Pinch.js
   sandbox/bartvde/sencha/openlayers/tests/Handler/Pinch.html
Modified:
   sandbox/bartvde/sencha/openlayers/
   sandbox/bartvde/sencha/openlayers/build/build.py
   sandbox/bartvde/sencha/openlayers/examples/draw-feature.html
   sandbox/bartvde/sencha/openlayers/lib/OpenLayers.js
   sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Control/Measure.js
   sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Events.js
   sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Handler/Drag.js
   sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Handler/Path.js
   sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Handler/Point.js
   sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Handler/Polygon.js
   sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Map.js
   sandbox/bartvde/sencha/openlayers/tests/Control/DrawFeature.html
   sandbox/bartvde/sencha/openlayers/tests/Control/Measure.html
   sandbox/bartvde/sencha/openlayers/tests/Control/PanZoom.html
   sandbox/bartvde/sencha/openlayers/tests/Control/Split.html
   sandbox/bartvde/sencha/openlayers/tests/Handler/Click.html
   sandbox/bartvde/sencha/openlayers/tests/Handler/Drag.html
   sandbox/bartvde/sencha/openlayers/tests/Handler/Path.html
   sandbox/bartvde/sencha/openlayers/tests/Handler/Point.html
   sandbox/bartvde/sencha/openlayers/tests/Handler/Polygon.html
   sandbox/bartvde/sencha/openlayers/tests/Layer/EventPane.html
   sandbox/bartvde/sencha/openlayers/tests/Map.html
   sandbox/bartvde/sencha/openlayers/tests/list-tests.html
   sandbox/bartvde/sencha/openlayers/tests/run-tests.html
Log:
merge with trunk


Property changes on: sandbox/bartvde/sencha/openlayers
___________________________________________________________________
Modified: svn:mergeinfo
   - /sandbox/roberthl/openlayers:9745-9748
/trunk/openlayers:11179-11209,11211-11335
   + /sandbox/roberthl/openlayers:9745-9748
/trunk/openlayers:11179-11209,11211-11335,11338-11390

Modified: sandbox/bartvde/sencha/openlayers/build/build.py
===================================================================
--- sandbox/bartvde/sencha/openlayers/build/build.py	2011-02-24 10:08:20 UTC (rev 11390)
+++ sandbox/bartvde/sencha/openlayers/build/build.py	2011-02-24 10:17:43 UTC (rev 11391)
@@ -3,40 +3,46 @@
 import sys
 sys.path.append("../tools")
 import mergejs
+import optparse
 
-def build():
-    have_compressor = None
+def build(config_file = None, output_file = None, options = None):
+    have_compressor = []
     try:
         import jsmin
-        have_compressor = "jsmin"
+        have_compressor.append("jsmin")
     except ImportError:
-        try:
-            import minimize
-            have_compressor = "minimize"
-        except Exception, E:
-            print E
-            pass
+        print "No jsmin"
+    
+    try:
+        import minimize
+        have_compressor.append("minimize")
+    except ImportError:
+        print "No minimize"
 
+    use_compressor = None
+    if options.compressor and options.compressor in have_compressor:
+        use_compressor = options.compressor
+
     sourceDirectory = "../lib"
     configFilename = "full.cfg"
     outputFilename = "OpenLayers.js"
 
-    if len(sys.argv) > 1:
-        configFilename = sys.argv[1]
+    if config_file:
+        configFilename = config_file
         extension = configFilename[-4:]
 
         if extension  != ".cfg":
-            configFilename = sys.argv[1] + ".cfg"
+            configFilename = config_file + ".cfg"
 
-    if len(sys.argv) > 2:
-        outputFilename = sys.argv[2]
+    if output_file:
+        outputFilename = output_file
 
     print "Merging libraries."
     merged = mergejs.run(sourceDirectory, None, configFilename)
-    if have_compressor == "jsmin":
+    if use_compressor == "jsmin":
         print "Compressing using jsmin."
         minimized = jsmin.jsmin(merged)
-    elif have_compressor == "minimize":
+    elif use_compressor == "minimize":
         print "Compressing using minimize."
         minimized = minimize.minimize(merged)
     else: # fallback
@@ -51,4 +57,7 @@
     print "Done."
 
 if __name__ == '__main__':
-  build()
\ No newline at end of file
+  opt = optparse.OptionParser(usage="%s [options] [config_file] [output_file]\n  Default config_file is 'full.cfg', Default output_file is 'OpenLayers.js'")
+  opt.add_option("-c", "--compressor", dest="compressor", help="compression method: one of 'jsmin', 'minimize', or 'none'", default="jsmin")
+  (options, args) = opt.parse_args()
+  build(*args, options=options)

Modified: sandbox/bartvde/sencha/openlayers/examples/draw-feature.html
===================================================================
--- sandbox/bartvde/sencha/openlayers/examples/draw-feature.html	2011-02-24 10:08:20 UTC (rev 11390)
+++ sandbox/bartvde/sencha/openlayers/examples/draw-feature.html	2011-02-24 10:17:43 UTC (rev 11391)
@@ -64,6 +64,14 @@
                     }
                 }
             }
+
+            function allowPan(element) {
+                var stop = !element.checked;
+                for(var key in drawControls) {
+                    drawControls[key].handler.stopDown = stop;
+                    drawControls[key].handler.stopUp = stop;
+                }
+            }
         </script>
     </head>
     <body onload="init()">
@@ -97,15 +105,20 @@
                 <input type="radio" name="type" value="polygon" id="polygonToggle" onclick="toggleControl(this);" />
                 <label for="polygonToggle">draw polygon</label>
             </li>
+            <li>
+                <input type="checkbox" name="allow-pan" value="allow-pan" id="allowPanCheckbox" checked=true onclick="allowPan(this);" />
+                <label for="allowPanCheckbox">allow pan while drawing</label>
+            </li>
         </ul>
 
         <div id="docs">
-            <p>With the point drawing control active, click on the map to add a point.  You can drag the point
-            before letting the mouse up if you want to adjust the position.</p>
+            <p>With the point drawing control active, click on the map to add a point.</p>
             <p>With the line drawing control active, click on the map to add the points that make up your line.
             Double-click to finish drawing.</p>
             <p>With the polygon drawing control active, click on the map to add the points that make up your
             polygon.  Double-click to finish drawing.</p>
+            <p>With any drawing control active, paning the map can still be achieved.  Drag the map as
+            usual for that.</p>
             <p>Hold down the shift key while drawing to activate freehand mode.  While drawing lines or polygons
             in freehand mode, hold the mouse down and a point will be added with every mouse movement.<p>
         </div>

Modified: sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Control/Measure.js
===================================================================
--- sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Control/Measure.js	2011-02-24 10:08:20 UTC (rev 11390)
+++ sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Control/Measure.js	2011-02-24 10:17:43 UTC (rev 11391)
@@ -237,8 +237,8 @@
      * Parameters: point - {<OpenLayers.Geometry.Point>} The point at the
      * mouseposition. feature - {<OpenLayers.Feature.Vector>} The sketch feature.
      */
-    measureImmediate : function(point, feature) {
-        if (this.delayedTrigger === null &&
+    measureImmediate : function(point, feature, drawing) {
+        if (drawing && this.delayedTrigger === null &&
                                 !this.handler.freehandMode(this.handler.evt)) {
             this.measure(feature.geometry, "measurepartial");
         }

Modified: sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Events.js
===================================================================
--- sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Events.js	2011-02-24 10:08:20 UTC (rev 11390)
+++ sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Events.js	2011-02-24 10:17:43 UTC (rev 11391)
@@ -105,6 +105,20 @@
     },
 
     /**
+     * Method: isMultiTouch
+     * Determine whether event was caused by a multi touch
+     *
+     * Parameters:
+     * event - {Event}
+     *
+     * Returns:
+     * {Boolean}
+     */
+    isMultiTouch: function(event) {
+        return event.touches && event.touches.length > 1;
+    },
+
+    /**
      * Method: isLeftClick
      * Determine whether event was caused by a left click. 
      *

Modified: sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Handler/Drag.js
===================================================================
--- sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Handler/Drag.js	2011-02-24 10:08:20 UTC (rev 11390)
+++ sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Handler/Drag.js	2011-02-24 10:17:43 UTC (rev 11391)
@@ -156,9 +156,7 @@
             this.down(evt);
             this.callback("down", [evt.xy]);
 
-            if (evt.type === "mousedown") {
-                OpenLayers.Event.stop(evt);
-            }
+            OpenLayers.Event.stop(evt);
 
             if(!this.oldOnselectstart) {
                 this.oldOnselectstart = document.onselectstart ?
@@ -204,9 +202,7 @@
                     this.interval);
             }
             this.dragging = true;
-            if (evt.type === "touchmove") {
-                OpenLayers.Event.stop(evt);
-            }
+
             this.move(evt);
             this.callback("move", [evt.xy]);
             if(!this.oldOnselectstart) {

Modified: sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Handler/Path.js
===================================================================
--- sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Handler/Path.js	2011-02-24 10:08:20 UTC (rev 11390)
+++ sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Handler/Path.js	2011-02-24 10:17:43 UTC (rev 11391)
@@ -79,6 +79,9 @@
      *     feature.
      */
     createFeature: function(pixel) {
+        if(!pixel) {
+            pixel = new OpenLayers.Pixel(-50, -50);
+        }
         var lonlat = this.control.map.getLonLatFromPixel(pixel);
         this.point = new OpenLayers.Feature.Vector(
             new OpenLayers.Geometry.Point(lonlat.lon, lonlat.lat)
@@ -101,6 +104,17 @@
     },
 
     /**
+     * Method: destroyPersistedFeature
+     * Destroy the persisted feature.
+     */
+    destroyPersistedFeature: function() {
+        var layer = this.layer;
+        if(layer && layer.features.length > 2) {
+            this.layer.features[0].destroy();
+        }
+    },
+
+    /**
      * Method: removePoint
      * Destroy the temporary point.
      */
@@ -151,12 +165,13 @@
      * Parameters:
      * pixel - {<OpenLayers.Pixel>} The updated pixel location for the latest
      *     point.
+     * drawing - {Boolean} Indicate if we're currently drawing.
      */
-    modifyFeature: function(pixel) {
+    modifyFeature: function(pixel, drawing) {
         var lonlat = this.control.map.getLonLatFromPixel(pixel);
         this.point.geometry.x = lonlat.lon;
         this.point.geometry.y = lonlat.lat;
-        this.callback("modify", [this.point.geometry, this.getSketch()]);
+        this.callback("modify", [this.point.geometry, this.getSketch(), drawing]);
         this.point.geometry.clearBounds();
         this.drawFeature();
     },
@@ -209,22 +224,17 @@
      * {Boolean} Allow event propagation
      */
     mousedown: function(evt) {
-        // ignore double-clicks
-        if (this.lastDown && this.lastDown.equals(evt.xy)) {
-            return false;
+        var stopDown = this.stopDown;
+        if(this.freehandMode(evt)) {
+            stopDown = true;
         }
-        if(this.lastDown == null) {
-            if(this.persist) {
-                this.destroyFeature();
-            }
-            this.createFeature(evt.xy);
-        } else if((this.lastUp == null) || !this.lastUp.equals(evt.xy)) {
-            this.addPoint(evt.xy);
+        if(!this.lastDown || !this.lastDown.equals(evt.xy)) {
+            this.modifyFeature(evt.xy, !!this.lastUp);
         }
         this.mouseDown = true;
         this.lastDown = evt.xy;
-        this.drawing = true;
-        return false;
+        this.stoppedDown = stopDown;
+        return !stopDown;
     },
 
     /**
@@ -239,13 +249,16 @@
      * {Boolean} Allow event propagation
      */
     mousemove: function (evt) {
-        if(this.drawing) { 
-            if(this.mouseDown && this.freehandMode(evt)) {
-                this.addPoint(evt.xy);
-            } else {
-                this.modifyFeature(evt.xy);
+        if(this.stoppedDown && this.freehandMode(evt)) {
+            if(this.persist) {
+                this.destroyPersistedFeature();
             }
+            this.addPoint(evt.xy);
+            return false;
         }
+        if(!this.mouseDown || this.stoppedDown) {
+            this.modifyFeature(evt.xy, !!this.lastUp);
+        }
         return true;
     },
     
@@ -261,20 +274,23 @@
      * {Boolean} Allow event propagation
      */
     mouseup: function (evt) {
-        this.mouseDown = false;
-        if(this.drawing) {
-            if(this.freehandMode(evt)) {
+        if(this.mouseDown && (!this.lastUp || !this.lastUp.equals(evt.xy))) {
+            if(this.stoppedDown && this.freehandMode(evt)) {
                 this.removePoint();
                 this.finalize();
             } else {
-                if(this.lastUp == null) {
-                   this.addPoint(evt.xy);
+                if(this.lastDown.equals(evt.xy)) {
+                    if(this.lastUp == null && this.persist) {
+                        this.destroyPersistedFeature();
+                    }
+                    this.addPoint(evt.xy);
+                    this.lastUp = evt.xy;
                 }
-                this.lastUp = evt.xy;
             }
-            return false;
         }
-        return true;
+        this.stoppedDown = this.stopDown;
+        this.mouseDown = false;
+        return !this.stopUp;
     },
 
     /**

Copied: sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Handler/Pinch.js (from rev 11390, trunk/openlayers/lib/OpenLayers/Handler/Pinch.js)
===================================================================
--- sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Handler/Pinch.js	                        (rev 0)
+++ sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Handler/Pinch.js	2011-02-24 10:17:43 UTC (rev 11391)
@@ -0,0 +1,227 @@
+/* Copyright (c) 2006-2011 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the Clear BSD license.
+ * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Handler.js
+ */
+
+/**
+ * Class: OpenLayers.Handler.Pinch
+ * The pinch handler is used to deal with sequences of browser events related
+ *     to pinch gestures. The handler is used by controls that want to know
+ *     when a pinch sequence begins, when a pinch is happening, and when it has
+ *     finished.
+ *
+ * Controls that use the pinch handler typically construct it with callbacks
+ *     for 'start', 'move', and 'done'.  Callbacks for these keys are
+ *     called when the pinch begins, with each change, and when the pinch is
+ *     done.
+ *
+ * Create a new pinch handler with the <OpenLayers.Handler.Pinch> constructor.
+ *
+ * Inherits from:
+ *  - <OpenLayers.Handler>
+ */
+OpenLayers.Handler.Pinch = OpenLayers.Class(OpenLayers.Handler, {
+
+    /**
+     * Property: started
+     * {Boolean} When a touchstart event is received, we want to record it,
+     *     but not set 'pinching' until the touchmove get started after
+     *     starting.
+     */
+    started: false,
+
+    /**
+     * Property: stopDown
+     * {Boolean} Stop propagation of touchstart events from getting to
+     *     listeners on the same element. Default is true.
+     */
+    stopDown: true,
+
+    /**
+     * Property: pinching
+     * {Boolean}
+     */
+    pinching: false,
+
+    /**
+     * Property: last
+     * {Object} Object that store informations related to pinch last touch.
+     */
+    last: null,
+
+    /**
+     * Property: start
+     * {Object} Object that store informations related to pinch touchstart.
+     */
+    start: null,
+
+    /**
+     * Constructor: OpenLayers.Handler.Pinch
+     * Returns OpenLayers.Handler.Pinch
+     *
+     * Parameters:
+     * control - {<OpenLayers.Control>} The control that is making use of
+     *     this handler.  If a handler is being used without a control, the
+     *     handlers setMap method must be overridden to deal properly with
+     *     the map.
+     * callbacks - {Object} An object containing functions to be called when
+     *     the pinch operation start, change, or is finished. The callbacks
+     *     should expect to receive an object argument, which contains
+     *     information about scale, distance, and position of touch points.
+     * options - {Object}
+     */
+    initialize: function(control, callbacks, options) {
+        OpenLayers.Handler.prototype.initialize.apply(this, arguments);
+    },
+
+    /**
+     * Method: touchstart
+     * Handle touchstart events
+     *
+     * Parameters:
+     * evt - {Event}
+     *
+     * Returns:
+     * {Boolean} Let the event propagate.
+     */
+    touchstart: function(evt) {
+        var propagate = true;
+        this.pinching = false;
+        if (OpenLayers.Event.isMultiTouch(evt)) {
+            this.started = true;
+            this.last = this.start = {
+                distance: this.getDistance(evt.touches),
+                delta: 0,
+                scale: 1
+            };
+            this.callback("start", [evt, this.start]);
+            propagate = !this.stopDown;
+        } else {
+            this.started = false;
+            this.start = null;
+            this.last = null;
+        }
+        OpenLayers.Event.stop(evt);
+        return propagate;
+    },
+
+    /**
+     * Method: touchmove
+     * Handle touchmove events
+     *
+     * Parameters:
+     * evt - {Event}
+     *
+     * Returns:
+     * {Boolean} Let the event propagate.
+     */
+    touchmove: function(evt) {
+        if (this.started && OpenLayers.Event.isMultiTouch(evt)) {
+            this.pinching = true;
+            var current = this.getPinchData(evt);
+            this.callback("move", [evt, current]);
+            this.last = current;
+        }
+        return true;
+    },
+
+    /**
+     * Method: touchend
+     * Handle touchend events
+     *
+     * Parameters:
+     * evt - {Event}
+     *
+     * Returns:
+     * {Boolean} Let the event propagate.
+     */
+    touchend: function(evt) {
+        if (this.started) {
+            this.started = false;
+            this.pinching = false;
+            this.callback("done", [evt, this.start, this.last]);
+            this.start = null;
+            this.last = null;
+        }
+        return true;
+    },
+
+    /**
+     * Method: activate
+     * Activate the handler.
+     *
+     * Returns:
+     * {Boolean} The handler was successfully activated.
+     */
+    activate: function() {
+        var activated = false;
+        if (OpenLayers.Handler.prototype.activate.apply(this, arguments)) {
+            this.pinching = false;
+            activated = true;
+        }
+        return activated;
+    },
+
+    /**
+     * Method: deactivate
+     * Deactivate the handler.
+     *
+     * Returns:
+     * {Boolean} The handler was successfully deactivated.
+     */
+    deactivate: function() {
+        var deactivated = false;
+        if (OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {
+            this.started = false;
+            this.pinching = false;
+            this.start = null;
+            this.last = null;
+            deactivated = true;
+        }
+        return deactivated;
+    },
+
+    /**
+     * Method: getDistance
+     * Get the distance in pixels between two touches.
+     *
+     * Parameters:
+     * touches - {Array(Object)}
+     */
+    getDistance: function(touches) {
+        var t0 = touches[0];
+        var t1 = touches[1];
+        return Math.sqrt(
+            Math.pow(t0.clientX - t1.clientX, 2) +
+            Math.pow(t0.clientY - t1.clientY, 2)
+        );
+    },
+
+
+    /**
+     * Method: getPinchData
+     * Get informations about the pinch event.
+     *
+     * Parameters:
+     * evt - {Event}
+     *
+     * Returns:
+     * {Object} Object that contains data about the current pinch.
+     */
+    getPinchData: function(evt) {
+        var distance = this.getDistance(evt.touches);
+        var scale = distance / this.start.distance;
+        return {
+            distance: distance,
+            delta: this.last.distance - distance,
+            scale: scale
+        };
+    },
+
+    CLASS_NAME: "OpenLayers.Handler.Pinch"
+});
+

Modified: sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Handler/Point.js
===================================================================
--- sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Handler/Point.js	2011-02-24 10:08:20 UTC (rev 11390)
+++ sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Handler/Point.js	2011-02-24 10:17:43 UTC (rev 11391)
@@ -11,9 +11,9 @@
 
 /**
  * Class: OpenLayers.Handler.Point
- * Handler to draw a point on the map.  Point is displayed on mouse down,
- *     moves on mouse move, and is finished on mouse up.  The handler triggers
- *     callbacks for 'done', 'cancel', and 'modify'.  The modify callback is
+ * Handler to draw a point on the map. Point is displayed on activation,
+ *     moves on mouse move, and is finished on mouse up. The handler triggers
+ *     callbacks for 'done', 'cancel', and 'modify'. The modify callback is
  *     called with each change in the sketch and will receive the latest point
  *     drawn.  Create a new instance with the <OpenLayers.Handler.Point>
  *     constructor.
@@ -43,18 +43,19 @@
     multi: false,
     
     /**
-     * Property: drawing 
-     * {Boolean} A point is being drawn
-     */
-    drawing: false,
-    
-    /**
      * Property: mouseDown
      * {Boolean} The mouse is down
      */
     mouseDown: false,
 
     /**
+     * Property: stoppedDown
+     * {Boolean} Indicate whether the last mousedown stopped the event
+     * propagation.
+     */
+    stoppedDown: null,
+
+    /**
      * Property: lastDown
      * {<OpenLayers.Pixel>} Location of the last mouse down
      */
@@ -76,6 +77,20 @@
     persist: false,
 
     /**
+     * APIProperty: stopDown
+     * {Boolean} Stop event propagation on mousedown. Must be false to
+     *     allow "pan while drawing". Defaults to false.
+     */
+    stopDown: false,
+
+    /**
+     * APIPropery: stopUp
+     * {Boolean} Stop event propagation on mouse. Must be false to
+     *     allow "pan while dragging". Defaults to fase.
+     */
+    stopUp: false,
+
+    /**
      * Property: layerOptions
      * {Object} Any optional properties to be set on the sketch layer.
      */
@@ -130,6 +145,7 @@
         }, this.layerOptions);
         this.layer = new OpenLayers.Layer.Vector(this.CLASS_NAME, options);
         this.map.addLayer(this.layer);
+        this.createFeature();
         return true;
     },
     
@@ -141,6 +157,9 @@
      * pixel - {<OpenLayers.Pixel>} A pixel location on the map.
      */
     createFeature: function(pixel) {
+        if(!pixel) {
+            pixel = new OpenLayers.Pixel(-50, -50);
+        }
         var lonlat = this.map.getLonLatFromPixel(pixel);
         this.point = new OpenLayers.Feature.Vector(
             new OpenLayers.Geometry.Point(lonlat.lon, lonlat.lat)
@@ -158,17 +177,14 @@
         if(!OpenLayers.Handler.prototype.deactivate.apply(this, arguments)) {
             return false;
         }
-        // call the cancel callback if mid-drawing
-        if(this.drawing) {
-            this.cancel();
-        }
-        this.destroyFeature();
+        this.cancel(true);
         // If a layer's map property is set to null, it means that that layer
         // isn't added to the map. Since we ourself added the layer to the map
         // in activate(), we can assume that if this.layer.map is null it means
         // that the layer has been destroyed (as a result of map.destroy() for
         // example.
         if (this.layer.map != null) {
+            this.destroyFeature();
             this.layer.destroy(false);
         }
         this.layer = null;
@@ -187,14 +203,27 @@
     },
 
     /**
+     * Method: destroyPersistedFeature
+     * Destroy the persisted feature.
+     */
+    destroyPersistedFeature: function() {
+        var layer = this.layer;
+        if(layer && layer.features.length > 1) {
+            this.layer.features[0].destroy();
+        }
+    },
+
+    /**
      * Method: finalize
      * Finish the geometry and call the "done" callback.
      *
      * Parameters:
      * cancel - {Boolean} Call cancel instead of done callback.  Default is
      *     false.
+     * noNew - {Boolean} Do not create a new feature after
+     *     finalization.  Default is false.
      */
-    finalize: function(cancel) {
+    finalize: function(cancel, noNew) {
         var key = cancel ? "cancel" : "done";
         this.drawing = false;
         this.mouseDown = false;
@@ -204,14 +233,21 @@
         if(cancel || !this.persist) {
             this.destroyFeature();
         }
+        if(!noNew) {
+            this.createFeature();
+        }
     },
 
     /**
      * APIMethod: cancel
      * Finish the geometry and call the "cancel" callback.
+     *
+     * Parameters:
+     * noNew - {Boolean} Do not create a new feature after
+     *     cancelation.  Default is false.
      */
-    cancel: function() {
-        this.finalize(true);
+    cancel: function(noNew) {
+        this.finalize(true, noNew);
     },
 
     /**
@@ -257,7 +293,7 @@
         var lonlat = this.map.getLonLatFromPixel(pixel);
         this.point.geometry.x = lonlat.lon;
         this.point.geometry.y = lonlat.lat;
-        this.callback("modify", [this.point.geometry, this.point]);
+        this.callback("modify", [this.point.geometry, this.point, false]);
         this.point.geometry.clearBounds();
         this.drawFeature();
     },
@@ -310,25 +346,11 @@
      * {Boolean} Allow event propagation
      */
     mousedown: function(evt) {
-        // check keyboard modifiers
-        if(!this.checkModifiers(evt)) {
-            return true;
-        }
-        // ignore double-clicks
-        if(this.lastDown && this.lastDown.equals(evt.xy)) {
-            return true;
-        }
-        this.drawing = true;
-        if(this.lastDown == null) {
-            if(this.persist) {
-                this.destroyFeature();
-            }
-            this.createFeature(evt.xy);
-        } else {
-            this.modifyFeature(evt.xy);
-        }
+        this.mouseDown = true;
         this.lastDown = evt.xy;
-        return false;
+        this.modifyFeature(evt.xy);
+        this.stoppedDown = this.stopDown;
+        return !this.stopDown;
     },
 
     /**
@@ -343,7 +365,7 @@
      * {Boolean} Allow event propagation
      */
     mousemove: function (evt) {
-        if(this.drawing) {
+        if(!this.mouseDown || this.stoppedDown) {
             this.modifyFeature(evt.xy);
         }
         return true;
@@ -361,13 +383,42 @@
      * {Boolean} Allow event propagation
      */
     mouseup: function (evt) {
-        if(this.drawing) {
+        this.mouseDown = false;
+        this.stoppedDown = this.stopDown;
+        // check keyboard modifiers
+        if(!this.checkModifiers(evt)) {
+            return true;
+        }
+        // ignore double-clicks
+        if(this.lastUp && this.lastUp.equals(evt.xy)) {
+            return true;
+        }
+        if(this.lastDown && this.lastDown.equals(evt.xy)) {
+            if(this.persist) {
+                this.destroyPersistedFeature();
+            }
+            this.lastUp = evt.xy;
             this.finalize();
-            return false;
+            return !this.stopUp;
         } else {
             return true;
         }
     },
 
+    /**
+     * Method: mouseout
+     * Handle mouse out.  For better user experience reset mouseDown
+     * and stoppedDown when the mouse leaves the map viewport.
+     *
+     * Parameters:
+     * evt - {Event} The browser event
+     */
+    mouseout: function(evt) {
+        if(OpenLayers.Util.mouseLeft(evt, this.map.viewPortDiv)) {
+            this.stoppedDown = this.stopDown;
+            this.mouseDown = false;
+        }
+    },
+
     CLASS_NAME: "OpenLayers.Handler.Point"
 });

Modified: sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Handler/Polygon.js
===================================================================
--- sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Handler/Polygon.js	2011-02-24 10:08:20 UTC (rev 11390)
+++ sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Handler/Polygon.js	2011-02-24 10:17:43 UTC (rev 11391)
@@ -75,6 +75,9 @@
      *     feature.
      */
     createFeature: function(pixel) {
+        if(!pixel) {
+            pixel = new OpenLayers.Pixel(-50, -50);
+        }
         var lonlat = this.control.map.getLonLatFromPixel(pixel);
         this.point = new OpenLayers.Feature.Vector(
             new OpenLayers.Geometry.Point(lonlat.lon, lonlat.lat)
@@ -82,13 +85,27 @@
         this.line = new OpenLayers.Feature.Vector(
             new OpenLayers.Geometry.LinearRing([this.point.geometry])
         );
-        
-        // check for hole digitizing
-        var polygon;
-        if (this.holeModifier && (this.evt[this.holeModifier])) {
+        this.polygon = new OpenLayers.Feature.Vector(
+            new OpenLayers.Geometry.Polygon([this.line.geometry])
+        );
+        this.callback("create", [this.point.geometry, this.getSketch()]);
+        this.point.geometry.clearBounds();
+        this.layer.addFeatures([this.polygon, this.point], {silent: true});
+    },
+
+    /**
+     * Method: addPoint
+     * Add point to geometry.
+     *
+     * Parameters:
+     * pixel - {<OpenLayers.Pixel>} The pixel location for the new point.
+     */
+    addPoint: function(pixel) {
+        if(!this.drawingHole && this.holeModifier &&
+           this.evt && this.evt[this.holeModifier]) {
             var geometry = this.point.geometry;
             var features = this.control.layer.features;
-            var candidate;
+            var candidate, polygon;
             // look for intersections, last drawn gets priority
             for (var i=features.length-1; i>=0; --i) {
                 candidate = features[i].geometry;
@@ -110,15 +127,7 @@
                 }
             }
         }
-        if (!polygon) {
-            this.polygon = new OpenLayers.Feature.Vector(
-                new OpenLayers.Geometry.Polygon([this.line.geometry])
-            );
-        }
-        
-        this.callback("create", [this.point.geometry, this.getSketch()]);
-        this.point.geometry.clearBounds();
-        this.layer.addFeatures([this.polygon, this.point], {silent: true});
+        OpenLayers.Handler.Path.prototype.addPoint.apply(this, arguments);
     },
     
     /**

Modified: sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Map.js
===================================================================
--- sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Map.js	2011-02-24 10:08:20 UTC (rev 11390)
+++ sandbox/bartvde/sencha/openlayers/lib/OpenLayers/Map.js	2011-02-24 10:17:43 UTC (rev 11391)
@@ -507,18 +507,27 @@
         this.viewPortDiv.className = "olMapViewport";
         this.div.appendChild(this.viewPortDiv);
 
+        // the eventsDiv is where we listen for all map events
+        var eventsDiv = document.createElement("div");
+        eventsDiv.id = this.id + "_events";
+        eventsDiv.style.position = "absolute";
+        eventsDiv.style.width = "100%";
+        eventsDiv.style.height = "100%";
+        eventsDiv.style.zIndex = this.Z_INDEX_BASE.Control - 1;
+        this.viewPortDiv.appendChild(eventsDiv);
+        this.eventsDiv = eventsDiv;
+        this.events = new OpenLayers.Events(
+            this, this.eventsDiv, this.EVENT_TYPES, this.fallThrough, 
+            {includeXY: true}
+        );
+
         // the layerContainerDiv is the one that holds all the layers
         id = this.id + "_OpenLayers_Container";
         this.layerContainerDiv = OpenLayers.Util.createDiv(id);
         this.layerContainerDiv.style.zIndex=this.Z_INDEX_BASE['Popup']-1;
         
-        this.viewPortDiv.appendChild(this.layerContainerDiv);
+        this.eventsDiv.appendChild(this.layerContainerDiv);
 
-        this.events = new OpenLayers.Events(this, 
-                                            this.viewPortDiv, 
-                                            this.EVENT_TYPES, 
-                                            this.fallThrough, 
-                                            {includeXY: true});
         this.updateSize();
         if(this.eventListeners instanceof Object) {
             this.events.on(this.eventListeners);

Modified: sandbox/bartvde/sencha/openlayers/lib/OpenLayers.js
===================================================================
--- sandbox/bartvde/sencha/openlayers/lib/OpenLayers.js	2011-02-24 10:08:20 UTC (rev 11390)
+++ sandbox/bartvde/sencha/openlayers/lib/OpenLayers.js	2011-02-24 10:17:43 UTC (rev 11391)
@@ -170,6 +170,7 @@
                 "OpenLayers/Handler/Polygon.js",
                 "OpenLayers/Handler/Feature.js",
                 "OpenLayers/Handler/Drag.js",
+                "OpenLayers/Handler/Pinch.js",
                 "OpenLayers/Handler/RegularPolygon.js",
                 "OpenLayers/Handler/Box.js",
                 "OpenLayers/Handler/MouseWheel.js",

Modified: sandbox/bartvde/sencha/openlayers/tests/Control/DrawFeature.html
===================================================================
--- sandbox/bartvde/sencha/openlayers/tests/Control/DrawFeature.html	2011-02-24 10:08:20 UTC (rev 11390)
+++ sandbox/bartvde/sencha/openlayers/tests/Control/DrawFeature.html	2011-02-24 10:17:43 UTC (rev 11391)
@@ -60,7 +60,7 @@
     }
     
     function test_sketch_events(t) {
-        t.plan(6);
+        t.plan(12);
         var map = new OpenLayers.Map("map", {
             resolutions: [1]
         });
@@ -69,37 +69,62 @@
             isBaseLayer: true
         });
         var control = new OpenLayers.Control.DrawFeature(
-            layer, OpenLayers.Handler.Point
+            layer, OpenLayers.Handler.Path, {
+                handlerOptions: {persist: true}
+            }
         );
         map.addLayer(layer);
         map.addControl(control);
         map.zoomToMaxExtent();
-        control.activate();
         
-        var log = {};
+        var log;
         layer.events.on({
             sketchstarted: function(event) {
-                log.event = event;
+                log['sketchstarted'] = event;
             },
             sketchmodified: function(event) {
-                log.event = event;
+                log['sketchmodified'] = event;
             },
             sketchcomplete: function(event) {
-                log.event = event;
+                log['sketchcomplete'] = event;
             }
         });
         
         // mock up draw/modify of a point
+        log = {};
+        control.activate();
+        t.eq(log.sketchstarted.type, "sketchstarted", "[activate] sketchstarted triggered");
+        t.geom_eq(log.sketchstarted.vertex, new OpenLayers.Geometry.Point(-250, 175), "[activate] correct vertex");
+
+        log = {};
+        map.events.triggerEvent("mousemove", {xy: new OpenLayers.Pixel(0, 0)});
+        t.eq(log.sketchmodified.type, "sketchmodified", "[mousemove] sketchmodified triggered");
+        t.geom_eq(log.sketchmodified.vertex, new OpenLayers.Geometry.Point(-200, 125), "[mousemove] correct vertex");
+
         map.events.triggerEvent("mousedown", {xy: new OpenLayers.Pixel(0, 0)});
-        t.eq(log.event.type, "sketchstarted", "[mousedown] sketchstarted triggered");
-        t.geom_eq(log.event.vertex, new OpenLayers.Geometry.Point(-200, 125), "[mousedown] correct vertex");
+
+        log = {};
+        map.events.triggerEvent("mouseup", {xy: new OpenLayers.Pixel(0, 0)});
+        t.eq(log.sketchmodified.type, "sketchmodified", "[mouseup] sketchmodified triggered");
+        t.geom_eq(log.sketchmodified.vertex, new OpenLayers.Geometry.Point(-200, 125), "[mouseup] correct vertex");
+
+        log = {};
         map.events.triggerEvent("mousemove", {xy: new OpenLayers.Pixel(10, 10)});
-        t.eq(log.event.type, "sketchmodified", "[mousemove] sketchmodified triggered");
-        t.geom_eq(log.event.vertex, new OpenLayers.Geometry.Point(-190, 115), "[mousemove] correct vertex");
-        map.events.triggerEvent("mouseup", {xy: new OpenLayers.Pixel(10, 10)});
-        t.eq(log.event.type, "sketchcomplete", "[mouseup] sketchcomplete triggered");
-        t.geom_eq(log.event.feature.geometry, new OpenLayers.Geometry.Point(-190, 115), "[mouseup] correct geometry");
-        
+        t.eq(log.sketchmodified.type, "sketchmodified", "[mousemove] sketchmodified triggered");
+        t.geom_eq(log.sketchmodified.vertex, new OpenLayers.Geometry.Point(-190, 115), "[mousemove] correct vertex");
+
+        log = {};
+        map.events.triggerEvent("dblclick", {xy: new OpenLayers.Pixel(10, 10)});
+        t.eq(log.sketchcomplete.type, "sketchcomplete", "[dblclick] sketchcomplete triggered");
+        t.geom_eq(log.sketchcomplete.feature.geometry,
+                  new OpenLayers.Geometry.LineString([
+                      new OpenLayers.Geometry.Point(-200, 125),
+                      new OpenLayers.Geometry.Point(-190, 115)
+                  ]),
+                  "[dblclick] correct geometry");
+        t.eq(log.sketchstarted.type, "sketchstarted", "[dblclick] sketchstarted triggered");
+        t.geom_eq(log.sketchstarted.vertex, new OpenLayers.Geometry.Point(-250, 175), "[dblclick] correct vertex");
+
         map.destroy();
     }
 

Modified: sandbox/bartvde/sencha/openlayers/tests/Control/Measure.html
===================================================================
--- sandbox/bartvde/sencha/openlayers/tests/Control/Measure.html	2011-02-24 10:08:20 UTC (rev 11390)
+++ sandbox/bartvde/sencha/openlayers/tests/Control/Measure.html	2011-02-24 10:17:43 UTC (rev 11391)
@@ -52,6 +52,7 @@
                 xy: new OpenLayers.Pixel(x, y)
             })
         };
+        trigger("mousemove", 0, 0);
         trigger("mousedown", 0, 0);
         trigger("mouseup", 0, 0);
         trigger("mousemove", 10, 10);
@@ -60,9 +61,10 @@
         
         // confirm that the sketch persists
         t.eq(control.handler.layer.features.length, 1, "feature persists");
-        // cancel and see that sketch is gone
+        // cancel and see that sketch is gone (do not forget that
+        // cancel will create the new feature)
         control.cancel();
-        t.eq(control.handler.layer.features.length, 0, "feature is gone after cancel");
+        t.eq(control.handler.layer.features.length, 2, "feature is gone after cancel");
         
         map.destroy();
         
@@ -112,6 +114,7 @@
         var delay = control.partialDelay / 1000;
         
         // establish first point
+        trigger("mousemove", 0, 0);
         trigger("mousedown", 0, 0);
         trigger("mouseup", 0, 0);
 
@@ -187,6 +190,7 @@
                 log = [];
                 
                 // f) establish first freehand point
+                trigger("mousemove", 0, 0);
                 trigger("mousedown", 0, 0);
                 t.eq(log.length, 0, "f) no event fired yet")
                 
@@ -203,14 +207,14 @@
                 t.eq(log.length, 2, "h) event logged");
                 t.ok(log[1] && log[1].type == "measurepartial", "h) correct type");
                 t.ok(log[1] && log[1].measure == 20, "h) correct measure");
-                
+
                 // i) mouse up to finish
                 trigger("mouseup", 20, 0);
 
                 t.eq(log.length, 3, "i) event logged");
                 t.ok(log[2] && log[2].type == "measure", "i) correct type");
                 t.ok(log[2] && log[2].measure == 20, "i) correct measure");
-                
+
                 // j) clean up
                 log = [];
                 map.destroy();
@@ -224,7 +228,7 @@
     }
 
     function test_immediate(t) {
-        t.plan(29);
+        t.plan(32);
         
         var map = new OpenLayers.Map({
             div: "map",
@@ -237,7 +241,7 @@
             ],
             center: new OpenLayers.LonLat(0, 0)
         });
-        
+
         var log = [];
         var control = new OpenLayers.Control.Measure(
             OpenLayers.Handler.Path, {
@@ -255,7 +259,7 @@
         );
         map.addControl(control);
         control.activate();
-        
+
         // convenience function to trigger mouse events
         function trigger(type, x, y) {
             map.events.triggerEvent(type, {
@@ -267,6 +271,7 @@
         var delay = control.partialDelay / 1000;
 
         // a) establish first point
+        trigger("mousemove", 0, 0);
         trigger("mousedown", 0, 0);
         trigger("mouseup", 0, 0);
 
@@ -274,7 +279,7 @@
         trigger("mousemove", 0, 10);
 
         t.eq(log.length, 0, "a) no event fired yet");
-        
+
         t.delay_call(
             delay, function() {
                 // confirm measurepartial is fired
@@ -334,18 +339,21 @@
 
                 // i) double click to finish
                 trigger("mousedown", 0, 60);
+                t.eq(log.length, 7, "i) event logged");
+                t.eq(log[6] && log[6].type, "measurepartial", "i) correct type");
+                t.eq(log[6] && log[6].measure, 60, "i) correct measure");
                 trigger("mouseup", 0, 60);
-                t.eq(log.length, 6, "i) no event fired yet");
+                t.eq(log.length, 7, "i) no event fired yet");
             },
             delay, function() {
-                t.eq(log.length, 7, "i) event logged");
-                t.ok(log[6] && log[6].type == "measurepartial", "i) correct type");
-                t.ok(log[6] && log[6].measure == 60, "i) correct measure");
-                
+                t.eq(log.length, 8, "i) event logged");
+                t.eq(log[7] && log[7].type, "measurepartial", "i) correct type");
+                t.eq(log[7] && log[7].measure, 60, "i) correct measure");
+
                 trigger("dblclick", 0, 60);
-                t.eq(log.length, 8, "i) event logged");
-                t.ok(log[7] && log[7].type == "measure", "i) correct type");
-                t.ok(log[7] && log[7].measure == 60, "i) correct measure");
+                t.eq(log.length, 9, "i) event logged");
+                t.eq(log[8] && log[8].type, "measure", "i) correct type");
+                t.eq(log[8] && log[8].measure, 60, "i) correct measure");
                 // clear log
                 log = [];
 

Modified: sandbox/bartvde/sencha/openlayers/tests/Control/PanZoom.html
===================================================================
--- sandbox/bartvde/sencha/openlayers/tests/Control/PanZoom.html	2011-02-24 10:08:20 UTC (rev 11390)
+++ sandbox/bartvde/sencha/openlayers/tests/Control/PanZoom.html	2011-02-24 10:17:43 UTC (rev 11391)
@@ -74,7 +74,7 @@
                     t.delay_call(2, function() {
                         t.ok( wnd.mapper.getCenter().lat > wnd.centerLL.lat, "1) Pan up works correctly" );
                         t.ok(!flag.mousedown, "1) mousedown does not get to the map");
-                        t.ok(flag.mouseup, "1) mouseup does get to the map");
+                        t.ok(!flag.mouseup, "1) mouseup does not get to the map");
                         t.ok(!flag.click, "1) click does not get to the map");
                         t.ok(!flag.dblclick, "1) dblclick does not get to the map");
                         resetFlags();
@@ -83,7 +83,7 @@
                     }, 2, function() {    
                     t.ok( wnd.mapper.getCenter().lon < wnd.centerLL.lon, "2) Pan left works correctly" );
                     t.ok(!flag.mousedown, "2) mousedown does not get to the map");
-                    t.ok(flag.mouseup, "2) mouseup does get to the map");
+                    t.ok(!flag.mouseup, "2) mouseup does not get to the map");
                     t.ok(!flag.click, "2) click does not get to the map");
                     t.ok(!flag.dblclick, "2) dblclick does not get to the map");
                     resetFlags();
@@ -92,7 +92,7 @@
                     }, 2, function() {
                     t.ok( wnd.mapper.getCenter().lon == wnd.centerLL.lon, "3) Pan right works correctly" );
                     t.ok(!flag.mousedown, "3) mousedown does not get to the map");
-                    t.ok(flag.mouseup, "3) mouseup does get to the map");
+                    t.ok(!flag.mouseup, "3) mouseup does not get to the map");
                     t.ok(!flag.click, "3) click does not get to the map");
                     t.ok(!flag.dblclick, "3) dblclick does not get to the map");
                     resetFlags();
@@ -101,7 +101,7 @@
                     }, 2, function() {
                     t.ok( wnd.mapper.getCenter().lat == wnd.centerLL.lat, "4) Pan down works correctly" );
                     t.ok(!flag.mousedown, "4) mousedown does not get to the map");
-                    t.ok(flag.mouseup, "4) mouseup does get to the map");
+                    t.ok(!flag.mouseup, "4) mouseup does not get to the map");
                     t.ok(!flag.click, "4) click does not get to the map");
                     t.ok(!flag.dblclick, "4) dblclick does not get to the map");
                     resetFlags();
@@ -110,7 +110,7 @@
                     }, 2, function() {
                     t.eq( wnd.mapper.getZoom(), 6, "5) zoomin works correctly" );
                     t.ok(!flag.mousedown, "5) mousedown does not get to the map");
-                    t.ok(flag.mouseup, "5) mouseup does get to the map");
+                    t.ok(!flag.mouseup, "5) mouseup does not get to the map");
                     t.ok(!flag.click, "5) click does not get to the map");
                     t.ok(!flag.dblclick, "5) dblclick does not get to the map");
                     resetFlags();
@@ -119,7 +119,7 @@
                     }, 2, function() {
                     t.eq( wnd.mapper.getZoom(), 5, "6) zoomout works correctly" );
                     t.ok(!flag.mousedown, "6) mousedown does not get to the map");
-                    t.ok(flag.mouseup, "6) mouseup does get to the map");
+                    t.ok(!flag.mouseup, "6) mouseup does not get to the map");
                     t.ok(!flag.click, "6) click does not get to the map");
                     t.ok(!flag.dblclick, "6) dblclick does not get to the map");
                     resetFlags();
@@ -128,7 +128,7 @@
                     }, 2, function() {
                     t.eq( wnd.mapper.getZoom(), 2, "7) zoomworld works correctly" );
                     t.ok(!flag.mousedown, "7) mousedown does not get to the map");
-                    t.ok(flag.mouseup, "7) mouseup does get to the map");
+                    t.ok(!flag.mouseup, "7) mouseup does not get to the map");
                     t.ok(!flag.click, "7) click does not get to the map");
                     t.ok(!flag.dblclick, "7) dblclick does not get to the map");
                     resetFlags();

Modified: sandbox/bartvde/sencha/openlayers/tests/Control/Split.html
===================================================================
--- sandbox/bartvde/sencha/openlayers/tests/Control/Split.html	2011-02-24 10:08:20 UTC (rev 11390)
+++ sandbox/bartvde/sencha/openlayers/tests/Control/Split.html	2011-02-24 10:17:43 UTC (rev 11391)
@@ -35,13 +35,20 @@
     function test_setSource(t) {
         t.plan(5);
         
-        var layer1 = new OpenLayers.Layer.Vector();
-        var layer2 = new OpenLayers.Layer.Vector();
+        var layer1 = new OpenLayers.Layer.Vector("foo", {
+            maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
+            isBaseLayer: true
+        });
+        var layer2 = new OpenLayers.Layer.Vector("foo", {
+            maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
+            isBaseLayer: true
+        });
         
         var control = new OpenLayers.Control.Split({layer: layer1});
 
         var map = new OpenLayers.Map("map");
         map.addLayers([layer1, layer2]);
+        map.zoomToMaxExtent();
         map.addControl(control);
         control.activate();
         
@@ -64,12 +71,16 @@
     function test_activate(t) {
         t.plan(8);
         
-        var layer = new OpenLayers.Layer.Vector();
+        var layer = new OpenLayers.Layer.Vector("foo", {
+            maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
+            isBaseLayer: true
+        });
         var control = new OpenLayers.Control.Split({layer: layer});
         var map = new OpenLayers.Map("map");
         map.addLayer(layer);
+        map.zoomToMaxExtent();
         map.addControl(control);
-        
+
         // test activation with no source layer
         control.activate();
         t.eq(control.active, true, "control is active");
@@ -93,12 +104,16 @@
         
         t.plan(7);
         
-        var layer = new OpenLayers.Layer.Vector();
+        var layer = new OpenLayers.Layer.Vector("foo", {
+            maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
+            isBaseLayer: true
+        });
         var control = new OpenLayers.Control.Split({layer: layer});
         var map = new OpenLayers.Map("map");
         map.addLayer(layer);
+        map.zoomToMaxExtent();
         map.addControl(control);
-        
+
         // activate and check sketch handler
         control.activate();
         t.ok(control.handler, "sketch handler present");

Modified: sandbox/bartvde/sencha/openlayers/tests/Handler/Click.html
===================================================================
--- sandbox/bartvde/sencha/openlayers/tests/Handler/Click.html	2011-02-24 10:08:20 UTC (rev 11390)
+++ sandbox/bartvde/sencha/openlayers/tests/Handler/Click.html	2011-02-24 10:17:43 UTC (rev 11391)
@@ -50,7 +50,8 @@
             map: map
         };
         map.events.registerPriority = function(type, obj, func) {
-            var r = func();
+            var f = OpenLayers.Function.bind(func, obj)
+            var r = f({xy:null});
             if(typeof r == "string") {
                 // this is one of the mock handler methods
                 t.eq(OpenLayers.Util.indexOf(nonevents, type), -1,

Modified: sandbox/bartvde/sencha/openlayers/tests/Handler/Drag.html
===================================================================
--- sandbox/bartvde/sencha/openlayers/tests/Handler/Drag.html	2011-02-24 10:08:20 UTC (rev 11390)
+++ sandbox/bartvde/sencha/openlayers/tests/Handler/Drag.html	2011-02-24 10:17:43 UTC (rev 11391)
@@ -294,7 +294,7 @@
         // "touchend" events set expected states in the drag handler.
         // We also verify that we stop event bubbling as appropriate.
 
-        t.plan(12);
+        t.plan(14);
 
         // set up
 
@@ -302,37 +302,44 @@
         var c = new OpenLayers.Control();
         m.addControl(c);
         var h = new OpenLayers.Handler.Drag(c, {
-            done: function(px) { log = px; }});
+            done: function(px) { 
+                log.push(px); 
+            }
+        });
         h.activate();
 
         var _stop = OpenLayers.Event.stop;
-        OpenLayers.Event.stop = function(e) { log = e; };
+        OpenLayers.Event.stop = function(e) {
+            log.push(e);
+        };
 
-        var Px = OpenLayers.Pixel, e, log;
+        var Px = OpenLayers.Pixel, e;
+        var log = [];
 
         // test
-
         e = {touches: [{}], xy: new Px(0, 0)};
         m.events.triggerEvent('touchstart', e);
         t.eq(h.started, true, '[touchstart] started is set');
         t.eq(h.start.x, 0, '[touchstart] start.x is correct');
         t.eq(h.start.y, 0, '[touchstart] start.y is correct');
-        t.eq(log, undefined, '[touchstart] event is not stopped');
+        t.eq(log.length, 1, '[touchstart] one item in log');
+        t.ok(log[0] === e, "touchstart", '[touchstart] event is stopped');
 
         e = {xy: new Px(1, 1)};
         m.events.triggerEvent('touchmove', e);
         t.eq(h.dragging, true, '[touchmove] dragging is set');
-        t.eq(h.last.x, 1, '[touchstart] last.x is correct');
-        t.eq(h.last.y, 1, '[touchstart] last.y is correct');
-        t.ok(log == e, '[touchmove] event is stopped');
+        t.eq(h.last.x, 1, '[touchmove] last.x is correct');
+        t.eq(h.last.y, 1, '[touchmove] last.y is correct');
+        t.eq(log.length, 1, '[touchmove] one item in log (event is not stopped)');
 
         e = {xy: new Px(2, 2)};
         m.events.triggerEvent('touchend', e);
         t.eq(h.started, false, '[touchend] started is reset');
         t.eq(h.started, false, '[touchend] started is reset');
         // the "done" callback gets the position of the last touchmove
-        t.eq(log.x, 1, '[touchend] done callback got correct x position');
-        t.eq(log.y, 1, '[touchend] done callback got correct y position');
+        t.eq(log.length, 2, '[touchend] two items in log');
+        t.ok(log[1] instanceof Px, '[touchend] got');
+        t.ok(log[1].equals(e.xy), '[touchend] done callback got correct position');
 
         // tear down
 

Modified: sandbox/bartvde/sencha/openlayers/tests/Handler/Path.html
===================================================================
--- sandbox/bartvde/sencha/openlayers/tests/Handler/Path.html	2011-02-24 10:08:20 UTC (rev 11390)
+++ sandbox/bartvde/sencha/openlayers/tests/Handler/Path.html	2011-02-24 10:17:43 UTC (rev 11391)
@@ -25,12 +25,27 @@
     }
 
     function test_Handler_Path_activation(t) {
-        t.plan(3);
-        var map = new OpenLayers.Map('map');
+        t.plan(12);
+        var log = [];
+        var map = new OpenLayers.Map("map", {
+            resolutions: [1]
+        });
+        var layer = new OpenLayers.Layer.Vector("foo", {
+            maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
+            isBaseLayer: true
+        });
+        map.addLayer(layer);
         var control = new OpenLayers.Control();
+        var handler = new OpenLayers.Handler.Path(control, {
+            "create": function(g, f) {
+                log.push({geometry: g, feature: f});
+            }
+        });
+        control.handler = handler;
         map.addControl(control);
-        var handler = new OpenLayers.Handler.Path(control);
+        map.setCenter(new OpenLayers.LonLat(0, 0), 0);
         handler.active = true;
+
         var activated = handler.activate();
         t.ok(!activated,
              "activate returns false if the handler was already active");
@@ -38,39 +53,72 @@
         activated = handler.activate();
         t.ok(activated,
              "activate returns true if the handler was not already active");
+        t.ok(handler.layer instanceof OpenLayers.Layer.Vector,
+             "activate creates a vector layer");
+        t.ok(handler.layer.map == map,
+             "activate adds the vector layer to the map");
+        t.ok(handler.point instanceof OpenLayers.Feature.Vector,
+             "activate creates a point feature");
+        t.ok(handler.point.layer == handler.layer,
+             "activate adds the point feature to the layer");
+        t.ok(handler.line instanceof OpenLayers.Feature.Vector,
+             "acttivates creates a line feature");
+        t.ok(handler.line.layer == handler.layer,
+             "activate adds the line feature to the layer");
+        t.eq(log.length, 1,
+             "activate calls \"create\" once");
+        t.geom_eq(log[0].geometry, handler.point.geometry,
+                  "\"create\" called with expected geometry");
+        t.ok(log[0].feature == handler.line,
+             "\"create\" called with expected feature");
         activated = handler.deactivate();
         t.ok(activated,
              "deactivate returns true if the handler was active already");
-        map.destroy();     
+
+        map.destroy();
     }
 
-    function test_Handler_Path_bounds(t) {
+    function test_bounds(t) {
         t.plan(2);
+        var geometry;
         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.Path(control, {});
+        var handler = new OpenLayers.Handler.Path(control, {},
+            {stopDown: true, stopUp: true});
         var activated = handler.activate();
+        // click on (150, 75)
         var evt = {xy: new OpenLayers.Pixel(150, 75), which: 1};
+        handler.mousemove(evt);
         handler.mousedown(evt);
         handler.mouseup(evt);
-        var evt = {xy: new OpenLayers.Pixel(175, 100), which: 1};
+        // click on (175, 100)
+        evt = {xy: new OpenLayers.Pixel(175, 100), which: 1};
         handler.mousemove(evt);
         handler.mousedown(evt);
         handler.mouseup(evt);
-        t.ok(handler.line.geometry.getBounds().equals(new OpenLayers.Bounds(0,-35.15625,35.15625,0)), "Correct bounds"); 
-        var evt = {xy: new OpenLayers.Pixel(175, 100), which: 1};
+        t.ok(handler.line.geometry.getBounds().equals(
+                    new OpenLayers.Bounds(0,-35.15625,35.15625,0)),
+             "Correct bounds");
+        // mousedown on (175, 100)
+        evt = {xy: new OpenLayers.Pixel(175, 100), which: 1};
         handler.mousedown(evt);
-        var evt = {xy: new OpenLayers.Pixel(125, 100), which: 1};
+        // mousemove to (125, 100)
+        evt = {xy: new OpenLayers.Pixel(125, 100), which: 1};
         handler.mousemove(evt);
-        t.ok(!handler.line.geometry.getBounds().equals(new OpenLayers.Bounds(0,-35.15625,35.15625,0)), "Correct bounds after dragging without letting go. (Came out as "+handler.line.geometry.getBounds().toBBOX() + ".)"); 
+        // test that the bounds have changed
+        t.ok(!handler.line.geometry.getBounds().equals(
+                 new OpenLayers.Bounds(0,-35.15625,35.15625,0)),
+             "Correct bounds after dragging without letting go. " +
+             "(Came out as " + handler.line.geometry.getBounds().toBBOX() +
+             ".)");
         map.destroy();     
     }     
 
     function test_callbacks(t) {
-        t.plan(15);
+        t.plan(45);
         var map = new OpenLayers.Map("map", {
             resolutions: [1]
         });
@@ -79,74 +127,347 @@
             isBaseLayer: true
         });
         map.addLayer(layer);
-        var control = new OpenLayers.Control({
-        });
-        var log = {};
+        var control = new OpenLayers.Control({});
+        var logs = [], log;
         var handler = new OpenLayers.Handler.Path(control, {
             create: function() {
-                log.type = "create",
-                log.args = arguments
+                logs.push({type: "create", args: arguments});
             },
+            point: function() {
+                logs.push({type: "point", args: arguments});
+            },
             modify: function() {
-                log.type = "modify",
-                log.args = arguments
+                logs.push({type: "modify", args: arguments});
             },
             done: function() {
-                log.type = "done",
-                log.args = arguments
+                logs.push({type: "done", args: arguments});
             },
             cancel: function() {
-                log.type = "cancel",
-                log.args = arguments
+                logs.push({type: "cancel", args: arguments});
             }
         });
         control.handler = handler;
         map.addControl(control);
         map.setCenter(new OpenLayers.LonLat(0, 0), 0);
         
-        // mock up feature drawing
+        // create line
         handler.activate();
-        handler.mousedown({type: "mousedown", xy: new OpenLayers.Pixel(0, 0)});
-        t.eq(log.type, "create", "[mousedown] create called");
-        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-150, 75), "[mousedown] correct vertex");
-        t.ok(log.args[1] === handler.line, "[mousedown] correct sketch feature");
+        t.eq(logs.length, 1, "[activate] called back");
+        log = logs.shift();
+        t.eq(log.type, "create", "[activate] create called");
+        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-200, 125),
+                  "[activate] correct point");
+        t.ok(log.args[1] == handler.line,
+             "[activate] correct feature");
+        // mouse move
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0, 0)});
+        t.eq(logs.length, 1, "[mousemove] called back");
+        log = logs.shift();
+        t.eq(log.type, "modify", "[mousemove] modify called");
+        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-150, 75),
+                  "[mousemove] correct point");
+        t.ok(log.args[1] === handler.line,
+             "[mousemove] correct feature");
+        // mouse down
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 0)});
+        t.eq(logs.length, 1, "[mousedown] called back");
+        log = logs.shift();
+        t.eq(log.type, "modify", "[mousedown] modify called");
+        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-150, 75),
+                  "[mousedown] correct point");
+        t.ok(log.args[1] === handler.line,
+             "[mousedown] correct feature");
+        // mouse up
         handler.mouseup({type: "mouseup", xy: new OpenLayers.Pixel(0, 0)});
+        t.eq(logs.length, 2, "[mouseup] called back twice");
+        log = logs.shift();
+        t.eq(log.type, "point", "[mouseup] point called");
+        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-150, 75),
+                  "[mouseup] correct point");
+        t.geom_eq(log.args[1],
+                  new OpenLayers.Geometry.LineString([
+                      new OpenLayers.Geometry.Point(-150, 75),
+                      new OpenLayers.Geometry.Point(-150, 75)
+                  ]), "[mouseup] correct line");
+        log = logs.shift();
         t.eq(log.type, "modify", "[mouseup] modify called");
-        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-150, 75), "[mouseup] correct vertex");
-        t.ok(log.args[1] === handler.line, "[mouseup] correct sketch feature");
-        handler.mousemove({type: "mousemove", xy: new OpenLayers.Pixel(1, 1)});
+        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-150, 75),
+                  "[mouseup] correct point");
+        t.ok(log.args[1] == handler.line,
+             "[mouseup] correct feature");
+        // mouse move
+        handler.mousemove({type: "mousemove",
+                           xy: new OpenLayers.Pixel(1, 1)});
+        t.eq(logs.length, 1, "[mousemove] called back");
+        log = logs.shift();
         t.eq(log.type, "modify", "[mousemove] modify called");
-        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-149, 74), "[mousemove] correct vertex");
-        t.ok(log.args[1] === handler.line, "[mousemove] correct sketch feature");
-        handler.mousemove({type: "mousemove", xy: new OpenLayers.Pixel(10, 10)});
+        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-149, 74),
+                  "[mousemove] correct point");
+        t.ok(log.args[1] === handler.line,
+             "[mousemove] correct feature");
+        // mouse move
+        handler.mousemove({type: "mousemove",
+                           xy: new OpenLayers.Pixel(10, 10)});
+        t.eq(logs.length, 1, "[mousemove] called back");
+        log = logs.shift();
         t.eq(log.type, "modify", "[mousemove] modify called");
-        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-140, 65), "[mousemove] correct vertex");
-        t.ok(log.args[1] === handler.line, "[mousemove] correct sketch feature");
-        handler.mousedown({type: "mousedown", xy: new OpenLayers.Pixel(10, 10)});
-        handler.mouseup({type: "mouseup", xy: new OpenLayers.Pixel(10, 10)});
-        handler.mousedown({type: "mousedown", xy: new OpenLayers.Pixel(10, 10)});
-        handler.mouseup({type: "mouseup", xy: new OpenLayers.Pixel(10, 10)});
-        handler.dblclick({type: "dblclick", xy: new OpenLayers.Pixel(10, 10)});
+        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-140, 65),
+                  "[mousemove] correct point");
+        t.ok(log.args[1] === handler.line,
+             "[mousemove] correct feature");
+        // mouse down
+        handler.mousedown({type: "mousedown",
+                           xy: new OpenLayers.Pixel(10, 10)});
+        t.eq(logs.length, 1, "[mousedown] called back");
+        log = logs.shift();
+        t.eq(log.type, "modify", "[mousedown] modify called");
+        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-140, 65),
+                  "[mousedown] correct point");
+        t.ok(log.args[1] === handler.line,
+             "[mousedown] correct feature");
+        // mouse up ("point", "modify")
+        handler.mouseup({type: "mouseup",
+                         xy: new OpenLayers.Pixel(10, 10)});
+        t.eq(logs.length, 2, "[mouseup] called back twice");
+        log = logs.shift();
+        log = logs.shift();
+        // mouse down
+        handler.mousedown({type: "mousedown",
+                           xy: new OpenLayers.Pixel(10, 10)});
+        t.eq(logs.length, 0, "[mousedown] called back");
+        // mouse up
+        handler.mouseup({type: "mouseup",
+                         xy: new OpenLayers.Pixel(10, 10)});
+        t.eq(logs.length, 0, "[mouseup] not called back");
+        // double click
+        handler.dblclick({type: "dblclick",
+                          xy: new OpenLayers.Pixel(10, 10)});
+        t.eq(logs.length, 2, "[dblclick] called back twice");
+        log = logs.shift();
         t.eq(log.type, "done", "[dblclick] done called");
-        t.geom_eq(
-            log.args[0],
+        t.geom_eq(log.args[0],
             new OpenLayers.Geometry.LineString([
                 new OpenLayers.Geometry.Point(-150, 75),
                 new OpenLayers.Geometry.Point(-140, 65)
             ]),
             "[dblclick] correct linestring"
         );
-        
-        // mock up sketch cancel
-        handler.mousedown({type: "mousedown", xy: new OpenLayers.Pixel(0, 0)});
-        handler.mouseup({type: "mouseup", xy: new OpenLayers.Pixel(0, 0)});
-        handler.mousemove({type: "mousemove", xy: new OpenLayers.Pixel(1, 1)});
-        handler.deactivate();
-        t.eq(log.type, "cancel", "[deactivate while drawing] cancel called");
-        
+        log = logs.shift();
+        t.eq(log.type, "create", "[dblclick] create called");
+        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-200, 125),
+                  "[dblclick] correct point");
+        t.ok(log.args[1] == handler.line,
+             "[dblclick] correct feature");
+        // cancel
+        handler.cancel();
+        t.eq(logs.length, 2, "[cancel] called back");
+        log = logs.shift();
+        t.eq(log.type, "cancel", "[cancel] canced called");
+        t.geom_eq(log.args[0],
+            new OpenLayers.Geometry.LineString([
+                new OpenLayers.Geometry.Point(-200, 125)
+            ]),
+            "[cancel] correct linestring"
+        );
+        log = logs.shift();
+        t.eq(log.type, "create", "[cancel] create called");
+        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-200, 125),
+                  "[cancel] correct point");
+ 
         map.destroy();
-    }        
+    }
 
+    function test_toggle_freehand(t) {
+        t.plan(2);
+        var map = new OpenLayers.Map("map", {
+            resolutions: [1]
+        });
+        var layer = new OpenLayers.Layer.Vector("foo", {
+            maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
+            isBaseLayer: true
+        });
+        map.addLayer(layer);
+        var control = new OpenLayers.Control({});
+        var handler = new OpenLayers.Handler.Path(control, {
+            done: function(g) {
+                log++;
+            }
+        }, {persist: true});
+        control.handler = handler;
+        map.addControl(control);
+        map.setCenter(new OpenLayers.LonLat(0, 0), 0);
+
+        handler.activate();
+
+        log = 0;
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 0), shiftKey: true});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(1, 1), shiftKey: true});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(2, 2), shiftKey: true});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(0, 0), shiftKey: true});
+        t.eq(log, 1, "feature drawn when shift pressed on mousedown");
+
+        log = 0;
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 0), shiftKey: false});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(1, 1), shiftKey: true});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(2, 2), shiftKey: true});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(0, 0), shiftKey: true});
+        t.eq(log, 0, "feature not drawn when shift not pressed on mousedown");
+    }
+
+    function test_persist(t) {
+        t.plan(4);
+        var map = new OpenLayers.Map("map", {
+            resolutions: [1]
+        });
+        var layer = new OpenLayers.Layer.Vector("foo", {
+            maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
+            isBaseLayer: true
+        });
+        map.addLayer(layer);
+        var control = new OpenLayers.Control({});
+        var handler = new OpenLayers.Handler.Path(control, {});
+        control.handler = handler;
+        map.addControl(control);
+        map.setCenter(new OpenLayers.LonLat(0, 0), 0);
+
+        handler.activate();
+
+        handler.persist = false;
+        var feature1 = handler.line;
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(1, 1)});
+        handler.dblclick(
+            {type: "dblclick", xy: new OpenLayers.Pixel(1, 1)});
+        t.ok(feature1.layer == null, "a) feature1 destroyed");
+
+        handler.persist = true;
+        var feature2 = handler.line;
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(1, 1)});
+        handler.dblclick(
+            {type: "dblclick", xy: new OpenLayers.Pixel(1, 1)});
+        t.ok(feature2.layer != null, "b) feature2 not destroyed");
+
+        var feature3 = handler.line;
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(1, 1)});
+        handler.dblclick(
+            {type: "dblclick", xy: new OpenLayers.Pixel(1, 1)});
+        t.ok(feature3.layer != null, "c) feature3 not destroyed");
+        t.ok(feature2.layer == null, "c) feature2 destroyed");
+
+        map.destroy();
+    }
+
+    function test_persist_freehand(t) {
+        t.plan(6);
+        var map = new OpenLayers.Map("map", {
+            resolutions: [1]
+        });
+        var layer = new OpenLayers.Layer.Vector("foo", {
+            maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
+            isBaseLayer: true
+        });
+        map.addLayer(layer);
+        var control = new OpenLayers.Control({});
+        var handler = new OpenLayers.Handler.Path(control, {});
+        control.handler = handler;
+        map.addControl(control);
+        map.setCenter(new OpenLayers.LonLat(0, 0), 0);
+
+        handler.activate();
+
+        handler.persist = false;
+        var feature1 = handler.line;
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 0), shiftKey: true});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(1, 1), shiftKey: true});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(2, 2), shiftKey: true});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(0, 0), shiftKey: true});
+        t.ok(feature1.layer == null, "a) feature1 destroyed");
+
+        handler.persist = true;
+        feature2 = handler.line;
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 0), shiftKey: true});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(1, 1), shiftKey: true});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(2, 2), shiftKey: true});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(0, 0), shiftKey: true});
+        t.ok(feature2.layer != null, "b) feature2 not destroyed");
+
+        feature3 = handler.line;
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 0), shiftKey: true});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(1, 1), shiftKey: true});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(2, 2), shiftKey: true});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(0, 0), shiftKey: true});
+        t.ok(feature3.layer != null, "c) feature3 not destroyed");
+        t.ok(feature2.layer == null, "c) feature2 destroyed");
+
+        feature4 = handler.line;
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 0), shiftKey: false});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(1, 1), shiftKey: true});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(2, 2), shiftKey: true});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(0, 0), shiftKey: true});
+        t.ok(feature4.layer != null, "d) feature4 not destroyed");
+        t.ok(feature3.layer == null, "c) feature3 destroyed");
+
+        map.destroy();
+    }
+
     function test_Handler_Path_destroy(t) {
         t.plan(6);
         var map = new OpenLayers.Map('map');
@@ -175,9 +496,251 @@
              "handler.line 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) dblclick on (10, 10)
+    function test_sequence1(t) {
+        t.plan(1);
+        var map = new OpenLayers.Map("map", {
+            resolutions: [1]
+        });
+        var layer = new OpenLayers.Layer.Vector("foo", {
+            maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
+            isBaseLayer: true
+        });
+        map.addLayer(layer);
+        var control = new OpenLayers.Control({});
+        var handler = new OpenLayers.Handler.Path(control,
+            {done: function(g) { log.geometry = g; }},
+            {stopDown: true, stopUp: true}
+        );
+        control.handler = handler;
+        map.addControl(control);
+        map.setCenter(new OpenLayers.LonLat(0, 0), 0);
+
+        handler.activate();
+        log = {};
+
+        // a) click on (0, 0)
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(0, 0)});
+        // b) mousedown on (0.5, 0.5)
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0.5, 0.5)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0.5, 0.5)});
+        // c) mouseup on (1, 1)
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(1, 1)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(1, 1)});
+        // d) dblclick on (10, 10)
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(10, 10)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(10, 10)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(10, 10)});
+        handler.dblclick(
+            {type: "dblclick", xy: new OpenLayers.Pixel(10, 10)});
+        t.geom_eq(log.geometry,
+            new OpenLayers.Geometry.LineString([
+                new OpenLayers.Geometry.Point(-150, 75), // (0, 0)
+                new OpenLayers.Geometry.Point(-140, 65)  // (10, 10)
+            ]), "geometry is correct");
+    }
+
+    // stopDown:false, stopUp:false
+    // a) click on (0, 0)
+    // b) mousedown on (0.5, 0.5)
+    // c) mouseup on (1, 1)
+    // d) dblclick on (10, 10)
+    function test_sequence2(t) {
+        t.plan(1);
+        var map = new OpenLayers.Map("map", {
+            resolutions: [1]
+        });
+        var layer = new OpenLayers.Layer.Vector("foo", {
+            maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
+            isBaseLayer: true
+        });
+        map.addLayer(layer);
+        var control = new OpenLayers.Control({});
+        var handler = new OpenLayers.Handler.Path(control,
+            {done: function(g) { log.geometry = g; }},
+            {stopDown: false, stopUp: false}
+        );
+        control.handler = handler;
+        map.addControl(control);
+        map.setCenter(new OpenLayers.LonLat(0, 0), 0);
+
+        handler.activate();
+        log = {};
+
+        // a) click on (0, 0)
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(0, 0)});
+        // b) mousedown on (0.5, 0.5)
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0.5, 0.5)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0.5, 0.5)});
+        // c) mouseup on (1, 1)
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(1, 1)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(1, 1)});
+        // d) dblclick on (10, 10)
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(10, 10)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(10, 10)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(10, 10)});
+        handler.dblclick(
+            {type: "dblclick", xy: new OpenLayers.Pixel(10, 10)});
+        t.geom_eq(log.geometry,
+            new OpenLayers.Geometry.LineString([
+                new OpenLayers.Geometry.Point(-150, 75), // (0, 0)
+                new OpenLayers.Geometry.Point(-140, 65)  // (10, 10)
+            ]), "geometry is correct");
+    }
+
+    // a) click
+    // b) dblclick
+    // c) mousedown holding shift key
+    // d) mousemove holding shift key
+    function test_sequence3(t) {
+        t.plan(1);
+        var map = new OpenLayers.Map("map", {
+            resolutions: [1]
+        });
+        var layer = new OpenLayers.Layer.Vector("foo", {
+            maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
+            isBaseLayer: true
+        });
+        map.addLayer(layer);
+        var control = new OpenLayers.Control({});
+        var handler = new OpenLayers.Handler.Path(control, {});
+        control.handler = handler;
+        map.addControl(control);
+        map.setCenter(new OpenLayers.LonLat(0, 0), 0);
+
+        handler.activate();
+
+        // a) click on (0, 0)
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(0, 0)});
+        // b) click on (1, 1)
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(1, 1)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(1, 1)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(1, 1)});
+        // c) click on (1, 1)
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(1, 1)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(1, 1)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(1, 1)});
+        // d) mousemove to (10, 10)
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(10, 10), shiftKey: true});
+        t.geom_eq(handler.line.geometry,
+            new OpenLayers.Geometry.LineString([
+                new OpenLayers.Geometry.Point(-150, 75), // (0, 0)
+                new OpenLayers.Geometry.Point(-149, 74), // (1, 1)
+                new OpenLayers.Geometry.Point(-140, 65)  // (10, 10)
+            ]), "geometry is correct after mousemove");
+    }
+
+    // a) click
+    // b) dblclick
+    // c) mousedown holding shift key
+    // d) mousemove holding shift key
+    function test_sequence4(t) {
+        t.plan(2);
+        var map = new OpenLayers.Map("map", {
+            resolutions: [1]
+        });
+        var layer = new OpenLayers.Layer.Vector("foo", {
+            maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
+            isBaseLayer: true
+        });
+        map.addLayer(layer);
+        var control = new OpenLayers.Control({});
+        var handler = new OpenLayers.Handler.Path(control,
+            {done: function(g) { log.geometry = g; }},
+            {stopDown: false, stopUp: false}
+        );
+        control.handler = handler;
+        map.addControl(control);
+        map.setCenter(new OpenLayers.LonLat(0, 0), 0);
+
+        handler.activate();
+        log = {};
+
+        // a) click on (0, 0)
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(0, 0)});
+        // b) dblclick on (1, 1)
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(1, 1)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(1, 1)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(1, 1)});
+        handler.dblclick(
+            {type: "dblclick", xy: new OpenLayers.Pixel(1, 1)});
+        t.geom_eq(log.geometry,
+            new OpenLayers.Geometry.LineString([
+                new OpenLayers.Geometry.Point(-150, 75), // (0, 0)
+                new OpenLayers.Geometry.Point(-149, 74)  // (1, 1)
+            ]), "geometry is correct after dblclick");
+        // c) mousedown holding shift key on (1, 1)
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(1, 1), shiftKey: true});
+        // d) mousemove holding shift key to (10, 10)
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(10, 10), shiftKey: true});
+        t.geom_eq(handler.line.geometry,
+            new OpenLayers.Geometry.LineString([
+                new OpenLayers.Geometry.Point(-149, 74),  // (1, 1)
+                new OpenLayers.Geometry.Point(-140, 65)   // (10, 10)
+            ]), "geometry is correct after mousemove");
+    }
+
   </script>
 </head>
 <body>

Copied: sandbox/bartvde/sencha/openlayers/tests/Handler/Pinch.html (from rev 11390, trunk/openlayers/tests/Handler/Pinch.html)
===================================================================
--- sandbox/bartvde/sencha/openlayers/tests/Handler/Pinch.html	                        (rev 0)
+++ sandbox/bartvde/sencha/openlayers/tests/Handler/Pinch.html	2011-02-24 10:17:43 UTC (rev 11391)
@@ -0,0 +1,264 @@
+<html>
+<head>
+  <script src="../OLLoader.js"></script>
+  <script type="text/javascript">
+    function test_constructor(t) {
+        t.plan(3);
+        var control = new OpenLayers.Control();
+        control.id = Math.random();
+        var callbacks = {foo: "bar"};
+        var options = {bar: "foo"};
+
+        var oldInit = OpenLayers.Handler.prototype.initialize;
+
+        OpenLayers.Handler.prototype.initialize = function(con, call, opt) {
+            t.eq(con.id, control.id,
+                 "constructor calls parent with the correct control");
+            t.eq(call, callbacks,
+                 "constructor calls parent with the correct callbacks");
+            t.eq(opt, options,
+                 "constructor calls parent with the correct options");
+        };
+        var handler = new OpenLayers.Handler.Pinch(control, callbacks, options);
+
+        OpenLayers.Handler.prototype.initialize = oldInit;
+    }
+
+    function test_activate(t) {
+        t.plan(3);
+        var map = new OpenLayers.Map('map');
+        var control = new OpenLayers.Control();
+        map.addControl(control);
+        var handler = new OpenLayers.Handler.Pinch(control);
+        handler.active = true;
+        var activated = handler.activate();
+        t.ok(!activated,
+             "activate returns false if the handler was already active");
+        handler.active = false;
+        handler.pinching = true;
+        activated = handler.activate();
+        t.ok(activated,
+             "activate returns true if the handler was not already active");
+        t.ok(!handler.pinching,
+             "activate sets pinching to false");
+
+    }
+
+    function test_events(t) {
+        // each handled event should be activated twice when handler is
+        // activated, so:
+        // 27 = 4tests * 2*3events + 1tests * 3events
+        t.plan(27);
+
+        var map = new OpenLayers.Map('map');
+        var control = new OpenLayers.Control();
+        map.addControl(control);
+        var handler = new OpenLayers.Handler.Pinch(control);
+
+        // list below events that should be handled (events) and those
+        // that should not be handled (nonevents) by the handler
+        var events = ["touchend", "touchmove", "touchstart"];
+        var nonevents = ["mousedown", "mouseup", "mousemove", "mouseout",
+        "click", "dblclick", "resize", "focus", "blur"];
+        map.events.registerPriority = function(type, obj, func) {
+                // this is one of the mock handler methods
+                t.eq(OpenLayers.Util.indexOf(nonevents, type), -1,
+                     "registered method is not one of the events " +
+                     "that should not be handled: " + type);
+                t.ok(OpenLayers.Util.indexOf(events, type) > -1,
+                     "activate calls registerPriority with browser event: " + type);
+                t.eq(typeof func, "function",
+                     "activate calls registerPriority with a function");
+                t.eq(obj["CLASS_NAME"], "OpenLayers.Handler.Pinch",
+                     "activate calls registerPriority with the handler");
+        };
+        handler.activate();
+        handler.deactivate();
+
+        // set browser event like properties on the handler
+        for(var i=0; i<events.length; ++i) {
+            setMethod(events[i]);
+        }
+        function setMethod(key) {
+            handler[key] = function() {return key;};
+        }
+
+        map.events.registerPriority = function(type, obj, func) {
+            var r = func();
+            if(typeof r == "string") {
+                t.eq(r, type,
+                     "activate calls registerPriority with the correct method");
+            }
+        }
+        handler.activate();
+
+    }
+
+    function test_callbacks(t) {
+        t.plan(23);
+
+        var map = new OpenLayers.Map('map', {controls: []});
+
+        var control = new OpenLayers.Control();
+        map.addControl(control);
+
+        // set fake values for touches
+        var testEvents = {
+            start: {
+                type: 'start',
+                touches: [{
+                    clientX: 100,
+                    clientY: 0
+                }, {
+                    clientX: 0,
+                    clientY: 0
+                }]
+            },
+            move: {
+                type: 'move',
+                touches: [{
+                    clientX: 100,
+                    clientY: 0
+                }, {
+                    clientX: 20,
+                    clientY: 0
+                }]
+            },
+            done: {
+                type: 'done',
+                touches: []
+            }
+        };
+        
+        // set callback methods
+        var customCb = OpenLayers.Function.False;
+        var cb = function(evt) {
+            var tch = testEvents[evt.type].touches;
+            t.ok(evt.touches[0].clientX == tch[0].clientX &&
+                evt.touches[0].clientY == tch[0].clientY,
+                "touchstart sets first touch position correctly in evt");
+            t.ok(evt.touches[1].clientX == tch[1].clientX &&
+                evt.touches[1].clientY == tch[1].clientY,
+                "touchstart sets second touch position correctly in evt");
+            t.eq(handler.start.distance, 100, "start distance is " +
+                "always the same");
+            customCb.apply(this, arguments);
+        }
+        var callbacks = {
+            start: cb,
+            move: cb,
+            done: customCb
+        };
+
+        var handler = new OpenLayers.Handler.Pinch(control, callbacks);
+        handler.activate();
+
+        var old_isMultiTouch = OpenLayers.Event.isMultiTouch;
+        var old_stop = OpenLayers.Event.stop;
+        
+        // test single touch
+        OpenLayers.Event.isMultiTouch = function() {
+            return false;
+        }
+        handler.started = true;
+        handler.start = {
+            distance: 100,
+            delta: 0,
+            scale: 1
+        };
+        handler.last = {
+            distance: 150,
+            delta: 10,
+            scale: 1.5
+        };
+        map.events.triggerEvent("touchstart", testEvents.start);
+        t.ok(!handler.started, "1) touchstart (singletouch) sets started to false");
+        t.eq(handler.start, null, "1) touchstart (singletouch) sets start to null");
+        t.eq(handler.last, null, "1) touchstart (singletouch) sets last to null");
+
+        OpenLayers.Event.stop = function(evt, allowDefault) {
+            if(allowDefault) {
+                t.fail(
+                    "touchstart is prevented from falling to other elements");
+            }
+        }
+        OpenLayers.Event.isMultiTouch = function(evt) {
+            var res = old_isMultiTouch(evt);
+            t.ok(res, "fake event is a mutitouch touch event");
+            return res;
+        }
+        customCb = function(evt, pinchdata) {
+            t.eq(pinchdata.distance, 100, "2) calculated distance is correct");
+            t.eq(pinchdata.delta, 0, "2) calculated delta is correct");
+            t.eq(pinchdata.scale, 1, "2) calculated scale is correct");
+        }
+        map.events.triggerEvent("touchstart", testEvents.start);
+        t.ok(handler.started, "2) touchstart sets the started flag to true");
+        t.ok(!handler.pinching, "2) touchstart sets the pinching flag to false");
+
+        customCb = function(evt, pinchdata) {
+            t.eq(pinchdata.distance, 80, "3) calculated distance is correct");
+            t.eq(pinchdata.delta, 20, "3) calculated delta is correct");
+            t.eq(pinchdata.scale, 0.8, "3) calculated scale is correct");
+        }
+        map.events.triggerEvent("touchmove", testEvents.move);
+        t.ok(handler.started, "3) started flag still set to true");
+        t.ok(handler.pinching, "3) touchmove sets the pinching flag to true");
+
+
+        customCb = function(evt, first, last) {
+            t.eq(first.distance, 100, "4) calculated distance is correct");
+            t.eq(first.delta, 0, "4) calculated delta is correct");
+            t.eq(first.scale, 1, "4) calculated scale is correct");
+            t.eq(last.distance, 80, "4) calculated distance is correct");
+            t.eq(last.delta, 20, "4) calculated delta is correct");
+            t.eq(last.scale, 0.8, "4) calculated scale is correct");
+        }
+        map.events.triggerEvent("touchend", testEvents.done);
+        t.ok(!handler.started, "4) started flag is set to false");
+        t.ok(!handler.pinching, "4) touchdone sets the pinching flag to false");
+
+        OpenLayers.Event.stop = old_stop;
+        OpenLayers.Event.isMultiTouch = old_isMultiTouch;
+
+        // test move or done before start
+        customCb = function(evt) {
+            t.fail("should not pass here")
+        }
+        map.events.triggerEvent("touchmove", testEvents.move);
+        map.events.triggerEvent("touchend", testEvents.end);
+
+    }
+
+    function test_deactivate(t) {
+        t.plan(6);
+        var map = new OpenLayers.Map('map');
+        var control = new OpenLayers.Control();
+        map.addControl(control);
+        var handler = new OpenLayers.Handler.Pinch(control);
+        handler.active = false;
+        var deactivated = handler.deactivate();
+        t.ok(!deactivated,
+             "deactivate returns false if the handler was not already active");
+        handler.active = true;
+        handler.pinching = true;
+        deactivated = handler.deactivate();
+        t.ok(deactivated,
+             "deactivate returns true if the handler was active already");
+        t.ok(!handler.started,
+             "deactivate sets started to false");
+        t.ok(!handler.pinching,
+             "deactivate sets pinching to false");
+        t.ok(handler.start == null,
+             "deactivate sets start to null");
+        t.ok(handler.last == null,
+             "deactivate sets start to null");
+    }
+
+
+  </script>
+</head>
+<body>
+    <div id="map" style="width: 300px; height: 150px;"/>
+</body>
+</html>

Modified: sandbox/bartvde/sencha/openlayers/tests/Handler/Point.html
===================================================================
--- sandbox/bartvde/sencha/openlayers/tests/Handler/Point.html	2011-02-24 10:08:20 UTC (rev 11390)
+++ sandbox/bartvde/sencha/openlayers/tests/Handler/Point.html	2011-02-24 10:17:43 UTC (rev 11391)
@@ -25,11 +25,26 @@
     }
 
     function test_Handler_Point_activation(t) {
-        t.plan(3);
-        var map = new OpenLayers.Map('map');
+        t.plan(10);
+        var log = [];
+        var map = new OpenLayers.Map("map", {
+            resolutions: [1]
+        });
+        var layer = new OpenLayers.Layer.Vector("foo", {
+            maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
+            isBaseLayer: true
+        });
+        map.addLayer(layer);
         var control = new OpenLayers.Control();
+        var handler = new OpenLayers.Handler.Point(control, {
+            "create": function(g, f) {
+                log.push({geometry: g, feature: f});
+            }
+        });
+        control.handler = handler;
         map.addControl(control);
-        var handler = new OpenLayers.Handler.Point(control);
+        map.setCenter(new OpenLayers.LonLat(0, 0), 0);
+
         handler.active = true;
         var activated = handler.activate();
         t.ok(!activated,
@@ -38,24 +53,52 @@
         activated = handler.activate();
         t.ok(activated,
              "activate returns true if the handler was not already active");
+        t.ok(handler.layer instanceof OpenLayers.Layer.Vector,
+             "activate creates a vector layer");
+        t.ok(handler.layer.map == map,
+             "activate adds the vector layer to the map");
+        t.ok(handler.point instanceof OpenLayers.Feature.Vector,
+             "activate creates a feature");
+        t.ok(handler.point.layer == handler.layer,
+             "activate adds the feature to the layer");
+        t.eq(log.length, 1,
+             "activate calls \"create\" once");
+        t.geom_eq(log[0].geometry, handler.point.geometry,
+                  "\"create\" called with expected geometry");
+        t.ok(log[0].feature == handler.point,
+             "\"create\" called with expected feature");
         activated = handler.deactivate();
         t.ok(activated,
              "deactivate returns true if the handler was active already");
+
+        map.destroy();
     }
 
     function test_Handler_Point_events(t) {
-        t.plan(29);
-        
-        var map = new OpenLayers.Map('map');
-        var control = {
-            map: map
-        };
-        var handler = new OpenLayers.Handler.Point(control);
+        t.plan(34);
+        var log = [];
+        var map = new OpenLayers.Map("map", {
+            resolutions: [1]
+        });
+        var layer = new OpenLayers.Layer.Vector("foo", {
+            maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
+            isBaseLayer: true
+        });
+        map.addLayer(layer);
+        var control = new OpenLayers.Control();
+        var handler = new OpenLayers.Handler.Point(control, {
+            "create": function(g, f) {
+                log.push({geometry: g, feature: f});
+            }
+        });
+        control.handler = handler;
+        map.addControl(control);
+        map.setCenter(new OpenLayers.LonLat(0, 0), 0);
 
         // list below events that should be handled (events) and those
         // that should not be handled (nonevents) by the handler
-        var events = ["click", "dblclick", "mousedown", "mouseup", "mousemove"];
-        var nonevents = ["mouseout", "resize", "focus", "blur"];
+        var events = ["click", "dblclick", "mousedown", "mouseup", "mousemove", "mouseout"];
+        var nonevents = ["resize", "focus", "blur"];
         map.events.registerPriority = function(type, obj, func) {
             var r = func();
             if(typeof r == "string") {
@@ -99,7 +142,7 @@
     }
     
     function test_callbacks(t) {
-        t.plan(10);
+        t.plan(28);
         var map = new OpenLayers.Map("map", {
             resolutions: [1]
         });
@@ -108,68 +151,189 @@
             isBaseLayer: true
         });
         map.addLayer(layer);
-        var control = new OpenLayers.Control({
-        });
-        var log = {};
+        var control = new OpenLayers.Control({});
+        var logs = [], log;
         var handler = new OpenLayers.Handler.Point(control, {
             create: function() {
-                log.type = "create",
-                log.args = arguments
+                logs.push({type: "create", args: arguments});
             },
             modify: function() {
-                log.type = "modify",
-                log.args = arguments
+                logs.push({type: "modify", args: arguments});
             },
             done: function() {
-                log.type = "done",
-                log.args = arguments
+                logs.push({type: "done", args: arguments});
             },
             cancel: function() {
-                log.type = "cancel",
-                log.args = arguments
+                logs.push({type: "cancel", args: arguments});
             }
         });
         control.handler = handler;
         map.addControl(control);
         map.setCenter(new OpenLayers.LonLat(0, 0), 0);
         
-        // mock up feature drawing
+        // create point
         handler.activate();
-        handler.mousedown({type: "mousedown", xy: new OpenLayers.Pixel(0, 0)});
-        t.eq(log.type, "create", "[mousedown] create called");
-        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-150, 75), "[mousedown] correct point");
-        t.geom_eq(log.args[1].geometry, new OpenLayers.Geometry.Point(-150, 75), "[mousedown] correct sketch feature");
-        handler.mousemove({type: "mousemove", xy: new OpenLayers.Pixel(1, 0)});
+        t.eq(logs.length, 1, "[activate] called back");
+        log = logs.shift();
+        t.eq(log.type, "create", "[activate] create called");
+        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-200, 125),
+                  "[activate] correct point");
+        // mouse down
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 0)});
+        t.eq(logs.length, 1, "[mousedown] called back");
+        log = logs.shift();
+        t.eq(log.type, "modify", "[mousedown] modify called");
+        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-150, 75),
+                  "[mousedown] correct point");
+        t.geom_eq(log.args[1].geometry,
+                  new OpenLayers.Geometry.Point(-150, 75),
+                  "[mousedown] correct feature");
+        // mouse move
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(1, 0)});
+        t.eq(logs.length, 0, "[mousemove] not called back");
+        // mouse up (no finalize - we moved)
+        handler.mouseup({type: "mouseup", xy: new OpenLayers.Pixel(1, 0)});
+        t.eq(logs.length, 0, "[mouseup] not called back");
+        // mouse move
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(2, 0)});
+        t.eq(logs.length, 1, "[mousemove] called back");
+        log = logs.shift();
         t.eq(log.type, "modify", "[mousemove] modify called");
-        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-149, 75), "[mousemove] correct point");
-        t.geom_eq(log.args[1].geometry, new OpenLayers.Geometry.Point(-149, 75), "[mousemove] correct sketch feature");
-        handler.mouseup({type: "mouseup", xy: new OpenLayers.Pixel(1, 0)});
+        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-148, 75),
+                  "[mousemove] correct point");
+        t.geom_eq(log.args[1].geometry,
+                  new OpenLayers.Geometry.Point(-148, 75),
+                  "[mousemove] correct feature");
+        // mouse down
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(2, 0)});
+        t.eq(logs.length, 1, "[mousedown] called back");
+        log = logs.shift();
+        t.eq(log.type, "modify", "[mousedown] modify called");
+        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-148, 75),
+                  "[mousedown] correct point");
+        t.geom_eq(log.args[1].geometry,
+                  new OpenLayers.Geometry.Point(-148, 75),
+                  "[mousedown] correct feature");
+        // mouse up
+        handler.mouseup({type: "mouseup", xy: new OpenLayers.Pixel(2, 0)});
+        t.eq(logs.length, 2, "[mouseup] called back twice");
+        log = logs.shift();
         t.eq(log.type, "done", "[mouseup] done called");
-        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-149, 75), "[mouseup] correct point");
+        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-148, 75),
+                  "[mouseup] correct point");
+        log = logs.shift();
+        t.eq(log.type, "create", "[mouseup] create called");
+        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-200, 125),
+                  "[activate] correct point");
+        // mouse up on same pixel
+        handler.mouseup({type: "mouseup", xy: new OpenLayers.Pixel(2, 0)});
+        t.eq(logs.length, 0, "[mouseup] not called back");
+        // cancel
+        handler.cancel();
+        t.eq(logs.length, 2, "[cancel] called back");
+        log = logs.shift();
+        t.eq(log.type, "cancel", "[cancel] canced called");
+        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-200, 125),
+                  "[cancel] correct point");
+        log = logs.shift();
+        t.eq(log.type, "create", "[cancel] create called");
+        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-200, 125),
+                  "[cancel] correct point");
 
-        // mock up feature drawing with a cancel
-        handler.mousedown({type: "mousedown", xy: new OpenLayers.Pixel(0, 0)});
-        handler.deactivate();
-        t.eq(log.type, "cancel", "[deactivate while drawing] cancel called");
-        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-150, 75), "[deactivate while drawing] correct point");
+        map.destroy();
+    }
+
+    function test_persist(t) {
+        t.plan(3);
+        var map = new OpenLayers.Map("map", {
+            resolutions: [1]
+        });
+        var layer = new OpenLayers.Layer.Vector("foo", {
+            maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
+            isBaseLayer: true
+        });
+        map.addLayer(layer);
+        var control = new OpenLayers.Control({});
+        var handler = new OpenLayers.Handler.Point(control, {});
+        control.handler = handler;
+        map.addControl(control);
+        map.setCenter(new OpenLayers.LonLat(0, 0), 0);
         
+        handler.activate();
+
+        handler.persist = false;
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(0, 0)});
+        t.eq(handler.layer.features.length, 1,
+             "feature destroyed on mouseup when persist is false");
+
+        handler.persist = true;
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(1, 0)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(1, 0)});
+        t.eq(handler.layer.features.length, 2,
+             "feature not destroyed on mouseup when persist is true");
+        var feature = handler.layer.features[0];
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(2, 0)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(2, 0)});
+        t.ok(handler.layer.features[0] !== feature,
+             "persisted feature destroyed on next mouseup");
+
         map.destroy();
     }
 
 
     function test_Handler_Point_deactivation(t) {
-        t.plan(1);
-        var map = new OpenLayers.Map('map');
+        t.plan(5);
+        var log = [];
+        var map = new OpenLayers.Map("map", {
+            resolutions: [1]
+        });
+        var layer = new OpenLayers.Layer.Vector("foo", {
+            maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
+            isBaseLayer: true
+        });
+        map.addLayer(layer);
         var control = new OpenLayers.Control();
+        var handler = new OpenLayers.Handler.Point(control, {
+            "cancel": function(g) {
+                log.push({geometry: g});
+            }
+        });
+        control.handler = handler;
         map.addControl(control);
-             
-        var handler = new OpenLayers.Handler.Point(control, {foo: 'bar'});
+        map.setCenter(new OpenLayers.LonLat(0, 0), 0);
+
         handler.activate();
+        var _layer = handler.layer;
+        var _geometry = handler.point.geometry;
+        handler.deactivate();
+        t.eq(_layer.map, null,
+             "deactivates removes the layer from the map");
+        t.eq(handler.layer, null,
+             "deactivates sets its \"layer\" property to null");
+        t.eq(log.length, 1,
+             "deactivates calls \"cancel\" once");
+        t.ok(log[0].geometry.equals(_geometry),
+             "\"cancel\" called with expected geometry");
+
+        handler.activate();
         handler.layer.destroy();
         handler.deactivate();
         t.eq(handler.layer, null,
              "deactivate doesn't throw an error if layer was" +
              " previously destroyed");
+
+        map.destroy();
     }
 
     function test_Handler_Point_bounds(t) {
@@ -183,7 +347,7 @@
         var activated = handler.activate();
         var px = new OpenLayers.Pixel(150, 75);
         var evt = {xy: px, which: 1};
-        handler.mousedown(evt);
+        handler.mousemove(evt);
         var lonlat = map.getLonLatFromPixel(px);
         t.eq(handler.point.geometry.x, lonlat.lon, "X is correct"); 
         t.eq(handler.point.geometry.y, lonlat.lat, "Y is correct"); 
@@ -203,8 +367,6 @@
         var handler = new OpenLayers.Handler.Point(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");

Modified: sandbox/bartvde/sencha/openlayers/tests/Handler/Polygon.html
===================================================================
--- sandbox/bartvde/sencha/openlayers/tests/Handler/Polygon.html	2011-02-24 10:08:20 UTC (rev 11390)
+++ sandbox/bartvde/sencha/openlayers/tests/Handler/Polygon.html	2011-02-24 10:17:43 UTC (rev 11391)
@@ -25,12 +25,27 @@
     }
 
     function test_Handler_Polygon_activation(t) {
-        t.plan(3);
-        var map = new OpenLayers.Map('map');
+        t.plan(13);
+        var log = [];
+        var map = new OpenLayers.Map("map", {
+            resolutions: [1]
+        });
+        var layer = new OpenLayers.Layer.Vector("foo", {
+            maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
+            isBaseLayer: true
+        });
+        map.addLayer(layer);
         var control = new OpenLayers.Control();
+        var handler = new OpenLayers.Handler.Polygon(control, {
+            "create": function(g, f) {
+                log.push({geometry: g, feature: f});
+            }
+        });
+        control.handler = handler;
         map.addControl(control);
-        var handler = new OpenLayers.Handler.Polygon(control);
+        map.setCenter(new OpenLayers.LonLat(0, 0), 0);
         handler.active = true;
+
         var activated = handler.activate();
         t.ok(!activated,
              "activate returns false if the handler was already active");
@@ -38,41 +53,68 @@
         activated = handler.activate();
         t.ok(activated,
              "activate returns true if the handler was not already active");
+        t.ok(handler.layer instanceof OpenLayers.Layer.Vector,
+             "activate creates a vector layer");
+        t.ok(handler.layer.map == map,
+             "activate adds the vector layer to the map");
+        t.ok(handler.point instanceof OpenLayers.Feature.Vector,
+             "activate creates a point feature");
+        t.ok(handler.point.layer == handler.layer,
+             "activate adds the point feature to the layer");
+        t.ok(handler.line instanceof OpenLayers.Feature.Vector,
+             "activates creates a line feature");
+        t.ok(handler.polygon instanceof OpenLayers.Feature.Vector,
+             "acttivates creates a polygon feature");
+        t.ok(handler.polygon.layer == handler.layer,
+             "activate adds the polygin feature to the layer");
+        t.eq(log.length, 1,
+             "activate calls \"create\" once");
+        t.geom_eq(log[0].geometry, handler.point.geometry,
+                  "\"create\" called with expected geometry");
+        t.ok(log[0].feature == handler.polygon,
+             "\"create\" called with expected feature");
         activated = handler.deactivate();
         t.ok(activated,
              "deactivate returns true if the handler was active already");
-        map.destroy();     
+
+        map.destroy();
     }
 
-    function test_Handler_Polygon_bounds(t) {
+    function test_bounds_stopDown_true(t) {
         t.plan(2);
         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, {});
+        var handler = new OpenLayers.Handler.Polygon(control, {},
+                {stopDown: true, stopUp: true});
         var activated = handler.activate();
-
+        // click on (150, 75)
         var evt = {xy: new OpenLayers.Pixel(150, 75), which: 1};
+        handler.mousemove(evt);
         handler.mousedown(evt);
         handler.mouseup(evt);
-        var evt = {xy: new OpenLayers.Pixel(175, 100), which: 1};
+        // click on (175, 100)
+        evt = {xy: new OpenLayers.Pixel(175, 100), which: 1};
         handler.mousemove(evt);
         handler.mousedown(evt);
         handler.mouseup(evt);
         t.ok(handler.line.geometry.getBounds().equals(new OpenLayers.Bounds(0,-35.15625,35.15625,0)), "Correct bounds");
-        var evt = {xy: new OpenLayers.Pixel(175, 100), which: 1};
+        // mousedown on (175, 100)
+        evt = {xy: new OpenLayers.Pixel(175, 100), which: 1};
         handler.mousedown(evt);
-        var evt = {xy: new OpenLayers.Pixel(125, 100), which: 1};
+        // mousemove to (125, 100)
+        evt = {xy: new OpenLayers.Pixel(125, 100), which: 1};
         handler.mousemove(evt);
+        // test that the bounds have changed
         t.ok(!handler.polygon.geometry.getBounds().equals(new OpenLayers.Bounds(0,-35.15625,35.15625,0)),
              "Correct bounds after dragging without letting go. (Came out as "+handler.line.geometry.getBounds().toBBOX() + ".)");
         map.destroy();     
     }
 
     function test_callbacks(t) {
-        t.plan(15);
+        t.plan(45);
         var map = new OpenLayers.Map("map", {
             resolutions: [1]
         });
@@ -83,57 +125,141 @@
         map.addLayer(layer);
         var control = new OpenLayers.Control({
         });
-        var log = {};
+        var logs = [], log;
         var handler = new OpenLayers.Handler.Polygon(control, {
             create: function() {
-                log.type = "create",
-                log.args = arguments
+                logs.push({type: "create", args: arguments});
             },
+            point: function() {
+                logs.push({type: "point", args: arguments});
+            },
             modify: function() {
-                log.type = "modify",
-                log.args = arguments
+                logs.push({type: "modify", args: arguments});
             },
             done: function() {
-                log.type = "done",
-                log.args = arguments
+                logs.push({type: "done", args: arguments});
             },
             cancel: function() {
-                log.type = "cancel",
-                log.args = arguments
+                logs.push({type: "cancel", args: arguments});
             }
         });
         control.handler = handler;
         map.addControl(control);
         map.setCenter(new OpenLayers.LonLat(0, 0), 0);
         
-        // mock up feature drawing
+        // create polygon
         handler.activate();
-        // click at 0, 0
-        handler.mousedown({type: "mousedown", xy: new OpenLayers.Pixel(0, 0)});
-        t.eq(log.type, "create", "[mousedown] create called");
-        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-150, 75), "[mousedown] correct vertex");
-        t.ok(log.args[1] === handler.polygon, "[mousedown] correct sketch feature");
-        handler.mouseup({type: "mouseup", xy: new OpenLayers.Pixel(0, 0)});
+        handler.activate();
+        t.eq(logs.length, 1, "[activate] called back");
+        log = logs.shift();
+        t.eq(log.type, "create", "[activate] create called");
+        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-200, 125),
+                  "[activate] correct point");
+        t.ok(log.args[1] == handler.polygon,
+             "[activate] correct feature");
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0, 0)});
+        t.eq(logs.length, 1, "[mousemove] called back");
+        log = logs.shift();
+        t.eq(log.type, "modify", "[mousemove] modify called");
+        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-150, 75),
+                  "[mousemove] correct point");
+        t.ok(log.args[1] === handler.polygon,
+             "[mousemove] correct feature");
+        // mouse down
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 0)});
+        t.eq(logs.length, 1, "[mousedown] called back");
+        log = logs.shift();
+        t.eq(log.type, "modify", "[mousedown] modify called");
+        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-150, 75),
+                  "[mousedown] correct point");
+        t.ok(log.args[1] === handler.polygon,
+             "[mousedown] correct feature");
+        // mouse up
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(0, 0)});
+        t.eq(logs.length, 2, "[mouseup] called back twice");
+        log = logs.shift();
+        t.eq(log.type, "point", "[mouseup] point called");
+        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-150, 75),
+                  "[mouseup] correct point");
+        var geom = new OpenLayers.Geometry.Polygon([
+            new OpenLayers.Geometry.LinearRing([
+                new OpenLayers.Geometry.Point(-150, 75)
+            ])
+        ]);
+        geom.components[0].addComponent(
+            new OpenLayers.Geometry.Point(-150, 75),
+            geom.components[0].components.length
+        );
+        t.geom_eq(log.args[1], geom, "[mouseup] correct polygon");
+        log = logs.shift();
         t.eq(log.type, "modify", "[mouseup] modify called");
-        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-150, 75), "[mouseup] correct vertex");
-        t.ok(log.args[1] === handler.polygon, "[mouseup] correct sketch feature");
-        // move to 10, 10 and click
-        handler.mousemove({type: "mousemove", xy: new OpenLayers.Pixel(10, 10)});
+        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-150, 75),
+                  "[mouseup] correct point");
+        t.ok(log.args[1] == handler.polygon,
+             "[mouseup] correct feature");
+        // mouse move
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(10, 10)});
+        t.eq(logs.length, 1, "[mousemove] called back");
+        log = logs.shift();
         t.eq(log.type, "modify", "[mousemove] modify called");
-        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-140, 65), "[mousemove] correct vertex");
-        t.ok(log.args[1] === handler.polygon, "[mouseup] correct sketch feature");
-        handler.mousedown({type: "mousedown", xy: new OpenLayers.Pixel(10, 10)});
-        handler.mouseup({type: "mouseup", xy: new OpenLayers.Pixel(10, 10)});
+        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-140, 65),
+                  "[mousemove] correct point");
+        t.ok(log.args[1] === handler.polygon,
+             "[mousemove] correct feature");
+        // mouse down
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(10, 10)});
+        t.eq(logs.length, 1, "[mousedown] called back");
+        log = logs.shift();
+        t.eq(log.type, "modify", "[mousedown] modify called");
+        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-140, 65),
+                  "[mousedown] correct point");
+        t.ok(log.args[1] === handler.polygon,
+             "[mousedown] correct feature");
+        // mouse up
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(10, 10)});
+        log = logs.shift();
+        log = logs.shift();
         // move to 0, 10 and double click
-        handler.mousemove({type: "mousemove", xy: new OpenLayers.Pixel(0, 10)});
+        // mouse move
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0, 10)});
+        t.eq(logs.length, 1, "[mousemove] called back");
+        log = logs.shift();
         t.eq(log.type, "modify", "[mousemove] modify called");
-        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-150, 65), "[mousemove] correct vertex");
-        t.ok(log.args[1] === handler.polygon, "[mouseup] correct sketch feature");
-        handler.mousedown({type: "mousedown", xy: new OpenLayers.Pixel(0, 10)});
-        handler.mouseup({type: "mouseup", xy: new OpenLayers.Pixel(0, 10)});
-        handler.mousedown({type: "mousedown", xy: new OpenLayers.Pixel(0, 10)});
-        handler.mouseup({type: "mouseup", xy: new OpenLayers.Pixel(0, 10)});
-        handler.dblclick({type: "dblclick", xy: new OpenLayers.Pixel(0, 10)});
+        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-150, 65),
+                  "[mousemove] correct point");
+        t.ok(log.args[1] === handler.polygon,
+             "[mousemove] correct feature");
+        // mouse down
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 10)});
+        t.eq(logs.length, 1, "[mousedown] not called back");
+        log = logs.shift();
+        // mouse up
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(0, 10)});
+        t.eq(logs.length, 2, "[mouseup] called back");
+        log = logs.shift();
+        log = logs.shift();
+        // mouse down
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 10)});
+        t.eq(logs.length, 0, "[mousedown] not called back");
+        // mouse up
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(0, 10)});
+        t.eq(logs.length, 0, "[mouseup] not called back");
+        // dblclick
+        handler.dblclick(
+            {type: "dblclick", xy: new OpenLayers.Pixel(0, 10)});
+        t.eq(logs.length, 2, "[dblclick] called back twice");
+        log = logs.shift();
         t.eq(log.type, "done", "[dblclick] done called");
         t.geom_eq(
             log.args[0],
@@ -147,17 +273,232 @@
             ]),
             "[dblclick] correct polygon"
         );
-        
-        // mock up sketch cancel
-        handler.mousedown({type: "mousedown", xy: new OpenLayers.Pixel(0, 0)});
-        handler.mouseup({type: "mouseup", xy: new OpenLayers.Pixel(0, 0)});
-        handler.mousemove({type: "mousemove", xy: new OpenLayers.Pixel(1, 1)});
-        handler.deactivate();
-        t.eq(log.type, "cancel", "[deactivate while drawing] cancel called");
-        
+        log = logs.shift();
+        t.eq(log.type, "create", "[dblclick] create called");
+        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-200, 125),
+                  "[dblclick] correct point");
+        t.ok(log.args[1] == handler.polygon,
+             "[dblclick] correct feature");
+        // cancel
+        handler.cancel();
+        t.eq(logs.length, 2, "[cancel] called back");
+        log = logs.shift();
+        t.eq(log.type, "cancel", "[cancel] canced called");
+        log = logs.shift();
+        t.eq(log.type, "create", "[cancel] create called");
+        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-200, 125),
+                  "[cancel] correct point");
+
         map.destroy();
     }        
 
+    function test_toggle_freehand(t) {
+        t.plan(2);
+        var map = new OpenLayers.Map("map", {
+            resolutions: [1]
+        });
+        var layer = new OpenLayers.Layer.Vector("foo", {
+            maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
+            isBaseLayer: true
+        });
+        map.addLayer(layer);
+        var control = new OpenLayers.Control({});
+        var handler = new OpenLayers.Handler.Polygon(control, {
+            done: function(g) {
+                log++;
+            }
+        }, {persist: true});
+        control.handler = handler;
+        map.addControl(control);
+        map.setCenter(new OpenLayers.LonLat(0, 0), 0);
+
+        handler.activate();
+
+        log = 0;
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 0), shiftKey: true});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(1, 1), shiftKey: true});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(2, 2), shiftKey: true});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(0, 0), shiftKey: true});
+        t.eq(log, 1, "feature drawn when shift pressed on mousedown");
+
+        log = 0;
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 0), shiftKey: false});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(1, 1), shiftKey: true});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(2, 2), shiftKey: true});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(0, 0), shiftKey: true});
+        t.eq(log, 0, "feature not drawn when shift not pressed on mousedown");
+    }
+
+    function test_persist(t) {
+        t.plan(4);
+        var map = new OpenLayers.Map("map", {
+            resolutions: [1]
+        });
+        var layer = new OpenLayers.Layer.Vector("foo", {
+            maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
+            isBaseLayer: true
+        });
+        map.addLayer(layer);
+        var control = new OpenLayers.Control({});
+        var handler = new OpenLayers.Handler.Polygon(control, {});
+        control.handler = handler;
+        map.addControl(control);
+        map.setCenter(new OpenLayers.LonLat(0, 0), 0);
+
+        handler.activate();
+
+        handler.persist = false;
+        var feature1 = handler.polygon;
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(1, 1)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(1, 1)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(1, 1)});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(2, 2)});
+        handler.dblclick(
+            {type: "dblclick", xy: new OpenLayers.Pixel(2, 2)});
+        t.ok(feature1.layer == null, "a) feature1 destroyed");
+
+        handler.persist = true;
+        var feature2 = handler.polygon;
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(1, 1)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(1, 1)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(1, 1)});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(2, 2)});
+        handler.dblclick(
+            {type: "dblclick", xy: new OpenLayers.Pixel(2, 2)});
+        t.ok(feature2.layer != null, "b) feature2 not destroyed");
+
+        var feature3 = handler.polygon;
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(1, 1)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(1, 1)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(1, 1)});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(2, 2)});
+        handler.dblclick(
+            {type: "dblclick", xy: new OpenLayers.Pixel(2, 2)});
+        t.ok(feature3.layer != null, "c) feature3 not destroyed");
+        t.ok(feature2.layer == null, "c) feature2 destroyed");
+
+        map.destroy();
+    }
+
+    function test_persist_freehand(t) {
+        t.plan(6);
+        var map = new OpenLayers.Map("map", {
+            resolutions: [1]
+        });
+        var layer = new OpenLayers.Layer.Vector("foo", {
+            maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
+            isBaseLayer: true
+        });
+        map.addLayer(layer);
+        var control = new OpenLayers.Control({});
+        var handler = new OpenLayers.Handler.Polygon(control, {});
+        control.handler = handler;
+        map.addControl(control);
+        map.setCenter(new OpenLayers.LonLat(0, 0), 0);
+
+        handler.activate();
+
+        handler.persist = false;
+        var feature1 = handler.polygon;
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 0), shiftKey: true});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(1, 1), shiftKey: true});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(2, 2), shiftKey: true});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(2, 2), shiftKey: true});
+        t.ok(feature1.layer == null, "a) feature1 destroyed");
+
+        handler.persist = true;
+        var feature2 = handler.polygon;
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 0), shiftKey: true});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(1, 1), shiftKey: true});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(2, 2), shiftKey: true});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(2, 2), shiftKey: true});
+        t.ok(feature2.layer != null, "b) feature2 not destroyed");
+
+        var feature3 = handler.polygon;
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 0), shiftKey: true});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(1, 1), shiftKey: true});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(2, 2), shiftKey: true});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(2, 2), shiftKey: true});
+        t.ok(feature3.layer != null, "c) feature3 not destroyed");
+        t.ok(feature2.layer == null, "c) feature2 destroyed");
+
+        feature4 = handler.polygon;
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 0), shiftKey: false});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(1, 1), shiftKey: true});
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(2, 2), shiftKey: true});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(0, 0), shiftKey: true});
+        t.ok(feature4.layer != null, "d) feature4 not destroyed");
+        t.ok(feature3.layer == null, "c) feature3 destroyed");
+
+        map.destroy();
+    }
+
     function test_rings(t) {
         t.plan(12);
 
@@ -204,6 +545,7 @@
         log = [];
         // start at -9, 9
         event = {xy: new OpenLayers.Pixel(-9, 9)};
+        trigger("mousemove", event);
         trigger("mousedown", event);
         trigger("mouseup", event);
         // draw to -1, 9
@@ -228,7 +570,7 @@
         trigger("dblclick", event);
         
         // make assertions
-        t.eq(log.length, 9, "a) correct number of events");
+        t.eq(log.length, 14, "a) correct number of events");
         t.eq(log[log.length-1].type, "featureadded", "a) featureadded event last");
         t.eq(log[log.length-1].feature.geometry.getArea(), 64, "a) correct polygon area");
 
@@ -236,6 +578,7 @@
         log = [];
         // start at -6, 6
         event = {xy: new OpenLayers.Pixel(-6, 6), altKey: true};
+        trigger("mousemove", event);
         trigger("mousedown", event);
         trigger("mouseup", event);
         // draw to -3, 6
@@ -260,7 +603,7 @@
         trigger("dblclick", event);
         
         // make assertions
-        t.eq(log.length, 8, "b) correct number of events");
+        t.eq(log.length, 13, "b) correct number of events");
         t.eq(log[log.length-1].type, "sketchcomplete", "b) sketchcomplete event last");
         t.eq(log[log.length-1].feature.geometry.getArea(), 55, "b) correct polygon area");
         
@@ -269,6 +612,7 @@
         log = [];
         // start at -2, 2
         event = {xy: new OpenLayers.Pixel(-2, 2)};
+        trigger("mousemove", event);
         trigger("mousedown", event);
         trigger("mouseup", event);
         // draw to 2, 2
@@ -293,7 +637,7 @@
         trigger("dblclick", event);
         
         // make assertions
-        t.eq(log.length, 9, "c) correct number of events");
+        t.eq(log.length, 14, "c) correct number of events");
         t.eq(log[log.length-1].type, "featureadded", "c) featureadded event last");
         t.eq(log[log.length-1].feature.geometry.getArea(), 16, "c) correct polygon area");
 
@@ -301,6 +645,7 @@
         log = [];
         // start at -1, 1
         event = {xy: new OpenLayers.Pixel(-1, 1), altKey: true};
+        trigger("mousemove", event);
         trigger("mousedown", event);
         trigger("mouseup", event);
         // draw to 1, 1
@@ -330,7 +675,7 @@
         trigger("dblclick", event);
         
         // make assertions
-        t.eq(log.length, 11, "d) correct number of events");
+        t.eq(log.length, 18, "d) correct number of events");
         t.eq(log[log.length-1].type, "sketchcomplete", "d) sketchcomplete event last");
         t.eq(log[log.length-1].feature.geometry.getArea(), 12, "d) correct polygon area");
         
@@ -338,7 +683,6 @@
         map.destroy();
     }        
 
-
     function test_Handler_Polygon_destroy(t) {
         t.plan(8);
         var map = new OpenLayers.Map('map');
@@ -372,8 +716,158 @@
         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]
+        });
+        var layer = new OpenLayers.Layer.Vector("foo", {
+            maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
+            isBaseLayer: true
+        });
+        map.addLayer(layer);
+        var control = new OpenLayers.Control({});
+        var handler = new OpenLayers.Handler.Polygon(control,
+            {done: function(g) { log.geometry = g; }},
+            {stopDown: true, stopUp: true}
+        );
+        control.handler = handler;
+        map.addControl(control);
+        map.setCenter(new OpenLayers.LonLat(0, 0), 0);
 
+        handler.activate();
+        log = {};
+
+        // a) click on (0, 0)
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(0, 0)});
+        // b) mousedown on (0.5, 0.5)
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0.5, 0.5)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0.5, 0.5)});
+        // c) mouseup on (1, 1)
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(1, 1)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(1, 1)});
+        // d) click on (0, 10)
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0, 10)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 10)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(0, 10)});
+        // e) dblclick on (10, 10)
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(10, 10)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(10, 10)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(10, 10)});
+        handler.dblclick(
+            {type: "dblclick", xy: new OpenLayers.Pixel(10, 10)});
+        t.geom_eq(log.geometry,
+            new OpenLayers.Geometry.Polygon([
+                new OpenLayers.Geometry.LinearRing([
+                    new OpenLayers.Geometry.Point(-150, 75), // (0, 0)
+                    new OpenLayers.Geometry.Point(-150, 65), // (0, 10)
+                    new OpenLayers.Geometry.Point(-140, 65)  // (10, 10)
+                ])
+            ]), "geometry is correct");
+    }
+
+    // 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]
+        });
+        var layer = new OpenLayers.Layer.Vector("foo", {
+            maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
+            isBaseLayer: true
+        });
+        map.addLayer(layer);
+        var control = new OpenLayers.Control({});
+        var handler = new OpenLayers.Handler.Polygon(control,
+            {done: function(g) { log.geometry = g; }},
+            {stopDown: false, stopUp: false}
+        );
+        control.handler = handler;
+        map.addControl(control);
+        map.setCenter(new OpenLayers.LonLat(0, 0), 0);
+
+        handler.activate();
+        log = {};
+
+        // a) click on (0, 0)
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 0)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(0, 0)});
+        // b) mousedown on (0.5, 0.5)
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0.5, 0.5)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0.5, 0.5)});
+        // c) mouseup on (1, 1)
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(1, 1)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(1, 1)});
+        // d) click on (0, 10)
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(0, 10)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(0, 10)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(0, 10)});
+        // e) dblclick on (10, 10)
+        handler.mousemove(
+            {type: "mousemove", xy: new OpenLayers.Pixel(10, 10)});
+        handler.mousedown(
+            {type: "mousedown", xy: new OpenLayers.Pixel(10, 10)});
+        handler.mouseup(
+            {type: "mouseup", xy: new OpenLayers.Pixel(10, 10)});
+        handler.dblclick(
+            {type: "dblclick", xy: new OpenLayers.Pixel(10, 10)});
+        t.geom_eq(log.geometry,
+            new OpenLayers.Geometry.Polygon([
+                new OpenLayers.Geometry.LinearRing([
+                    new OpenLayers.Geometry.Point(-150, 75), // (0, 0)
+                    new OpenLayers.Geometry.Point(-150, 65), // (0, 10)
+                    new OpenLayers.Geometry.Point(-140, 65)  // (10, 10)
+                ])
+            ]), "geometry is correct");
+    }
+
   </script>
 </head>
 <body>

Modified: sandbox/bartvde/sencha/openlayers/tests/Layer/EventPane.html
===================================================================
--- sandbox/bartvde/sencha/openlayers/tests/Layer/EventPane.html	2011-02-24 10:08:20 UTC (rev 11390)
+++ sandbox/bartvde/sencha/openlayers/tests/Layer/EventPane.html	2011-02-24 10:17:43 UTC (rev 11391)
@@ -94,9 +94,9 @@
         if (document.createEvent) { // Mozilla
             var evObj = document.createEvent('MouseEvents');
             evObj.initEvent('mousemove', true, false);
-            layer.pane.dispatchEvent(evObj);
+            map.eventsDiv.dispatchEvent(evObj);
         } else if(document.createEventObject) { // IE
-            layer.pane.fireEvent('onmousemove');
+            map.eventsDiv.fireEvent('onmousemove');
         }
         
         t.eq(log.length, 1, "got one event");

Modified: sandbox/bartvde/sencha/openlayers/tests/Map.html
===================================================================
--- sandbox/bartvde/sencha/openlayers/tests/Map.html	2011-02-24 10:08:20 UTC (rev 11390)
+++ sandbox/bartvde/sencha/openlayers/tests/Map.html	2011-02-24 10:17:43 UTC (rev 11391)
@@ -1667,7 +1667,26 @@
         map.destroy();
         
     }
+    function test_pixel_lonlat(t) {
+        
+        t.plan(4);
 
+        var map = new OpenLayers.Map({
+            div: "map",
+            layers: [
+                new OpenLayers.Layer("name", {isBaseLayer:true})
+            ]
+        });
+        map.zoomToMaxExtent();
+        var px = map.getPixelFromLonLat(map.getLonLatFromPixel(new OpenLayers.Pixel(100, 100)));
+        t.eq(px.x, 100, "x is the same in and ot");
+        t.eq(px.y, 100, "y is the same in and out");
+        var ll = map.getLonLatFromPixel(map.getPixelFromLonLat(new OpenLayers.LonLat(100, 100)));
+        t.ok((ll.lon > (100 -map.getResolution()) && (ll.lon < (100 + map.getResolution()))), "lon is the same in and ot");
+        t.ok((ll.lat > (100 -map.getResolution()) && (ll.lat < (100 + map.getResolution()))), "lat is the same in and ot");
+        map.destroy();
+    }    
+
   </script>
 </head>
 <body>

Modified: sandbox/bartvde/sencha/openlayers/tests/list-tests.html
===================================================================
--- sandbox/bartvde/sencha/openlayers/tests/list-tests.html	2011-02-24 10:08:20 UTC (rev 11390)
+++ sandbox/bartvde/sencha/openlayers/tests/list-tests.html	2011-02-24 10:17:43 UTC (rev 11391)
@@ -118,6 +118,7 @@
     <li>Handler/Box.html</li>
     <li>Handler/Click.html</li>
     <li>Handler/Drag.html</li>
+    <li>Handler/Pinch.html</li>
     <li>Handler/Feature.html</li>
     <li>Handler/Hover.html</li>
     <li>Handler/Keyboard.html</li>

Modified: sandbox/bartvde/sencha/openlayers/tests/run-tests.html
===================================================================
--- sandbox/bartvde/sencha/openlayers/tests/run-tests.html	2011-02-24 10:08:20 UTC (rev 11390)
+++ sandbox/bartvde/sencha/openlayers/tests/run-tests.html	2011-02-24 10:17:43 UTC (rev 11391)
@@ -686,7 +686,7 @@
 		timeout_seconds=4;
 	}
 	var no_close=document.getElementById( "dont_close_test_windows" );
-	var action={ action_kind: "window", wnd_url: url.toString(), wnd_wnd: null, wnd_fn: fn, wnd_timeout_milliseconds: timeout_seconds*1000, wnd_no_close: no_close.checked };
+	var action={ action_kind: "window", wnd_url: url.toString() + (window.location.search || ""), wnd_wnd: null, wnd_fn: fn, wnd_timeout_milliseconds: timeout_seconds*1000, wnd_no_close: no_close.checked };
 	this.delay_total_milliseconds_left+=Test.AnotherWay._action_estimate_milliseconds( action );
 	this.delay_actions.push( action );
 }



More information about the Commits mailing list