Fix test for bug 392746 to work on Mac, and to work more robustly on Windows (and Linux?)

This commit is contained in:
uriber@gmail.com 2008-03-30 13:42:01 -07:00
Родитель e4af915e47
Коммит e2a382f366
1 изменённых файлов: 9 добавлений и 8 удалений

Просмотреть файл

@ -25,9 +25,10 @@ function ctrlselect(aX,aY, aX2, aY2) {
var wu = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils);
wu.sendMouseEvent('mousedown', aX, aY, 0, 1, 2);
wu.sendMouseEvent('mousemove', aX2, aY2, 0, 0, 2);
wu.sendMouseEvent('mouseup', aY2, aY2, 0, 1, 2);
var modifyers = (navigator.platform.indexOf("Mac") >= 0) ? 8 : 2;
wu.sendMouseEvent('mousedown', aX, aY, 0, 1, modifyers);
wu.sendMouseEvent('mousemove', aX2, aY2, 0, 0, modifyers);
wu.sendMouseEvent('mouseup', aY2, aY2, 0, 1, modifyers);
}
function test() {
@ -35,15 +36,15 @@ function ctrlselect(aX,aY, aX2, aY2) {
sel.removeAllRanges();
var a=document.getElementById('a').getBoundingClientRect();
ctrlselect(a.left, a.top, a.right-1, a.top);
ctrlselect(a.left, a.top+1, a.right-1, a.top+1);
var b=document.getElementById('b').getBoundingClientRect();
ctrlselect(b.left, b.top, b.right-1, b.top);
ctrlselect(b.left, b.top+1, b.right-1, b.top+1);
var c=document.getElementById('c').getBoundingClientRect();
ctrlselect(c.left, c.top, c.right-1, c.top);
ctrlselect(c.left, c.top+1, c.right-1, c.top+1);
var d=document.getElementById('d').getBoundingClientRect();
ctrlselect(d.left, d.top, d.right-1, d.top);
ctrlselect(d.left, d.top+1, d.right-1, d.top+1);
var e=document.getElementById('e').getBoundingClientRect();
ctrlselect(e.right-1, e.top, e.left, e.top);
ctrlselect(e.right-1, e.top+1, e.left+1, e.top+1);
ok(sel.getRangeAt(0).toString() == 'ddd text text ', 'First selection range should be "ddd text text "');
ok(sel.getRangeAt(1).toString() == 'ccc text', 'First selection range should be "ccc text"');