OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../../resources/js-test.js"></script> | 2 <script src="../../../resources/js-test.js"></script> |
3 | 3 |
4 <script> | 4 <script> |
5 | 5 |
6 description("This tests the constructor for the PointerEvent DOM class."); | 6 description("This tests the constructor for the PointerEvent DOM class."); |
7 | 7 |
8 debug("--- tests for intrinsic attributes plus screen & client coordinates ---")
; | 8 debug("--- tests for intrinsic attributes plus screen & client coordinates ---")
; |
9 | 9 |
10 ["pointerId", "tiltX", "tiltY"].forEach(function (attr) { | 10 ["pointerId", "tiltX", "tiltY"].forEach(function (attr) { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 shouldBeNull("new PointerEvent('eventType').view"); | 73 shouldBeNull("new PointerEvent('eventType').view"); |
74 shouldBeZero("new PointerEvent('eventType').detail"); | 74 shouldBeZero("new PointerEvent('eventType').detail"); |
75 shouldBeFalse("new PointerEvent('eventType').ctrlKey"); | 75 shouldBeFalse("new PointerEvent('eventType').ctrlKey"); |
76 shouldBeFalse("new PointerEvent('eventType').shiftKey"); | 76 shouldBeFalse("new PointerEvent('eventType').shiftKey"); |
77 shouldBeFalse("new PointerEvent('eventType').altKey"); | 77 shouldBeFalse("new PointerEvent('eventType').altKey"); |
78 shouldBeFalse("new PointerEvent('eventType').metaKey"); | 78 shouldBeFalse("new PointerEvent('eventType').metaKey"); |
79 shouldBeZero("new PointerEvent('eventType').button"); | 79 shouldBeZero("new PointerEvent('eventType').button"); |
80 shouldBeZero("new PointerEvent('eventType').buttons"); | 80 shouldBeZero("new PointerEvent('eventType').buttons"); |
81 shouldBeNull("new PointerEvent('eventType').relatedTarget"); | 81 shouldBeNull("new PointerEvent('eventType').relatedTarget"); |
82 | 82 |
| 83 debug("--- tests for coalesced events ---"); |
| 84 var coalescedEvents = [ |
| 85 new PointerEvent('eventType', { 'pressure' : 1, pointerId : 2 }), |
| 86 new PointerEvent('eventType', { 'pressure' : 0.5, pointerId : 2 }), |
| 87 ]; |
| 88 var pe = new PointerEvent('eventType', {'coalescedEvents': coalescedEvents, 'pre
ssure' : 0.1, pointerId : 1 }); |
| 89 shouldBeEqualToNumber("pe.getCoalescedEvents().length", coalescedEvents.length); |
| 90 |
| 91 shouldBeCloseTo("pe.pressure", 0.1, 0.00001); |
| 92 shouldBeCloseTo("pe.getCoalescedEvents()[0].pressure", 1, 0.00001); |
| 93 shouldBeCloseTo("pe.getCoalescedEvents()[1].pressure", 0.5, 0.00001); |
| 94 |
| 95 shouldBeEqualToNumber("pe.pointerId", 1); |
| 96 shouldBeEqualToNumber("pe.getCoalescedEvents()[0].pointerId", 2); |
| 97 shouldBeEqualToNumber("pe.getCoalescedEvents()[1].pointerId", 2); |
| 98 |
| 99 |
83 </script> | 100 </script> |
OLD | NEW |