helper_doubletap_zoom.html (1711B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <meta name="viewport" content="width=2100"/> 6 <title>Sanity check for double-tap zooming</title> 7 <script type="application/javascript" src="apz_test_native_event_utils.js"></script> 8 <script type="application/javascript" src="apz_test_utils.js"></script> 9 <script src="/tests/SimpleTest/paint_listener.js"></script> 10 <script type="application/javascript"> 11 12 async function test() { 13 let useTouchpad = (location.search == "?touchpad"); 14 15 var resolution = await getResolution(); 16 ok(resolution > 0, 17 "The initial_resolution is " + resolution + ", which is some sane value"); 18 19 // Check that double-tapping once zooms in 20 await doubleTapOn(document.getElementById("target"), 10, 10, useTouchpad); 21 var prev_resolution = resolution; 22 resolution = await getResolution(); 23 ok(resolution > prev_resolution, "The first double-tap has increased the resolution to " + resolution); 24 25 // Check that double-tapping again on the same spot zooms out 26 await doubleTapOn(document.getElementById("target"), 10, 10, useTouchpad); 27 prev_resolution = resolution; 28 resolution = await getResolution(); 29 ok(resolution < prev_resolution, "The second double-tap has decreased the resolution to " + resolution); 30 } 31 32 waitUntilApzStable() 33 .then(test) 34 .then(subtestDone, subtestFailed); 35 36 </script> 37 <style type="text/css"> 38 .box { 39 width: 800px; 40 height: 500px; 41 margin: 0 auto; 42 } 43 </style> 44 </head> 45 <body> 46 <div class="box">Text before the div.</div> 47 <div id="target" style="margin-left: 100px; width:900px; height: 400px; background-image: linear-gradient(blue,red)"></div> 48 <div class="box">Text after the div.</div> 49 </body> 50 </html>