Commit b7d963ad authored by Mason Freed's avatar Mason Freed Committed by Commit Bot

Adding tests for scrolling bugs found in BGPT mode

Bug: 927560,927587,928518
Change-Id: I502e1d487fefa06697c064919d5bbb78582da923
Reviewed-on: https://chromium-review.googlesource.com/c/1454090
Commit-Queue: Mason Freed <masonfreed@chromium.org>
Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#629853}
parent 4afb628e
<!DOCTYPE html>
<meta charset="utf-8">
<title>Long scrolling should work properly</title>
<link rel="author" title="Mason Freed" href="mailto:masonfreed@chromium.org">
<style>
.post {
height: 1000px;
width: 300px;
border: 1px solid black;
}
.before {
height: 213px;
border-top: 0;
}
.scroller {
overflow-y: scroll;
width: 500px;
height: 500px;
will-change: transform;
}
::-webkit-scrollbar {
display: none;
}
</style>
<p>The number 7 should be visible in the scrolled window below.</p>
<div id="scroller" class="scroller">
<div style="position: relative;">
<div style="position: relative;">
<div class="post before"></div>
<div class="post">7</div>
</div>
</div>
</div>
<!DOCTYPE html>
<meta charset="utf-8">
<title>Long scrolling should work properly</title>
<link rel="author" title="Mason Freed" href="mailto:masonfreed@chromium.org">
<link rel="help" href="https://www.w3.org/TR/cssom-view/#scrolling">
<link rel="match" href="long_scroll_composited-ref.html">
<style>
.post {
height: 1000px;
width: 300px;
border: 1px solid black;
}
.scroller {
overflow-y: scroll;
width: 500px;
height: 500px;
will-change: transform;
}
::-webkit-scrollbar {
display: none;
}
</style>
<p>The number 7 should be visible in the scrolled window below.</p>
<div id="scroller" class="scroller">
<div style="position: relative;">
<div style="position: relative;">
<div class="post">0</div>
<div class="post">1</div>
<div class="post">2</div>
<div class="post">3</div>
<div class="post">4</div>
<div class="post">5</div>
<div class="post">6</div>
<div class="post">7</div>
<div class="post">8</div>
<div class="post">9</div>
</div>
</div>
</div>
<script>
onload = function() {
scroller=document.getElementById("scroller");
scroller.scrollTop = 6800;
};
</script>
<!doctype html>
<p>The scrollbar should be roughly in the middle of the scroll range.</p>
<p>This is intended to duplicate https://crbug.com/927560</p>
<div id="scroller">
<div style="width: 200px; height: 5000px;"></div>
</div>
<style>
#scroller {
overflow-y: scroll;
width: 500px;
height: 500px;
border: 1px solid black;
}
</style>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src='../../resources/gesture-util.js'></script>
<script>
var scroller = document.getElementById('scroller');
var rect = scroller.getBoundingClientRect();
var start_x = (rect.left + rect.right) / 2;
var start_y = (rect.top + rect.bottom) / 2;
async function scrollDown(pixels_to_scroll, gesture_source_type) {
const target_scroll_offset = scroller.scrollTop + pixels_to_scroll;
await waitForCompositorCommit();
await smoothScroll(pixels_to_scroll, start_x, start_y, gesture_source_type,
'down', SPEED_INSTANT);
await waitFor(() => {
return approx_equals(scroller.scrollTop, target_scroll_offset, 20);
}, "Didn't scroll by expected amount: " + pixels_to_scroll + " scroller.scrollTop is " + scroller.scrollTop + ", target is " + target_scroll_offset);
await waitForCompositorCommit();
}
promise_test(async () => {
await scrollDown(800, GestureSourceType.TOUCHPAD_INPUT);
await scrollDown(800, GestureSourceType.TOUCH_INPUT);
await scrollDown(800, GestureSourceType.MOUSE_INPUT);
assert_approx_equals(scroller.scrollTop,2400,60,"Scroll didn't work: ")
}, "Scrolling by wheel then touch should work.");
</script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment