summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test/mochitest/helper_doubletap_zoom_textarea.html
blob: 762e1cef69a29d0575721c2f53e76fc4c1cab346 (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
<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=2100"/>
  <title>Check that double tapping textarea works</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>
  <style>
    #target {
      width: 100px;
      height: 100px;
    }
  </style>
  <script>

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

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

  // Check that double-tapping once zooms in
  await doubleTapOn(document.getElementById("target"), 10, 10, useTouchpad);
  var prev_resolution = resolution;
  resolution = await getResolution();
  ok(resolution > prev_resolution, "The first double-tap has increased the resolution to " + resolution);

  // Check that double-tapping again on the same spot zooms out
  await doubleTapOn(document.getElementById("target"), 10, 10, useTouchpad);
  prev_resolution = resolution;
  resolution = await getResolution();
  ok(resolution < prev_resolution, "The second double-tap has decreased the resolution to " + resolution);
}

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

  </script>
</head>
<body>

<textarea id="target" rows="10" cols="30">The cat was playing in the garden.</textarea>

</body>
</html>