OLD | NEW |
1 description("This tests support for the document.createTouch API."); | 1 description("This tests support for the document.createTouch API."); |
2 | 2 |
3 shouldBeTrue('"createTouch" in document'); | 3 shouldBeTrue('"createTouch" in document'); |
4 | 4 |
5 var box = document.createElement("div"); | 5 var box = document.createElement("div"); |
6 box.id = "box"; | 6 box.id = "box"; |
7 box.style.width = "100px"; | 7 box.style.width = "100px"; |
8 box.style.height = "100px"; | 8 box.style.height = "100px"; |
9 document.body.appendChild(box); | 9 document.body.appendChild(box); |
10 | 10 |
11 var target = document.getElementById("box"); | 11 var target = document.getElementById("box"); |
12 var touch = document.createTouch(window, target, 1, 100, 101, 102, 103, 5, 3, 10
, 10); | 12 var touch = document.createTouch(window, target, 1, 100, 101, 102, 103, 5, 3, 10
, 10, 45, 60); |
13 shouldBeNonNull("touch"); | 13 shouldBeNonNull("touch"); |
14 shouldBe("touch.target", "box"); | 14 shouldBe("touch.target", "box"); |
15 shouldBe("touch.identifier", "1"); | 15 shouldBe("touch.identifier", "1"); |
16 shouldBe("touch.pageX", "100"); | 16 shouldBe("touch.pageX", "100"); |
17 shouldBe("touch.pageY", "101"); | 17 shouldBe("touch.pageY", "101"); |
18 shouldBe("touch.screenX", "102"); | 18 shouldBe("touch.screenX", "102"); |
19 shouldBe("touch.screenY", "103"); | 19 shouldBe("touch.screenY", "103"); |
20 shouldBe("touch.radiusX", "5"); | 20 shouldBe("touch.radiusX", "5"); |
21 shouldBe("touch.radiusY", "3"); | 21 shouldBe("touch.radiusY", "3"); |
22 shouldBe("touch.force", "10"); | 22 shouldBe("touch.force", "10"); |
23 shouldBe("touch.webkitRadiusX", "5"); | 23 shouldBe("touch.webkitRadiusX", "5"); |
24 shouldBe("touch.webkitRadiusY", "3"); | 24 shouldBe("touch.webkitRadiusY", "3"); |
25 shouldBe("touch.webkitRotationAngle", "10"); | 25 shouldBe("touch.webkitRotationAngle", "10"); |
26 shouldBe("touch.webkitForce", "10"); | 26 shouldBe("touch.webkitForce", "10"); |
| 27 shouldBe("touch.tilt", "45"); |
| 28 shouldBe("touch.tiltDirection", "60"); |
27 | 29 |
28 var emptyTouch = document.createTouch(); | 30 var emptyTouch = document.createTouch(); |
29 shouldBeNonNull("emptyTouch"); | 31 shouldBeNonNull("emptyTouch"); |
30 shouldBeNull("emptyTouch.target"); | 32 shouldBeNull("emptyTouch.target"); |
31 shouldBe("emptyTouch.identifier", "0"); | 33 shouldBe("emptyTouch.identifier", "0"); |
32 shouldBe("emptyTouch.pageX", "0"); | 34 shouldBe("emptyTouch.pageX", "0"); |
33 shouldBe("emptyTouch.pageY", "0"); | 35 shouldBe("emptyTouch.pageY", "0"); |
34 shouldBe("emptyTouch.screenX", "0"); | 36 shouldBe("emptyTouch.screenX", "0"); |
35 shouldBe("emptyTouch.screenY", "0"); | 37 shouldBe("emptyTouch.screenY", "0"); |
36 shouldBe("emptyTouch.radiusX", "0"); | 38 shouldBe("emptyTouch.radiusX", "0"); |
37 shouldBe("emptyTouch.radiusY", "0"); | 39 shouldBe("emptyTouch.radiusY", "0"); |
38 shouldBeNaN("emptyTouch.force"); | 40 shouldBeNaN("emptyTouch.force"); |
39 shouldBe("emptyTouch.webkitRadiusX", "0"); | 41 shouldBe("emptyTouch.webkitRadiusX", "0"); |
40 shouldBe("emptyTouch.webkitRadiusY", "0"); | 42 shouldBe("emptyTouch.webkitRadiusY", "0"); |
41 shouldBeNaN("emptyTouch.webkitRotationAngle"); | 43 shouldBeNaN("emptyTouch.webkitRotationAngle"); |
42 shouldBeNaN("emptyTouch.webkitForce"); | 44 shouldBeNaN("emptyTouch.webkitForce"); |
| 45 shouldBeNaN("emptyTouch.tilt"); |
| 46 shouldBeNaN("emptyTouch.tiltDirection"); |
43 | 47 |
44 // Try invoking with incorrect parameter types. | 48 // Try invoking with incorrect parameter types. |
45 var badParamsTouch = document.createTouch(function(x) { return x; }, 12, 'a', 'b
', 'c', function(x) { return x; }, 104, 'a', 'b', 'c', 'd'); | 49 var badParamsTouch = document.createTouch(function(x) { return x; }, 12, 'a', 'b
', 'c', function(x) { return x; }, 104, 'a', 'b', 'c', 'd', 'e', 'f'); |
46 shouldBeNonNull("badParamsTouch"); | 50 shouldBeNonNull("badParamsTouch"); |
47 shouldBeNull("badParamsTouch.target"); | 51 shouldBeNull("badParamsTouch.target"); |
48 shouldBe("badParamsTouch.identifier", "0"); | 52 shouldBe("badParamsTouch.identifier", "0"); |
49 shouldBe("badParamsTouch.pageX", "0"); | 53 shouldBe("badParamsTouch.pageX", "0"); |
50 shouldBe("badParamsTouch.pageY", "0"); | 54 shouldBe("badParamsTouch.pageY", "0"); |
51 shouldBe("badParamsTouch.screenX", "0"); | 55 shouldBe("badParamsTouch.screenX", "0"); |
52 shouldBe("badParamsTouch.screenY", "104"); | 56 shouldBe("badParamsTouch.screenY", "104"); |
53 shouldBe("badParamsTouch.radiusX", "0"); | 57 shouldBe("badParamsTouch.radiusX", "0"); |
54 shouldBe("badParamsTouch.radiusY", "0"); | 58 shouldBe("badParamsTouch.radiusY", "0"); |
55 shouldBeNaN("badParamsTouch.force"); | 59 shouldBeNaN("badParamsTouch.force"); |
56 shouldBe("badParamsTouch.webkitRadiusX", "0"); | 60 shouldBe("badParamsTouch.webkitRadiusX", "0"); |
57 shouldBe("badParamsTouch.webkitRadiusY", "0"); | 61 shouldBe("badParamsTouch.webkitRadiusY", "0"); |
58 shouldBeNaN("badParamsTouch.webkitRotationAngle"); | 62 shouldBeNaN("badParamsTouch.webkitRotationAngle"); |
59 shouldBeNaN("badParamsTouch.webkitForce"); | 63 shouldBeNaN("badParamsTouch.webkitForce"); |
| 64 shouldBeNaN("badParamsTouch.tilt"); |
| 65 shouldBeNaN("badParamsTouch.tiltDirection"); |
60 | 66 |
61 // Should not crash when invoked on a detached Document. | 67 // Should not crash when invoked on a detached Document. |
62 var detachedTouch; | 68 var detachedTouch; |
63 shouldBeNonNull("detachedTouch = document.implementation.createDocument('a', 'b'
).createTouch()"); | 69 shouldBeNonNull("detachedTouch = document.implementation.createDocument('a', 'b'
).createTouch()"); |
64 shouldBeNull("detachedTouch.target"); | 70 shouldBeNull("detachedTouch.target"); |
65 shouldBe("detachedTouch.identifier", "0"); | 71 shouldBe("detachedTouch.identifier", "0"); |
66 shouldBe("detachedTouch.pageX", "0"); | 72 shouldBe("detachedTouch.pageX", "0"); |
67 shouldBe("detachedTouch.pageY", "0"); | 73 shouldBe("detachedTouch.pageY", "0"); |
68 shouldBe("detachedTouch.screenX", "0"); | 74 shouldBe("detachedTouch.screenX", "0"); |
69 shouldBe("detachedTouch.screenY", "0"); | 75 shouldBe("detachedTouch.screenY", "0"); |
70 shouldBe("detachedTouch.radiusX", "0"); | 76 shouldBe("detachedTouch.radiusX", "0"); |
71 shouldBe("detachedTouch.radiusY", "0"); | 77 shouldBe("detachedTouch.radiusY", "0"); |
72 shouldBeNaN("detachedTouch.force"); | 78 shouldBeNaN("detachedTouch.force"); |
73 shouldBe("detachedTouch.webkitRadiusX", "0"); | 79 shouldBe("detachedTouch.webkitRadiusX", "0"); |
74 shouldBe("detachedTouch.webkitRadiusY", "0"); | 80 shouldBe("detachedTouch.webkitRadiusY", "0"); |
75 shouldBeNaN("detachedTouch.webkitRotationAngle"); | 81 shouldBeNaN("detachedTouch.webkitRotationAngle"); |
76 shouldBeNaN("detachedTouch.webkitForce"); | 82 shouldBeNaN("detachedTouch.webkitForce"); |
| 83 shouldBeNaN("detachedTouch.tilt"); |
| 84 shouldBeNaN("detachedTouch.tiltDirection"); |
77 | 85 |
78 isSuccessfullyParsed(); | 86 isSuccessfullyParsed(); |
OLD | NEW |