[OpenLayers-Commits] r11227 - trunk/openlayers/tests

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Tue Feb 22 06:44:36 EST 2011


Author: erilem
Date: 2011-02-22 03:44:36 -0800 (Tue, 22 Feb 2011)
New Revision: 11227

Modified:
   trunk/openlayers/tests/Events.html
Log:
test that we set clientX and clientY in the event, test-only patch

Modified: trunk/openlayers/tests/Events.html
===================================================================
--- trunk/openlayers/tests/Events.html	2011-02-22 11:21:20 UTC (rev 11226)
+++ trunk/openlayers/tests/Events.html	2011-02-22 11:44:36 UTC (rev 11227)
@@ -305,9 +305,23 @@
         events.unregister("something", instance, listener1);
         events.unregister("something", instance, listener2);
         events.unregister("something", instance, listener3);
-        
     }
 
+    function test_Events_handleBrowserEvent(t) {
+        t.plan(2);
+        var events = new OpenLayers.Events({}, null, ['sometouchevent']);
+        events.on({'sometouchevent': function() {}});
+
+        // this test verifies that when handling a touch event we correctly
+        // set clientX and clientY in the event object 
+        var evt = {type: 'sometouchevent',
+                   touches: [{clientX: 1, clientY: 1}, {clientX: 2, clientY: 2}]
+                  };
+        events.handleBrowserEvent(evt);
+        t.eq(evt.clientX, 1, "evt.clientX value is correct");
+        t.eq(evt.clientY, 1, "evt.clientY value is correct");
+    }
+
     function test_Events_destroy (t) {
         t.plan(2);
 



More information about the Commits mailing list