summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test/mochitest/helper_doubletap_zoom_gencon.html
blob: 01b1f060d8b084abd1572177ad393079aea21087 (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=2100"/>
  <title>Check that on generated content works</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() {
  let useTouchpad = (location.search == "?touchpad");

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

  let target = document.getElementById("target");

  info("tar " + target.getBoundingClientRect().width);

  // Check that first double tap zooms in
  info("sending first double tap");
  await doubleTapOn(target, 10, 10, useTouchpad);
  let prev_resolution = resolution;
  resolution = await getResolution();
  ok(resolution > prev_resolution, "After double-tap the resolution has increased to " + resolution);

  // Check that second double tap zooms out
  info("sending second double tap");
  await doubleTapOn(target, 10, 10, useTouchpad);
  prev_resolution = resolution;
  resolution = await getResolution();
  ok(resolution < prev_resolution, "After double-tap the resolution has decreased to " + resolution);
  ok(resolution == initial_resolution, "After double-tap the resolution has decreased to initial_resolution");

  info(" window.innerWidth " + window.innerWidth);

  // Check that third double tap zooms in
  info("sending third double tap");
  await doubleTapOn(document.getElementById("placeholder"), 10, 10, useTouchpad);
  prev_resolution = resolution;
  resolution = await getResolution();
  ok(resolution > prev_resolution, "After double-tap the resolution has increased to " + resolution);

  info(" window.innerWidth " + window.innerWidth);

  // Check that fourth double tap zooms out
  info("sending forth double tap");
  await doubleTapOn(document.getElementById("placeholder"), 10, 10, useTouchpad);
  prev_resolution = resolution;
  resolution = await getResolution();
  ok(resolution < prev_resolution, "After double-tap the resolution has decreased to " + resolution);
  ok(resolution == initial_resolution, "After double-tap the resolution has decreased to initial_resolution");

}

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

  </script>
  <style>
body, html {
  margin: 0;
}
.withafter {
  width: 200px;
  height: 200px;
  left: 0;
  background: green;
  position: relative;
}
.withafter::after {
  width: 20vw;
  height: 100px;
  background: blue;
  position: absolute;
  left: 80vw;
  content: 'after';
}
.placeholder {
  width: 20vw;
  height: 100px;
  background: blue;
  position: absolute;
  left: 80vw;
  top:0;
  z-index: -10;
}
</style>
</head>
<body>

<div id="target" class="withafter">some text</div>
<div id="placeholder" class="placeholder"></div>

</body>
</html>