Index: LayoutTests/fast/events/touch/touch-tilt.html |
diff --git a/LayoutTests/fast/events/touch/touch-tilt.html b/LayoutTests/fast/events/touch/touch-tilt.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..72279052865f1c76617e9bb8ba0140f94978c7dd |
--- /dev/null |
+++ b/LayoutTests/fast/events/touch/touch-tilt.html |
@@ -0,0 +1,57 @@ |
+<script src="../../../resources/js-test.js"></script> |
+ |
+<p id="description"></p> |
+<div id="console"></div> |
+<script type="text/javascript"> |
+description('Test verifies tilt and tiltDirection can be plumbed through correctly via eventSender'); |
+ |
+var touch = null; |
+ |
+function onTouchEvent (event) { |
+ shouldBeNull('touch'); |
+ touch = event.touches[0]; |
+} |
+document.addEventListener('touchstart', onTouchEvent, false); |
+document.addEventListener('touchmove' , onTouchEvent, false); |
+ |
+if (window.eventSender) { |
+ eventSender.clearTouchPoints(); |
+ eventSender.addTouchPoint(100, 100); |
+ eventSender.touchStart(); |
+ touch = null; |
+ |
+ eventSender.updateTouchPoint(0, 110, 110); |
+ debug('Sending touchmove (1)'); |
+ eventSender.touchMove(); |
+ shouldBeNonNull('touch'); |
+ shouldBeNaN('touch.tilt'); |
+ shouldBeNaN('touch.tiltDirection'); |
+ touch = null; |
+ |
+ eventSender.clearTouchPoints(); |
+ eventSender.touchEnd(); |
+ eventSender.addTouchPoint(100, 100); |
+ if (eventSender.setTouchPointTilt) |
+ eventSender.setTouchPointTilt(0, 15, 30, false); |
+ eventSender.touchStart(); |
+ if (eventSender.setTouchPointTilt) { |
+ shouldBe('touch.tilt', '15'); |
+ shouldBe('touch.tiltDirection', '30'); |
+ } |
+ touch = null; |
+ |
+ if (eventSender.setTouchPointTilt) |
+ eventSender.setTouchPointTilt(0, 45, 60, true); |
+ debug('Sending touchmove (2)'); |
+ eventSender.touchMove(); |
+ shouldBeNonNull('touch'); |
+ if (eventSender.setTouchPointTilt) { |
+ shouldBe('touch.tilt', '45'); |
+ shouldBe('touch.tiltDirection', '60'); |
+ } |
+ touch = null; |
+} else { |
+ debug('This test requires --dump-render-tree.'); |
+} |
+ |
+</script> |