b=756425; fix test_mousescroll by driving RefreshDriver directly; r=ehsan

This commit is contained in:
Vladimir Vukicevic 2012-10-02 14:41:04 -04:00
parent 52a04c8b93
commit 87a3ae6152

View File

@ -135,6 +135,9 @@ function testRichListbox(id, andThen)
var listbox = document.getElementById(id);
var tests = [];
var winUtils = SpecialPowers.getDOMWindowUtils(window);
winUtils.advanceTimeAndRefresh(100);
function helper()
{
var [aStart, aDelta, aIntDelta, aDeltaMode] = tests[0];
@ -143,31 +146,37 @@ function testRichListbox(id, andThen)
synthesizeWheel(listbox, 10, 10,
{ deltaMode: aDeltaMode, deltaY: aDelta,
lineOrPageDeltaY: aIntDelta });
setTimeout(function() {
var change = listbox.getIndexOfFirstVisibleRow() - aStart;
var direction = (change > 0) - (change < 0);
var expected = (aDelta > 0) - (aDelta < 0);
is(direction, expected,
"testRichListbox(" + id + "): vertical, starting " + aStart +
winUtils.advanceTimeAndRefresh(100);
var change = listbox.getIndexOfFirstVisibleRow() - aStart;
var direction = (change > 0) - (change < 0);
var expected = (aDelta > 0) - (aDelta < 0);
is(direction, expected,
"testRichListbox(" + id + "): vertical, starting " + aStart +
" delta " + aDelta + " lineOrPageDelta " + aIntDelta +
" aDeltaMode " + aDeltaMode);
// Check that horizontal scrolling has no effect
listbox.scrollToIndex(aStart);
synthesizeWheel(listbox, 10, 10,
{ deltaMode: aDeltaMode, deltaX: aDelta,
lineOrPageDeltaX: aIntDelta });
winUtils.advanceTimeAndRefresh(100);
is(listbox.getIndexOfFirstVisibleRow(), aStart,
"testRichListbox(" + id + "): horizontal, starting " + aStart +
" delta " + aDelta + " lineOrPageDelta " + aIntDelta +
" aDeltaMode " + aDeltaMode);
// Check that horizontal scrolling has no effect
listbox.scrollToIndex(aStart);
synthesizeWheel(listbox, 10, 10,
{ deltaMode: aDeltaMode, deltaX: aDelta,
lineOrPageDeltaX: aIntDelta });
setTimeout(function() {
is(listbox.getIndexOfFirstVisibleRow(), aStart,
"testRichListbox(" + id + "): horizontal, starting " + aStart +
" delta " + aDelta + " lineOrPageDelta " + aIntDelta +
" aDeltaMode " + aDeltaMode);
if (tests.length)
helper();
else
andThen();
}, 20);
}, 20);
if (tests.length) {
winUtils.advanceTimeAndRefresh(100);
helper();
} else {
winUtils.restoreNormalRefresh();
andThen();
}
}
// richlistbox currently uses native XUL scrolling, so the "line"