1 <script src=
"../../../resources/js-test.js"></script>
6 outline:
1px solid black;
9 <div id=
"console"></div>
11 <div id=
"pusher">This box is here to create scrollbars.
</div>
15 var floatPrecision
= 0.00001;
17 function sendTouchStart(x
, y
)
19 if (window
.eventSender
) {
20 eventSender
.clearTouchPoints();
21 eventSender
.addTouchPoint(x
, y
);
22 eventSender
.touchStart();
28 if (window
.eventSender
) {
29 eventSender
.zoomPageIn();
33 function zoomPageOut()
35 if (window
.eventSender
) {
36 eventSender
.zoomPageOut();
40 function scrollPage(x
, y
)
42 window
.scrollTo(x
, y
);
45 if (window
.testRunner
) {
46 testRunner
.dumpAsText();
47 testRunner
.waitUntilDone();
55 shouldBe("event.touches[0].clientX", "100");
56 shouldBe("event.touches[0].clientY", "100");
57 shouldBe("event.touches[0].pageX", "100");
58 shouldBe("event.touches[0].pageY", "100");
61 window
.addEventListener("touchstart", base
, false);
63 sendTouchStart(100, 100);
64 window
.removeEventListener("touchstart", base
, false);
67 function justZoomed(e
)
70 debug("\nJust zoomed");
71 shouldBeCloseTo("event.touches[0].clientX", 83.33333, floatPrecision
);
72 shouldBeCloseTo("event.touches[0].clientY", 83.33333, floatPrecision
);
73 shouldBeCloseTo("event.touches[0].pageX", 83.33333, floatPrecision
);
74 shouldBeCloseTo("event.touches[0].pageY", 83.33333, floatPrecision
);
76 window
.addEventListener("touchstart", justZoomed
, false);
78 sendTouchStart(100, 100);
80 window
.removeEventListener("touchstart", justZoomed
, false);
83 function justScrolled(e
)
86 debug("\nJust scrolled");
87 shouldBe("event.touches[0].clientX", "100");
88 shouldBe("event.touches[0].clientY", "100");
89 shouldBe("event.touches[0].pageX", "150");
90 shouldBe("event.touches[0].pageY", "150");
92 window
.addEventListener("touchstart", justScrolled
, false);
94 sendTouchStart(100, 100);
96 window
.removeEventListener("touchstart", justScrolled
, false);
98 // Zoomed and scrolled.
99 function zoomedAndScrolled(e
)
102 debug("\nZoomed and scrolled");
103 shouldBeCloseTo("event.touches[0].clientX", 83.33333, floatPrecision
);
104 shouldBeCloseTo("event.touches[0].clientY", 83.33333, floatPrecision
);
105 shouldBeCloseTo("event.touches[0].pageX", 133.33333, floatPrecision
);
106 shouldBeCloseTo("event.touches[0].pageY", 133.33333, floatPrecision
);
108 window
.addEventListener("touchstart", zoomedAndScrolled
, false);
111 sendTouchStart(100, 100);
114 window
.removeEventListener("touchstart", zoomedAndScrolled
, false);
116 if (window
.eventSender
) {
117 eventSender
.touchEnd();
118 eventSender
.clearTouchPoints();
121 if (window
.testRunner
) {
122 var area
= document
.getElementById('testArea');
123 area
.parentNode
.removeChild(area
);
124 isSuccessfullyParsed();
125 testRunner
.notifyDone();