layout/generic/test/test_bug470212.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/generic/test/test_bug470212.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,53 @@
     1.4 +<html>
     1.5 +<!--
     1.6 +https://bugzilla.mozilla.org/show_bug.cgi?id=470212
     1.7 +-->
     1.8 +<head>
     1.9 +  <title>Test for Bug 470212 -  crash [@ nsContentUtils::ComparePoints]</title>
    1.10 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.11 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.12 +</head>
    1.13 +<body>
    1.14 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=470212">Mozilla Bug 470212</a>
    1.15 +<div style="width: 200px;">
    1.16 +<ca>
    1.17 +<canvas style="border: 1px solid black;" id="dragSource"></canvas>
    1.18 +</ca>
    1.19 +</div>
    1.20 +
    1.21 +<pre id="test">
    1.22 +<script>
    1.23 +function doShiftDrag(){
    1.24 +  setTimeout(function() {
    1.25 +    var wu = SpecialPowers.DOMWindowUtils;
    1.26 +    var canvas = document.getElementById("dragSource");
    1.27 +    var canvasRect = canvas.getBoundingClientRect();
    1.28 +
    1.29 +    // Drag canvas element starts with a mouse down event, combine with shift
    1.30 +    // key, follows by two mouse move events.
    1.31 +
    1.32 +    // Press on left-top corner of the canvas element.
    1.33 +    wu.sendMouseEvent('mousedown',  canvasRect.left, canvasRect.top, 0, 1, 4);
    1.34 +    // Move to the center of this cavas element.
    1.35 +    wu.sendMouseEvent('mousemove',  canvasRect.left + (canvasRect.width / 2),
    1.36 +                      canvasRect.top + (canvasRect.height / 2), 0, 0, 4);
    1.37 +    // move out of cavas's region.
    1.38 +    wu.sendMouseEvent('mousemove',  canvasRect.left + (canvasRect.width / 2),
    1.39 +                      canvasRect.bottom + 10, 0, 0, 4);
    1.40 +
    1.41 +    is(window.getSelection().rangeCount, 0, "rangeCount should be 0");
    1.42 +
    1.43 +    wu.sendMouseEvent('mouseup', canvasRect.left + (canvasRect.width / 2),
    1.44 +                      canvasRect.bottom + 10, 0, 0, 4);
    1.45 +
    1.46 +    SimpleTest.finish();
    1.47 +  }, 0);
    1.48 +}
    1.49 +
    1.50 +SimpleTest.waitForExplicitFinish();
    1.51 +addLoadEvent(doShiftDrag);
    1.52 +</script>
    1.53 +
    1.54 +</pre>
    1.55 +</body>
    1.56 +</html>

mercurial