Bug 1348321 - Add a mochitest for dragging a scrollbar inside an SVGEffects item. r?botond
MozReview-Commit-ID: M0KmWSmXTt
new file mode 100644
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_bug1331693.html
@@ -0,0 +1,67 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width; initial-scale=1.0">
+ <title>Dragging the mouse on a scrollframe inside an SVGEffects</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="text/javascript">
+
+function* test(testDriver) {
+ var scrollableDiv = document.getElementById('scrollable');
+ scrollableDiv.addEventListener('scroll', () => setTimeout(testDriver, 0), {once: true});
+
+ var scrolled = yield* dragVerticalScrollbar(scrollableDiv, testDriver);
+ if (!scrolled) {
+ ok(true, "No scrollbar, can't do this test");
+ return;
+ }
+
+ // the events above might be stuck in APZ input queue for a bit until the
+ // layer is activated, so we wait here until the scroll event listener is
+ // triggered.
+ yield;
+
+ // Flush everything just to be safe
+ yield flushApzRepaints(testDriver);
+
+ // After dragging the scrollbar 20px on a 200px-high scrollable div, we should
+ // have scrolled approx 10% of the 2000px high content. There might have been
+ // scroll arrows and such so let's just have a minimum bound of 50px to be safe.
+ ok(scrollableDiv.scrollTop > 50, "Scrollbar drag resulted in a scroll position of " + scrollableDiv.scrollTop);
+}
+
+waitUntilApzStable()
+.then(runContinuation(test))
+.then(subtestDone);
+
+ </script>
+ <style>
+ #svgeffects {
+ background-color: lightgreen;
+ width: 300px;
+ height: 300px;
+ clip-path: circle(200px at 100% 0); /* ensure scrollthumb is in the clip */
+ }
+ #scrollable {
+ overflow: scroll;
+ height: 200px;
+ width: 200px;
+ }
+ #content {
+ width: 1000px;
+ height: 2000px;
+ background-image: linear-gradient(red,blue);
+ }
+ </style>
+</head>
+<body>
+ <div id="svgeffects">A div that generate an svg effects display item
+ <div id="scrollable">
+ <div id="content">Some content inside the scrollframe</div>
+ </div>
+ </div>
+</body>
+</html>
--- a/gfx/layers/apz/test/mochitest/test_group_mouseevents.html
+++ b/gfx/layers/apz/test/mochitest/test_group_mouseevents.html
@@ -16,17 +16,19 @@ var subtests = [
{'file': 'helper_click.html?dtc=true'},
// 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'},
// Test for dragging the scrollbar with a fixed-pos element overlaying it
{'file': 'helper_bug1346632.html'},
// Test for scrollbar-dragging on a scrollframe that's inactive
- {'file': 'helper_bug1326290.html'}
+ {'file': 'helper_bug1326290.html'},
+ // Test for scrollbar-dragging on a scrollframe inside an SVGEffects
+ {'file': 'helper_bug1331693.html'}
];
if (isApzEnabled()) {
SimpleTest.waitForExplicitFinish();
window.onload = function() {
runSubtestsSeriallyInFreshWindows(subtests)
.then(SimpleTest.finish, SimpleTest.finish);
};