summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test/mochitest/helper_scrollby_bug1531796.html
blob: 5e6f0e1833506f314d55fc2f7e1868de352a17b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width; initial-scale=1.0">
  <title>Test that scrollBy() doesn't scroll more than it should</title>
  <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
  <script type="application/javascript" src="apz_test_utils.js"></script>
  <script src="/tests/SimpleTest/paint_listener.js"></script>
  <script type="application/javascript">

async function test() {
  const maxSteps = 20;
  let scrollPerStep = 40;
  for (let step = 0; step < maxSteps; step++) {
    window.scrollBy(0, scrollPerStep);
    await promiseFrame();
  }
  is(window.scrollY, maxSteps * scrollPerStep, "Scrolled by the expected amount");
}

waitUntilApzStable()
.then(test)
.then(subtestDone, subtestFailed);

  </script>
  <style>
    body {
      height: 5000px;
      background: linear-gradient(red, black);
    }
  </style>
</head>
<body>
</body>
</html>