mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-28 04:35:33 +00:00
Bug 1188955 - Add a basic double-tap-to-zoom mochitest. r=botond
MozReview-Commit-ID: KVqmpBG33JC --HG-- extra : rebase_source : db2a378f5b4ddc130c1d3f8d8a9e3591c2e2f2e3
This commit is contained in:
parent
c9ab45d675
commit
aefbfdb5a8
@ -0,0 +1,60 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=1050"/>
|
||||
<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 type="application/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
|
||||
<script type="application/javascript">
|
||||
function getResolution() {
|
||||
let resolution = { value: -1 }; // bogus value in case DWU fails us
|
||||
SpecialPowers.getDOMWindowUtils(window).getResolution(resolution);
|
||||
return resolution.value;
|
||||
}
|
||||
|
||||
function* test(testDriver) {
|
||||
var initial_resolution = getResolution();
|
||||
ok(initial_resolution > 0,
|
||||
'The initial_resolution is ' + initial_resolution + ', which is some sane value');
|
||||
|
||||
// This listener will trigger the test to continue once APZ is done with
|
||||
// processing the scroll.
|
||||
SpecialPowers.Services.obs.addObserver(testDriver, "APZ:TransformEnd");
|
||||
|
||||
synthesizeNativeTap(document.getElementById('target'), 10, 10);
|
||||
synthesizeNativeTap(document.getElementById('target'), 10, 10);
|
||||
|
||||
// Wait for the APZ:TransformEnd to fire
|
||||
yield true;
|
||||
|
||||
// We get here once the APZ:TransformEnd has fired, so we don't need that
|
||||
// observer any more.
|
||||
SpecialPowers.Services.obs.removeObserver(testDriver, "APZ:TransformEnd", false);
|
||||
|
||||
// Flush state and get the resolution we're at now
|
||||
yield flushApzRepaints(testDriver);
|
||||
let final_resolution = getResolution();
|
||||
ok(final_resolution > initial_resolution, 'The final resolution (' + final_resolution + ') is greater after zooming in');
|
||||
}
|
||||
|
||||
waitUntilApzStable()
|
||||
.then(runContinuation(test))
|
||||
.then(subtestDone);
|
||||
|
||||
</script>
|
||||
<style type="text/css">
|
||||
.box {
|
||||
width: 800px;
|
||||
height: 200px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="box">Text before the div.</div>
|
||||
<div id="target" style="width:400px; height: 2000px; background-image: linear-gradient(blue,red)">
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -2,6 +2,7 @@
|
||||
support-files =
|
||||
apz_test_native_event_utils.js
|
||||
apz_test_utils.js
|
||||
helper_basic_doubletap_zoom.html
|
||||
helper_basic_pan.html
|
||||
helper_basic_zoom.html
|
||||
helper_bug982141.html
|
||||
|
@ -25,9 +25,16 @@ var prefs = [
|
||||
["apz.displayport_expiry_ms", 0],
|
||||
];
|
||||
|
||||
// Increase the tap timeouts so the double-tap is still detected in case of
|
||||
// random delays during testing.
|
||||
var doubletap_prefs = prefs.slice(); // make a copy
|
||||
doubletap_prefs.push(["ui.click_hold_context_menus.delay", 10000]);
|
||||
doubletap_prefs.push(["apz.max_tap_time", 10000]);
|
||||
|
||||
var subtests = [
|
||||
{'file': 'helper_bug1280013.html', 'prefs': prefs},
|
||||
{'file': 'helper_basic_zoom.html', 'prefs': prefs},
|
||||
{'file': 'helper_basic_doubletap_zoom.html', 'prefs': doubletap_prefs},
|
||||
];
|
||||
|
||||
if (isApzEnabled()) {
|
||||
|
Loading…
Reference in New Issue
Block a user