1 <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML//EN">
4 <script src=
"../../../../resources/js-test.js"></script>
5 <style type=
"text/css">
7 background-color: #ccc;
12 ::-webkit-scrollbar-button
{
16 ::-webkit-scrollbar-thumb
{
17 background-color: #777;
34 <body onload=
"runTest();">
39 <div id=
"console"></div>
41 <script type=
"text/javascript">
45 function scrollTest() {
46 movingDiv
= document
.getElementById('scrollable');
48 // Ensure the div is a target for touch adjustment.
49 movingDiv
.addEventListener('click', function() {});
51 var scrollbarX
= movingDiv
.offsetLeft
+ movingDiv
.offsetWidth
- 5;
52 var scrollThumbSafeOffset
= 80;
53 var scrollbarY
= movingDiv
.offsetTop
+ scrollThumbSafeOffset
;
55 // Ensure we use a touch with an area to test under touch adjustment
59 shouldBe('movingDiv.scrollTop', '0');
60 eventSender
.gestureTapDown(scrollbarX
, scrollbarY
, touchWidth
, touchHeight
);
61 eventSender
.gestureShowPress(scrollbarX
, scrollbarY
, touchWidth
, touchHeight
);
62 eventSender
.gestureScrollBegin(scrollbarX
+ 20, scrollbarY
, touchWidth
, touchHeight
);
63 eventSender
.gestureTapCancel(scrollbarX
, scrollbarY
);
64 shouldBe('movingDiv.scrollTop', '0');
65 eventSender
.gestureScrollUpdate(0, 20);
66 shouldBeGreaterThanOrEqual('movingDiv.scrollTop', '20');
67 eventSender
.gestureScrollUpdate(0, 60);
68 shouldBeGreaterThanOrEqual('movingDiv.scrollTop', '85');
69 eventSender
.gestureScrollEnd(0, 0);
70 shouldBeGreaterThanOrEqual('movingDiv.scrollTop', '85');
72 // Test horizontal scrollbar too
73 scrollbarY
= movingDiv
.offsetTop
+ movingDiv
.offsetHeight
- 5;
74 scrollbarX
= movingDiv
.offsetLeft
+ scrollThumbSafeOffset
;
75 shouldBe('movingDiv.scrollLeft', '0');
76 eventSender
.gestureTapDown(scrollbarX
, scrollbarY
, touchWidth
, touchHeight
);
77 eventSender
.gestureShowPress(scrollbarX
, scrollbarY
, touchWidth
, touchHeight
);
78 eventSender
.gestureScrollBegin(scrollbarX
, scrollbarY
+ 20, touchWidth
, touchHeight
);
79 eventSender
.gestureTapCancel(scrollbarX
, scrollbarY
);
80 shouldBe('movingDiv.scrollLeft', '0');
81 eventSender
.gestureScrollUpdate(20, 0);
82 shouldBeGreaterThanOrEqual('movingDiv.scrollLeft', '20');
83 eventSender
.gestureScrollUpdate(60, 0);
84 shouldBeGreaterThanOrEqual('movingDiv.scrollLeft', '85');
85 eventSender
.gestureScrollEnd(0, 0);
86 shouldBeGreaterThanOrEqual('movingDiv.scrollLeft', '85');
88 // If we've got here, we've passed.
89 isSuccessfullyParsed();
92 function exitIfNecessary()
94 debug('Gesture events not implemented on this platform or broken');
95 isSuccessfullyParsed();
100 internals
.settings
.setMockScrollbarsEnabled(true);
102 if (window
.testRunner
)
103 window
.testRunner
.dumpAsText();
105 if (window
.eventSender
) {
106 description('This tests scroll gesture events on a scroll bar. ' +
107 'The scrollable div below should be slightly scrolled down ' +
110 if (eventSender
.clearTouchPoints
)
115 debug("This test requires DumpRenderTree.");