Bug 1523853 Part 3: Further relax the mousewheel test to not care about the ending scroll values. r=kats

This is being done to reduce the intermittent failures we see in this test.
There are other non-intermittent tests that measure the specific number of
pixels traveled by mousewheel events. The focus of this test seems to be
"Ensure that mousewheel scrolling and zooming are mutually exclusive" and
this change maintains that.

Depends on D62067

Differential Revision: https://phabricator.services.mozilla.com/D62130

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Brad Werth 2020-02-08 20:15:16 +00:00
Родитель 18aefc612f
Коммит 69e6a4776b
1 изменённых файлов: 13 добавлений и 12 удалений

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

@ -48,8 +48,8 @@ function waitForPaint(win, utils, callback) {
}
// This is a magic number representing how many device pixels we are attempting to
// scroll or zoom. We use it for sending the wheel events, and for checking the
// outcome of the events that are expected to trigger scrolling.
// scroll or zoom. We use it for sending the wheel events, but we don't actually
// check that we have scrolled by that amount.
var kDelta = 3;
function sendTouchpadScrollMotion(scrollbox, direction, ctrl, momentum, callback) {
@ -68,14 +68,15 @@ function sendTouchpadScrollMotion(scrollbox, direction, ctrl, momentum, callback
// --- Intermittent Warning ---
// Two wheel events are sent, but our promise resolves when any change has been
// made to scroll or zoom. That makes it possible that the effect of the second
// event may not yet be applied when the promise resolves, which will lead to a
// failure when checking the expected value for scrolling. This was done
// intentionally, because attempting to wait after both events yields problems
// when the second event has no effect, which does happen in testing. It's
// not clear why this is happening. Since the testing pattern is scroll (twice),
// then scroll back (twice), it's possible that the first scroll back event is
// sufficient to return the scrollbox to its minimal scrollTop position, and
// therefore the second event doesn't scroll any further.
// event may not yet be applied when the promise resolves. This shouldn't lead
// to any errors, since the two wheel events are moving in the same direction,
// and our later checks will only ensure that the value has changed from its
// initial value. This was done intentionally, because attempting to wait after
// both events yields problems when the second event has no effect, which does
// happen in testing. It's not clear why this is happening. Since the testing
// pattern is scroll (twice), then scroll back (twice), it's possible that the
// first scroll back event is sufficient to return the scrollbox to its minimal
// scrollTop position, and so the second event doesn't scroll any further.
const initialZoom = winUtils.fullZoom;
const initialScroll = scrollbox.scrollTop;
@ -143,7 +144,7 @@ function runTest() {
let postfix = isMomentum ? ", even after releasing the touchpad" : "";
// Normal scroll: scroll
is(winUtils.fullZoom, zoomFactorBefore, "Normal scrolling shouldn't change zoom" + postfix);
is(scrollbox.scrollTop, scrollTopBefore + kDelta * 2,
isnot(scrollbox.scrollTop, scrollTopBefore,
"Normal scrolling should scroll" + postfix);
} else {
if (!isMomentum) {
@ -151,7 +152,7 @@ function runTest() {
is(scrollbox.scrollTop, scrollTopBefore, "Ctrl-scrolling shouldn't scroll while the user is touching the touchpad");
} else {
is(winUtils.fullZoom, zoomFactorBefore, "Momentum scrolling shouldn't zoom, even when pressing Ctrl");
is(scrollbox.scrollTop, scrollTopBefore + kDelta * 2,
isnot(scrollbox.scrollTop, scrollTopBefore,
"Momentum scrolling should scroll, even when pressing Ctrl");
}
}