Add test to ensure that text-overflow: ellipsis text is scrollable
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Oct 2017 23:14:34 +0000 (23:14 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 18 Oct 2017 23:14:34 +0000 (23:14 +0000)
https://bugs.webkit.org/show_bug.cgi?id=178395

Reviewed by Zalan Bujtas.

* fast/text/scroll-text-overflow-ellipsis-expected.html: Added.
* fast/text/scroll-text-overflow-ellipsis.html: Added.
* platform/ios-wk1/TestExpectations: For now, skip the test in legacy WebKit on iOS
as eventSender.keyDown() does not seem to be dispatching a keyboard event to the
focused field. See <https://bugs.webkit.org/show_bug.cgi?id=178490>.
* resources/ui-helper.js:
(window.UIHelper.keyDown.return.new.Promise):
(window.UIHelper.keyDown):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223639 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/text/scroll-text-overflow-ellipsis-expected.html [new file with mode: 0644]
LayoutTests/fast/text/scroll-text-overflow-ellipsis.html [new file with mode: 0644]
LayoutTests/platform/ios-wk1/TestExpectations
LayoutTests/resources/ui-helper.js

index 72fadde..16f9b1b 100644 (file)
@@ -1,3 +1,19 @@
+2017-10-18  Daniel Bates  <dabates@apple.com>
+
+        Add test to ensure that text-overflow: ellipsis text is scrollable
+        https://bugs.webkit.org/show_bug.cgi?id=178395
+
+        Reviewed by Zalan Bujtas.
+
+        * fast/text/scroll-text-overflow-ellipsis-expected.html: Added.
+        * fast/text/scroll-text-overflow-ellipsis.html: Added.
+        * platform/ios-wk1/TestExpectations: For now, skip the test in legacy WebKit on iOS
+        as eventSender.keyDown() does not seem to be dispatching a keyboard event to the
+        focused field. See <https://bugs.webkit.org/show_bug.cgi?id=178490>.
+        * resources/ui-helper.js:
+        (window.UIHelper.keyDown.return.new.Promise):
+        (window.UIHelper.keyDown):
+
 2017-10-17  Dean Jackson  <dino@apple.com>
 
         Make failing WebGL tests produce debug output
diff --git a/LayoutTests/fast/text/scroll-text-overflow-ellipsis-expected.html b/LayoutTests/fast/text/scroll-text-overflow-ellipsis-expected.html
new file mode 100644 (file)
index 0000000..a543245
--- /dev/null
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+body {
+    margin: 0;
+    padding: 0;
+}
+
+#expected {
+    width: 55px;
+    height: 55px;
+    background-color: green;
+}
+</style>
+</head>
+<body>
+<div id="expected"></div>
+</body>
+</html>
diff --git a/LayoutTests/fast/text/scroll-text-overflow-ellipsis.html b/LayoutTests/fast/text/scroll-text-overflow-ellipsis.html
new file mode 100644 (file)
index 0000000..3d20d5b
--- /dev/null
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../resources/ui-helper.js"></script>
+<style>
+body {
+    margin: 0;
+    padding: 0;
+}
+
+.hidden {
+    display: none;
+}
+
+#ellipsizedText {
+    font-size: 300%;
+    text-overflow: ellipsis;
+    display: inline-block;
+    overflow: hidden;
+    white-space: nowrap;
+    width: 55px;
+    height: 55px;
+    background-color: green;
+    color: red;
+}
+</style>
+</head>
+<body>
+<div id="manual-instructions" class="hidden">
+    <p>Tests that a text-overflow box is scrollable. To run by hand, perform the following:</p>
+    <ol>
+        <li>Click anywhere in the green box (below) to focus it.</li>
+        <li>Press the down arrow on the keyboard.</li>
+    </ol>
+    <p>This test PASSED if you see a solid green square. Otherwise, it FAILED.</p>
+</div>
+<div id="ellipsizedText" contenteditable="true">abcde</div>
+<script>
+function runTest()
+{
+    function scrollToEndOfLine()
+    {
+        return UIHelper.keyDown("downArrow");
+    }
+
+    function done()
+    {
+        document.getElementById("ellipsizedText").blur(); // To avoid painting the caret.
+        testRunner.notifyDone();
+    }
+
+    UIHelper.activateAndWaitForInputSessionAt(0, 0).then(scrollToEndOfLine).then(done);
+}
+
+if (!window.testRunner)
+    document.getElementById("manual-instructions").classList.remove("hidden"); // Show manual instructions
+else {
+    testRunner.waitUntilDone();
+
+    runTest();
+}
+</script>
+</body>
+</html>
index 2e45ab4..7f23e2c 100644 (file)
@@ -1901,3 +1901,6 @@ http/tests/websocket/tests/hybi/network-process-crash-error.html [ Skip ]
 http/tests/css/filters-on-iframes.html [ Skip ]
 
 webkit.org/b/172092 [ Release ] fast/parser/adoption-agency-unload-iframe-4.html [ Timeout ]
+
+# FIXME: For some reason EventSender.keyDown() does not work.
+webkit.org/b/178490 fast/text/scroll-text-overflow-ellipsis.html [ Skip ]
index e8a2187..39d1712 100644 (file)
@@ -47,6 +47,21 @@ window.UIHelper = class UIHelper {
         });
     }
 
+    static keyDown(key)
+    {
+        if (!this.isWebKit2() || !this.isIOS()) {
+            eventSender.keyDown(key);
+            return Promise.resolve();
+        }
+
+        return new Promise((resolve) => {
+            testRunner.runUIScript(`
+                uiController.keyDownUsingHardwareKeyboard("downArrow", function() {
+                    uiController.uiScriptComplete("Done");
+                });`, resolve);
+        });
+    }
+
     static ensurePresentationUpdate()
     {
         if (!this.isWebKit2()) {