[webkit-help] how to write layout test to test mouse wheeling on document

Xiaomei Ji xji at chromium.org
Fri Dec 3 10:32:37 PST 2010


Webkit now supports horizontal scrolling for pages with left overflow.
But it has a bug in cross-platform that the backward mouse wheel does not
work (you can not scroll backward below (0,0)).
https://bugs.webkit.org/show_bug.cgi?id=50370

I tested the fix posted in the above bug, and I can manually mouse wheel a
RTL page backward and forward horizontally and vertically.

But I am not able to write a layout test on it.
Following is what I wrote. The test passes with and without the fix. It
should fail without the fix because horizontal backward mouse wheel is not
working without the fix.
I tested in Chromium Linux, and I looked at EventSender.cpp in Chromium's
DRT and did not see any problems there.

I am not sure whether I am writing the test correctly. Appreciate your help!


<html dir="rtl">
    <head>
        <link rel="stylesheet" href="../js/resources/js-test-style.css">
        <script src="../js/resources/js-test-pre.js"></script>
        <script>

            if (window.layoutTestController) {
                layoutTestController.waitUntilDone();
            }

            function dispatchWheelEvent()
            {
                window.addEventListener("mousewheel", mousewheelHandler,
false);

                window.scrollTo(-100, 100);
                if (window.eventSender) {
                    eventSender.continuousMouseScrollBy(-10, -10);
                    eventSender.continuousMouseScrollBy(30, 30);
                }

                setTimeout('checkOffsets();', 100);
            }

            function checkOffsets()
            {
                shouldBe("window.scrollX", "-120");
                shouldBe("window.scrollY", "80");

                if (window.layoutTestController)
                    window.layoutTestController.notifyDone();
            }

            function mousewheelHandler(e)
            {
            }
        </script>
    </head>

    <body style="margin:0" onload="setTimeout('dispatchWheelEvent();',
100)">

        <div id="div" style="whitespace:nowrap; width: 4000px; height:
1000px; border: 1px solid red;">Lorem ipsum dolor sit amet, consectetur
adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna
aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
officia deserunt mollit anim id est laborum."</div>
        <div id="console"></div>
    </body>
</html>


Thanks,
Xiaomei
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-help/attachments/20101203/5afc765e/attachment.html>


More information about the webkit-help mailing list