Bug 1346632 - Add a mochitest. r=kats

MozReview-Commit-ID: 2o3cpTaGG1V

--HG--
extra : rebase_source : 25dc7749225bab57ebcce79533c105f3ff164dff
This commit is contained in:
Botond Ballo 2017-03-15 17:49:50 -04:00
Родитель 4acfa9a890
Коммит fde5b63146
3 изменённых файлов: 81 добавлений и 1 удалений

Просмотреть файл

@ -0,0 +1,77 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width; initial-scale=1.0">
<title>Dragging the scrollbar on a page with a fixed-positioned element just past the right edge of the content</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>
<style>
body {
height: 2000px;
}
#fixed {
width: 240px;
height: 100%;
position: fixed;
top: 0px;
right: -240px;
z-index: 1000;
overflow-y: scroll;
}
#fixed-content {
height: 2000px;
}
</style>
<script type="text/javascript">
var root;
var scrollPos;
var haveScrolled = false;
var generatedAll = false;
// Be careful not to call subtestDone() until we've scrolled AND generated
// all of the events.
function maybeDone() {
if (haveScrolled && generatedAll) {
subtestDone();
}
}
function scrolled(e) {
// Test that we have scrolled
ok(root.scrollTop > scrollPos, "document scrolled after dragging scrollbar");
haveScrolled = true;
maybeDone();
}
function* test(testDriver) {
root = document.scrollingElement;
scrollPos = root.scrollTop;
document.addEventListener('scroll', scrolled);
var scrollbarX = (window.innerWidth + root.clientWidth) / 2;
// Move the mouse to the scrollbar
yield synthesizeNativeMouseEvent(root, scrollbarX, 100, nativeMouseMoveEventMsg(), testDriver);
// mouse down
yield synthesizeNativeMouseEvent(root, scrollbarX, 100, nativeMouseDownEventMsg(), testDriver);
// drag vertically
yield synthesizeNativeMouseEvent(root, scrollbarX, 150, nativeMouseMoveEventMsg(), testDriver);
// and release
yield synthesizeNativeMouseEvent(root, scrollbarX, 150, nativeMouseUpEventMsg(), testDriver);
generatedAll = true;
maybeDone();
}
waitUntilApzStable()
.then(runContinuation(test));
</script>
</head>
<body>
<div id="fixed">
<p id="fixed-content"></p>
</div>
</body>
</html>

Просмотреть файл

@ -10,6 +10,7 @@
helper_bug1280013.html
helper_bug1285070.html
helper_bug1299195.html
helper_bug1346632.html
helper_click.html
helper_div_pan.html
helper_drag_click.html

Просмотреть файл

@ -17,7 +17,9 @@ var subtests = [
// Sanity test for click but with some mouse movement between the down and up
{'file': 'helper_drag_click.html'},
// Test for dragging on a fake-scrollbar element that scrolls the page
{'file': 'helper_drag_scroll.html'}
{'file': 'helper_drag_scroll.html'},
// Test for dragging the scrollbar with a fixed-pos element overlaying it
{'file': 'helper_bug1346632.html'}
];
if (isApzEnabled()) {