|
1 <html> |
|
2 <!-- |
|
3 https://bugzilla.mozilla.org/show_bug.cgi?id=470212 |
|
4 --> |
|
5 <head> |
|
6 <title>Test for Bug 470212 - crash [@ nsContentUtils::ComparePoints]</title> |
|
7 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
8 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
9 </head> |
|
10 <body> |
|
11 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=470212">Mozilla Bug 470212</a> |
|
12 <div style="width: 200px;"> |
|
13 <ca> |
|
14 <canvas style="border: 1px solid black;" id="dragSource"></canvas> |
|
15 </ca> |
|
16 </div> |
|
17 |
|
18 <pre id="test"> |
|
19 <script> |
|
20 function doShiftDrag(){ |
|
21 setTimeout(function() { |
|
22 var wu = SpecialPowers.DOMWindowUtils; |
|
23 var canvas = document.getElementById("dragSource"); |
|
24 var canvasRect = canvas.getBoundingClientRect(); |
|
25 |
|
26 // Drag canvas element starts with a mouse down event, combine with shift |
|
27 // key, follows by two mouse move events. |
|
28 |
|
29 // Press on left-top corner of the canvas element. |
|
30 wu.sendMouseEvent('mousedown', canvasRect.left, canvasRect.top, 0, 1, 4); |
|
31 // Move to the center of this cavas element. |
|
32 wu.sendMouseEvent('mousemove', canvasRect.left + (canvasRect.width / 2), |
|
33 canvasRect.top + (canvasRect.height / 2), 0, 0, 4); |
|
34 // move out of cavas's region. |
|
35 wu.sendMouseEvent('mousemove', canvasRect.left + (canvasRect.width / 2), |
|
36 canvasRect.bottom + 10, 0, 0, 4); |
|
37 |
|
38 is(window.getSelection().rangeCount, 0, "rangeCount should be 0"); |
|
39 |
|
40 wu.sendMouseEvent('mouseup', canvasRect.left + (canvasRect.width / 2), |
|
41 canvasRect.bottom + 10, 0, 0, 4); |
|
42 |
|
43 SimpleTest.finish(); |
|
44 }, 0); |
|
45 } |
|
46 |
|
47 SimpleTest.waitForExplicitFinish(); |
|
48 addLoadEvent(doShiftDrag); |
|
49 </script> |
|
50 |
|
51 </pre> |
|
52 </body> |
|
53 </html> |