layout/generic/test/test_bug470212.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial