OLD | NEW |
1 var div = document.createElement("div"); | 1 var div = document.createElement("div"); |
2 div.id = "touchtarget"; | 2 div.id = "touchtarget"; |
3 div.style.width = "100px"; | 3 div.style.width = "100px"; |
4 div.style.height = "100px"; | 4 div.style.height = "100px"; |
5 div.style.backgroundColor = "blue"; | 5 div.style.backgroundColor = "blue"; |
6 | 6 |
7 var lastEvent = null; | 7 var lastEvent = null; |
8 var touchEventsReceived = 0; | 8 var touchEventsReceived = 0; |
9 var EXPECTED_TOUCH_EVENTS_TOTAL = 4; | 9 var EXPECTED_TOUCH_EVENTS_TOTAL = 4; |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 div.addEventListener("touchmove", touchEventCallback, false); | 29 div.addEventListener("touchmove", touchEventCallback, false); |
30 div.addEventListener("touchend", touchEventCallback, false); | 30 div.addEventListener("touchend", touchEventCallback, false); |
31 document.body.insertBefore(div, document.body.firstChild); | 31 document.body.insertBefore(div, document.body.firstChild); |
32 | 32 |
33 function verifyTouchEvent(type, totalTouchCount, changedTouchCount, targetTouchC
ount) | 33 function verifyTouchEvent(type, totalTouchCount, changedTouchCount, targetTouchC
ount) |
34 { | 34 { |
35 shouldBeEqualToString("lastEvent.type", type); | 35 shouldBeEqualToString("lastEvent.type", type); |
36 shouldBe("lastEvent.touches.length", totalTouchCount.toString()); | 36 shouldBe("lastEvent.touches.length", totalTouchCount.toString()); |
37 shouldBe("lastEvent.changedTouches.length", changedTouchCount.toString()); | 37 shouldBe("lastEvent.changedTouches.length", changedTouchCount.toString()); |
38 shouldBe("lastEvent.targetTouches.length", targetTouchCount.toString()); | 38 shouldBe("lastEvent.targetTouches.length", targetTouchCount.toString()); |
39 shouldBe("lastEvent.pageX", "0"); | |
40 shouldBe("lastEvent.pageY", "0"); | |
41 } | 39 } |
42 | 40 |
43 function verifyTouchPoint(list, point, x, y, id) | 41 function verifyTouchPoint(list, point, x, y, id) |
44 { | 42 { |
45 shouldBe("lastEvent." + list + "[" + point + "].pageX", x.toString()); | 43 shouldBe("lastEvent." + list + "[" + point + "].pageX", x.toString()); |
46 shouldBe("lastEvent." + list + "[" + point + "].pageY", y.toString()); | 44 shouldBe("lastEvent." + list + "[" + point + "].pageY", y.toString()); |
47 shouldBe("lastEvent." + list + "[" + point + "].clientX", x.toString()); | 45 shouldBe("lastEvent." + list + "[" + point + "].clientX", x.toString()); |
48 shouldBe("lastEvent." + list + "[" + point + "].clientY", y.toString()); | 46 shouldBe("lastEvent." + list + "[" + point + "].clientY", y.toString()); |
49 shouldBe("lastEvent." + list + "[" + point + "].identifier", id.toString()); | 47 shouldBe("lastEvent." + list + "[" + point + "].identifier", id.toString()); |
50 } | 48 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 103 |
106 if (window.eventSender) { | 104 if (window.eventSender) { |
107 description("This tests basic multi touch event support."); | 105 description("This tests basic multi touch event support."); |
108 | 106 |
109 lastEvent = null; | 107 lastEvent = null; |
110 eventSender.clearTouchPoints(); | 108 eventSender.clearTouchPoints(); |
111 multiTouchSequence(); | 109 multiTouchSequence(); |
112 } else { | 110 } else { |
113 debug("This test requires DumpRenderTree. Tap on the blue rect to log.") | 111 debug("This test requires DumpRenderTree. Tap on the blue rect to log.") |
114 } | 112 } |
OLD | NEW |