Reviewed by Adele.
[WebKit-https.git] / LayoutTests / fast / events / mousemove-after-drag-over-scrollbar.html
1 <html>
2     <head>
3         <script>
4             var box1Sum = 0;
5             var box2Sum = 0;
6
7             function test()
8             {
9                 if (window.layoutTestController) {
10                     layoutTestController.dumpAsText();
11                     var d1 = document.getElementById('d1');
12                     var d2 = document.getElementById('d2');
13                     eventSender.dragMode = false;
14                     var left = d1.offsetLeft + 10;
15                     var top = d1.offsetTop + 10;
16                     eventSender.mouseMoveTo(left, top);
17                     eventSender.mouseDown();
18                     left = d2.offsetLeft - 10;
19                     eventSender.mouseMoveTo(left, top);
20                     left += 20;
21                     eventSender.mouseMoveTo(left, top);
22                     eventSender.mouseMoveTo(left++, top);
23                     eventSender.mouseMoveTo(left++, top);
24                     eventSender.mouseMoveTo(left++, top);
25                     eventSender.mouseMoveTo(left++, top);
26                     eventSender.mouseMoveTo(left++, top);
27                     eventSender.mouseMoveTo(left++, top);
28                     eventSender.mouseUp();
29
30                     // We do not count mouse moves since Mac records a move for the mouseUp event and Windows does not
31                     // See <rdar://problem/5674087> mouseUp events send onmousemove events on Mac but not on Windows.
32                     if ((box1Sum == 2) && (box2Sum > 2))
33                         document.getElementById('console').appendChild(document.createTextNode('Test Succeeded!\n'));
34                     else
35                         document.getElementById('console').appendChild(document.createTextNode('Test Failed!\n'));
36                 }
37             }
38
39             function record(box)
40             {
41                 if (box == 1)
42                     box1Sum++;
43                 else if (box == 2)
44                     box2Sum++;
45             }
46         </script>
47     </head>
48     <body onload="test()">
49     This tests that we continue to get mouse events after dragging past a scrollbar.<br>
50     <div id="d1" style="height:120px; width:120px; overflow: auto; display: inline-block; background-color: red;" onmousemove="record(1)">Start a drag in this square, and drag past the scrollbar to the green square.  Start a drag in this square, and drag past the scrollbar to the green square.  </div>
51     <div id="d2" style="height:120px; width:120px; display: inline-block; background-color: green;" onmousemove="record(2)"></div><br><br>
52     <pre id="console"></pre>
53     </body>
54 </html>