scroll-rtl-or-bt-layer.html 2.05 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
<html>
<body>

<p>This test requires DumpRenderTree.  To test manually, try to scroll the
blue div to the left and the red div up using the scrollbar arrows or the
mouse wheel.  The test passes if the divs scroll.</p>

<div id='rtl' style="direction: rtl; width: 100px; overflow: auto; border: 1px solid blue;">
01234567890123456789
</div>

<div id='bt' style="-webkit-writing-mode: horizontal-bt; height: 100px; overflow: auto; border: 1 px solid red;">
aaa<br>
bbb<br>
ccc<br>
ddd<br>
eee<br>
fff<br>
ggg<br>
hhh<br>
iii<br>
jjj<br>
kkk
</div>

<div id="console"></div>

<script>
function log(message)
{
    document.getElementById("console").innerHTML += message + "<br>";
}

function centerMouseOn(elementId)
{
    var element = document.getElementById(elementId);
    eventSender.mouseMoveTo(element.offsetLeft + element.offsetWidth / 2,
        element.offsetTop + element.offsetHeight / 2);
}

function test()
{
43 44
    if (window.testRunner)
        testRunner.dumpAsText();
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83

    if (!window.eventSender || !window.eventSender.mouseScrollBy) {
        log("This test requires DumpRenderTree with eventSender.mouseScrollBy.");
        return;
    }

    centerMouseOn("rtl");
    var offsetBefore = document.getElementById("rtl").scrollLeft;
    eventSender.mouseScrollBy(1, 0);
    var offsetAfter = document.getElementById("rtl").scrollLeft;
    if (offsetBefore > offsetAfter)
        log("rtl: PASS");
    else {
        log("rtl: FAIL");
        log("scrollLeft before: " + offsetBefore);
        log("scrollLeft after: " + offsetAfter);
    }

    centerMouseOn("bt");
    offsetBefore = document.getElementById("bt").scrollTop;
    eventSender.mouseScrollBy(0, 1);
    offsetAfter = document.getElementById("bt").scrollTop;
    if (offsetBefore > offsetAfter)
        log("bt: PASS");
    else {
        log("bt: FAIL");
        log("scrollTop before: " + offsetBefore);
        log("scrollTop after: " + offsetAfter);
    }

    document.body.removeChild(document.getElementById("rtl"));
    document.body.removeChild(document.getElementById("bt"));
}

test();
</script>

</body>
</html>