<!DOCTYPE html>
<title>Tests mouse clicks and mousewheel ticks are animated.</title>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../resources/gesture-util.js"></script>
<script src="../../resources/scrollbar-util.js"></script>
<script src="../../resources/testdriver.js"></script>
<script src="../../resources/testdriver-actions.js"></script>
<script src="../../resources/testdriver-vendor.js"></script>
<body style="height: 1000px; width: 1000px">
<script>
window.onload = () => {
const TRACK_WIDTH = calculateScrollbarThickness();
const BUTTON_WIDTH = TRACK_WIDTH;
const SCROLL_CORNER = TRACK_WIDTH;
var start_offset = 0;
var end_offset = 0;
var animated_scroll = false;
async function resetTest() {
await waitForCompositorCommit();
await waitForScrollReset(document.scrollingElement);
assert_equals(window.scrollY, 0, "Scroller is expected to be at 0 offset.");
}
promise_test (async () => {
await resetTest();
if (!TRACK_WIDTH) {
// Can't click on a track that is not visible.
return;
}
// Click on the track part just above the down arrow.
const x = window.innerWidth - BUTTON_WIDTH / 2;
const y = window.innerHeight - SCROLL_CORNER - BUTTON_WIDTH - 2;
return Promise.all([
animatedScrollPromise(document),
clickAndWaitForScroll(x, y)
]);
}, "Test mouse click on scrollbar is animated.");
promise_test (async () => {
await resetTest();
const x = window.innerWidth / 2;
const y = window.innerHeight / 2;
const deltaX = 0;
const deltaY = 1000;
return Promise.all([
animatedScrollPromise(document),
wheelScroll(x, y, deltaX, deltaY)
]);
}, "Test mouse wheel tick is animated.");
}
</script>
</body>