OLD | NEW |
(Empty) | |
| 1 <script src="../../../resources/js-test.js"></script> |
| 2 |
| 3 <p id="description"></p> |
| 4 <div id="console"></div> |
| 5 <script type="text/javascript"> |
| 6 description('Test verifies tilt and tiltDirection can be plumbed through correct
ly via eventSender'); |
| 7 |
| 8 var touch = null; |
| 9 |
| 10 function onTouchEvent (event) { |
| 11 shouldBeNull('touch'); |
| 12 touch = event.touches[0]; |
| 13 } |
| 14 document.addEventListener('touchstart', onTouchEvent, false); |
| 15 document.addEventListener('touchmove' , onTouchEvent, false); |
| 16 |
| 17 if (window.eventSender) { |
| 18 eventSender.clearTouchPoints(); |
| 19 eventSender.addTouchPoint(100, 100); |
| 20 eventSender.touchStart(); |
| 21 touch = null; |
| 22 |
| 23 eventSender.updateTouchPoint(0, 110, 110); |
| 24 debug('Sending touchmove (1)'); |
| 25 eventSender.touchMove(); |
| 26 shouldBeNonNull('touch'); |
| 27 shouldBeNaN('touch.tilt'); |
| 28 shouldBeNaN('touch.tiltDirection'); |
| 29 touch = null; |
| 30 |
| 31 eventSender.clearTouchPoints(); |
| 32 eventSender.touchEnd(); |
| 33 eventSender.addTouchPoint(100, 100); |
| 34 if (eventSender.setTouchPointTilt) |
| 35 eventSender.setTouchPointTilt(0, 15, 30, false); |
| 36 eventSender.touchStart(); |
| 37 if (eventSender.setTouchPointTilt) { |
| 38 shouldBe('touch.tilt', '15'); |
| 39 shouldBe('touch.tiltDirection', '30'); |
| 40 } |
| 41 touch = null; |
| 42 |
| 43 if (eventSender.setTouchPointTilt) |
| 44 eventSender.setTouchPointTilt(0, 45, 60, true); |
| 45 debug('Sending touchmove (2)'); |
| 46 eventSender.touchMove(); |
| 47 shouldBeNonNull('touch'); |
| 48 if (eventSender.setTouchPointTilt) { |
| 49 shouldBe('touch.tilt', '45'); |
| 50 shouldBe('touch.tiltDirection', '60'); |
| 51 } |
| 52 touch = null; |
| 53 } else { |
| 54 debug('This test requires --dump-render-tree.'); |
| 55 } |
| 56 |
| 57 </script> |
OLD | NEW |