summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test/mochitest/helper_doubletap_zoom_nothing_listener.html
blob: 82805fe32192f6f014e6a7498609270fae05b351 (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
37
38
39
40
41
42
43
44
45
46
47
<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=2100"/>
  <title>Check that double tapping when zoomed out and there is nothing to zoom to does not zoom in if this is a non-passive wheel listener</title>
  <script src="apz_test_native_event_utils.js"></script>
  <script src="apz_test_utils.js"></script>
  <script src="/tests/SimpleTest/paint_listener.js"></script>
  <script>

function aListener() {
  info("aListener called");
  preventDefault();
}

async function test() {
  let useTouchpad = (location.search == "?touchpad");

  let resolution = await getResolution();
  ok(resolution > 0,
     "The initial_resolution is " + resolution + ", which is some sane value");

  document.getElementById("thebody").addEventListener('wheel', aListener, {passive: false});
  await promiseApzFlushedRepaints();

  // Check that double-tapping does not zoom in
  info("sending first double tap");
  await doubleTapOn(document.getElementById("thebody"), 20, 20, useTouchpad);
  let prev_resolution = resolution;
  resolution = await getResolution();
  ok(resolution == prev_resolution, "The first double-tap did not change the resolution: " + resolution);
}

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

  </script>
<style>
  body, html {margin: 0; width: 100%; height: 100%;}
</style>
</head>
<body id="thebody">

</body>
</html>