Index: LayoutTests/fast/events/pointerevents/touch-pointer-event-properties.html |
diff --git a/LayoutTests/fast/events/pointerevents/touch-pointer-event-properties.html b/LayoutTests/fast/events/pointerevents/touch-pointer-event-properties.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0019648021f61dff0fd719ae86a1e07f7b70ae59 |
--- /dev/null |
+++ b/LayoutTests/fast/events/pointerevents/touch-pointer-event-properties.html |
@@ -0,0 +1,62 @@ |
+<!DOCTYPE html> |
+<script src="../../../resources/testharness.js"></script> |
+<script src="../../../resources/testharnessreport.js"></script> |
+<h1>Test that pointer properties propagates from touches to PointerEvents</h1> |
+<div id="target0" style="height: 100px;"></div> |
+<script> |
+async_test(function() { |
+ if (!window.eventSender) { |
+ this.done(); |
+ return; |
+ } |
+ var POINTER_PROPERTIES = [ |
+ { width: 1.125, height: 1.25, pressure: .1875, tiltX: 0, tiltY: 0, isPrimary: true }, |
+ { width: 2.125, height: 2.25, pressure: .2500, tiltX: 25, tiltY: 26, isPrimary: false }, |
+ { width: 3.125, height: 3.25, pressure: .3125, tiltX: 0, tiltY: 0, isPrimary: false }, |
+ { width: 4.125, height: 4.25, pressure: .4375, tiltX: 0, tiltY: 0, isPrimary: false } |
+ ]; |
+ var receivedPointerEvents = []; |
+ var target0 = document.getElementById("target0"); |
+ function checkPointerEvent(event) { |
+ receivedPointerEvents.push(event); |
+ test(function() { |
+ assert_between_inclusive(event.pointerId, 0, POINTER_PROPERTIES.length - 1); |
+ var pp = POINTER_PROPERTIES[event.pointerId]; |
+ for ( var i in pp ) |
+ assert_equals(event[i], pp[i], "" + i); |
+ }, "Pointer event properties for pointer " + event.pointerId + " on " + event.type); |
+ } |
+ on_event(target0, "pointerdown", this.step_func(checkPointerEvent)); |
+ on_event(target0, "pointermove", this.step_func(checkPointerEvent)); |
+ on_event(target0, "pointerup", this.step_func(checkPointerEvent)); |
+ on_event(window, "load", this.step_func_done(function() { |
+ assert_not_equals(window.PointerEvent, undefined, "window.PointerEvent"); |
+ var x = target0.offsetLeft + 2; |
+ var y = target0.offsetTop + 2; |
+ |
+ for ( var i = 0 ; i < POINTER_PROPERTIES.length ; ++i ) { |
+ var pp = POINTER_PROPERTIES[i]; |
+ eventSender.addTouchPoint(x + i, y + i, pp["width"], pp["height"], pp["pressure"], pp["tiltX"], pp["tiltY"], "pen"); |
+ } |
+ eventSender.touchStart(); |
+ |
+ for ( var i = 0 ; i < POINTER_PROPERTIES.length ; ++i ) { |
+ var pp = POINTER_PROPERTIES[i]; |
+ eventSender.updateTouchPoint(i, x + i + 20, y + i + 20); |
+ } |
+ |
+ eventSender.touchMove(); |
+ for ( var i = 0 ; i < POINTER_PROPERTIES.length ; ++i ) |
+ eventSender.releaseTouchPoint(i); |
+ eventSender.touchEnd(); |
+ |
+ test(function() { |
+ assert_array_equals( |
+ receivedPointerEvents.map(function(event) { return event.type; }), |
+ ["pointerdown", "pointerdown", "pointerdown", "pointerdown", |
+ "pointermove", "pointermove", "pointermove", "pointermove", |
+ "pointerup", "pointerup", "pointerup", "pointerup"]); |
+ }, "Received pointer events"); |
+ })); |
+}, "Pointer property propagation from touches to PointerEvents"); |
+</script> |