summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test/mochitest/helper_doubletap_zoom.html
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/layers/apz/test/mochitest/helper_doubletap_zoom.html')
-rw-r--r--gfx/layers/apz/test/mochitest/helper_doubletap_zoom.html50
1 files changed, 50 insertions, 0 deletions
diff --git a/gfx/layers/apz/test/mochitest/helper_doubletap_zoom.html b/gfx/layers/apz/test/mochitest/helper_doubletap_zoom.html
new file mode 100644
index 0000000000..4cd613edbb
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_doubletap_zoom.html
@@ -0,0 +1,50 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=2100"/>
+ <title>Sanity check for double-tap zooming</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");
+
+ 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>
+ <style type="text/css">
+ .box {
+ width: 800px;
+ height: 500px;
+ margin: 0 auto;
+ }
+</style>
+</head>
+<body>
+<div class="box">Text before the div.</div>
+<div id="target" style="margin-left: 100px; width:900px; height: 400px; background-image: linear-gradient(blue,red)"></div>
+<div class="box">Text after the div.</div>
+</body>
+</html>