Bug 1055040 - Send mouse events base on canvas position and enable this test case on all B2G builds. r=ehsan

This commit is contained in:
C.J. Ku 2014-08-19 19:38:00 -04:00
parent b72e1de49b
commit 008a7c29c3
2 changed files with 18 additions and 6 deletions

View File

@ -53,7 +53,6 @@ support-files = file_bug449653_1.html file_bug449653_1_ref.html
[test_bug460532.html]
[test_bug468167.html]
[test_bug470212.html]
skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) # b2g-debug(shift mouse select not working in b2g) b2g-desktop(shift mouse select not working in b2g)
[test_bug488417.html]
skip-if = true # Bug 489560
[test_bug496275.html]

View File

@ -11,7 +11,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=470212
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=470212">Mozilla Bug 470212</a>
<div style="width: 200px;">
<ca>
<canvas style="border: 1px solid black;"></canvas>
<canvas style="border: 1px solid black;" id="dragSource"></canvas>
</ca>
</div>
@ -20,12 +20,25 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=470212
function doShiftDrag(){
setTimeout(function() {
var wu = SpecialPowers.DOMWindowUtils;
wu.sendMouseEvent('mousedown', 0, 0, 0, 1, 4);
wu.sendMouseEvent('mousemove', 60, 10, 0, 0, 4);
wu.sendMouseEvent('mousemove', 70, 250, 0, 0, 4);
var canvas = document.getElementById("dragSource");
var canvasRect = canvas.getBoundingClientRect();
// Drag canvas element starts with a mouse down event, combine with shift
// key, follows by two mouse move events.
// Press on left-top corner of the canvas element.
wu.sendMouseEvent('mousedown', canvasRect.left, canvasRect.top, 0, 1, 4);
// Move to the center of this cavas element.
wu.sendMouseEvent('mousemove', canvasRect.left + (canvasRect.width / 2),
canvasRect.top + (canvasRect.height / 2), 0, 0, 4);
// move out of cavas's region.
wu.sendMouseEvent('mousemove', canvasRect.left + (canvasRect.width / 2),
canvasRect.bottom + 10, 0, 0, 4);
is(window.getSelection().rangeCount, 0, "rangeCount should be 0");
wu.sendMouseEvent('mouseup', 70, 250, 0, 0, 4);
wu.sendMouseEvent('mouseup', canvasRect.left + (canvasRect.width / 2),
canvasRect.bottom + 10, 0, 0, 4);
SimpleTest.finish();
}, 0);