Title: [164101] trunk/LayoutTests
Revision
164101
Author
g.czajkow...@samsung.com
Date
2014-02-14 05:57:53 -0800 (Fri, 14 Feb 2014)

Log Message

Refactoring design-mode-spellcheck-off.html to use asynchronous spellchecking
https://bugs.webkit.org/show_bug.cgi?id=127770

Reviewed by Ryosuke Niwa.

Enable asynchronous spellchecking in design-mode-spellcheck-off.html.

Due to js-test-pre.js adds some HTML elements inside the BODY, the misspelled
phrase was moved into separated div element. It allows to check spelling marker
on desired element instead of whole body.

It turned out that the test does not underline "asdf" as misspelled although
spellcheck attribute is on. To force spellchecking, the caret needs to be moved
out of the misspelled word. To be more reliable, the test now contains two test
cases in 'desingMode=on' when spellcheck attribute is off and on.

* editing/spelling/design-mode-spellcheck-off-expected.txt:
* editing/spelling/design-mode-spellcheck-off.html:

* platform/gtk-wk2/TestExpectations:
* platform/gtk/TestExpectations:
Skip the test for GTK.

* platform/win/TestExpectations:
Add failing test expectation.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (164100 => 164101)


--- trunk/LayoutTests/ChangeLog	2014-02-14 12:26:54 UTC (rev 164100)
+++ trunk/LayoutTests/ChangeLog	2014-02-14 13:57:53 UTC (rev 164101)
@@ -1,5 +1,33 @@
 2014-02-14  Grzegorz Czajkowski  <g.czajkow...@samsung.com>
 
+        Refactoring design-mode-spellcheck-off.html to use asynchronous spellchecking
+        https://bugs.webkit.org/show_bug.cgi?id=127770
+
+        Reviewed by Ryosuke Niwa.
+
+        Enable asynchronous spellchecking in design-mode-spellcheck-off.html.
+
+        Due to js-test-pre.js adds some HTML elements inside the BODY, the misspelled
+        phrase was moved into separated div element. It allows to check spelling marker
+        on desired element instead of whole body.
+
+        It turned out that the test does not underline "asdf" as misspelled although
+        spellcheck attribute is on. To force spellchecking, the caret needs to be moved
+        out of the misspelled word. To be more reliable, the test now contains two test
+        cases in 'desingMode=on' when spellcheck attribute is off and on.
+
+        * editing/spelling/design-mode-spellcheck-off-expected.txt:
+        * editing/spelling/design-mode-spellcheck-off.html:
+
+        * platform/gtk-wk2/TestExpectations:
+        * platform/gtk/TestExpectations:
+        Skip the test for GTK.
+
+        * platform/win/TestExpectations:
+        Add failing test expectation.
+
+2014-02-14  Grzegorz Czajkowski  <g.czajkow...@samsung.com>
+
         Use asynchronous spellchecking in spelling-hasspellingmarker.js
         https://bugs.webkit.org/show_bug.cgi?id=128526
 

Modified: trunk/LayoutTests/editing/spelling/design-mode-spellcheck-off-expected.txt (164100 => 164101)


--- trunk/LayoutTests/editing/spelling/design-mode-spellcheck-off-expected.txt	2014-02-14 12:26:54 UTC (rev 164100)
+++ trunk/LayoutTests/editing/spelling/design-mode-spellcheck-off-expected.txt	2014-02-14 13:57:53 UTC (rev 164101)
@@ -1,4 +1,12 @@
+This tests whether WebKit does not spell check in 'designMode' when spellcheck='false'. To test manually, click arround 'asdf'. There should be no spelling marker for 'asdf' after the click.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS internals.hasSpellingMarker(0, 4) became false
+document.body.setAttribute("spellcheck", "true")
+PASS internals.hasSpellingMarker(0, 4) became different from false
+PASS successfullyParsed is true
+
+TEST COMPLETE
 asdf is misspelled.
-To test this manually, click "asdf" above. There should be no spelling marker for "asdf" after the click.
-
-PASS

Modified: trunk/LayoutTests/editing/spelling/design-mode-spellcheck-off.html (164100 => 164101)


--- trunk/LayoutTests/editing/spelling/design-mode-spellcheck-off.html	2014-02-14 12:26:54 UTC (rev 164100)
+++ trunk/LayoutTests/editing/spelling/design-mode-spellcheck-off.html	2014-02-14 13:57:53 UTC (rev 164101)
@@ -1,39 +1,49 @@
 <!DOCTYPE html>
 <html>
-<body spellcheck="false"> 
-asdf is misspelled.
-<p>To test this manually, click "asdf" above. There should be no spelling marker for "asdf" after the click.</p>
+<body spellcheck="false">
+<script src=""
+<script src=""
+<div id="misspelled" _onmouseup_="checkSpellingMarker()">asdf is misspelled.</div>
 <script>
+description("This tests whether WebKit does not spell check in 'designMode' "
+    + "when spellcheck='false'. To test manually, click arround 'asdf'. "
+    + "There should be no spelling marker for 'asdf' after the click.");
 
-if (window.testRunner)
-    testRunner.dumpAsText();
+jsTestIsAsync = true;
 
+if (window.internals) {
+    internals.settings.setUnifiedTextCheckerEnabled(true);
+    internals.settings.setAsynchronousSpellCheckingEnabled(true);
+}
+
 document.designMode = "on";
 
-if (document.activeElement != document.body)
-    document.body.appendChild(document.createTextNode('FAIL: active element before click is not body element'));
-else if (window.testRunner && window.eventSender) {
-    testRunner.waitUntilDone();
+function checkSpellingMarker()
+{
+    // First, verify spelling with spellcheck attribute off.
+    // Move selection to the next word to notify WebKit that "asdf" has been typed/changed
+    // to give a chance to spellcheck.
+    moveSelectionForwardByWordCommand();
 
-    document.body.addEventListener('mousedown', function() {
-        if (document.activeElement != document.body)
-            document.body.appendChild(document.createTextNode('FAIL: active element after click is not body element'));
-        else if (internals.hasSpellingMarker(0, 4))
-            document.body.appendChild(document.createTextNode('FAIL: spell check was invoked'));
-        else
-            document.body.appendChild(document.createTextNode('PASS'));
-        testRunner.notifyDone();
-    });
+    if (window.internals) {
+        shouldBecomeEqual('internals.hasSpellingMarker(0, 4)', 'false', function() {
+            evalAndLog('document.body.setAttribute("spellcheck", "true")');
+            // Do any selection change to force spellchecking after attribute change.
+            moveSelectionForwardByLineCommand();
+            shouldBecomeDifferent('internals.hasSpellingMarker(0, 4)', 'false', finishJSTest);
+        });
+    }
+}
 
-    var x = document.body.offsetLeft + 10;
-    var y = document.body.offsetTop + 10;
+if (window.eventSender) {
+    var misspelledDiv = document.getElementById("misspelled");
+    var x = misspelledDiv.offsetLeft;
+    var y = misspelledDiv.offsetTop;
     eventSender.mouseMoveTo(x, y);
     eventSender.mouseDown();
     eventSender.mouseUp();
-    setTimeout("testRunner.notifyDone();document.body.appendChild(document.createTextNode('FAIL: timeout'));", 500);
-} else
-    document.body.appendChild(document.createTextNode('PASS'));
-
+}
 </script> 
+<script src=""
 </body>
 </html>

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (164100 => 164101)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2014-02-14 12:26:54 UTC (rev 164100)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2014-02-14 13:57:53 UTC (rev 164101)
@@ -1145,6 +1145,7 @@
 Bug(GTK) editing/spelling/markers.html [ Skip ]
 
 # Missing asynchronous spellchecking implementation.
+Bug(GTK) editing/spelling/design-mode-spellcheck-off.html [ Skip ]
 Bug(GTK) editing/spelling/spelling-hasspellingmarker.html [ Skip ]
 
 # testRunner.overridePreference("WebKitDefaultFontSize"...) does not take into account screen DPI

Modified: trunk/LayoutTests/platform/gtk-wk2/TestExpectations (164100 => 164101)


--- trunk/LayoutTests/platform/gtk-wk2/TestExpectations	2014-02-14 12:26:54 UTC (rev 164100)
+++ trunk/LayoutTests/platform/gtk-wk2/TestExpectations	2014-02-14 13:57:53 UTC (rev 164101)
@@ -159,7 +159,6 @@
 Bug(GTK) editing/spelling/context-menu-suggestions-multiword-selection.html [ Skip ]
 Bug(GTK) editing/spelling/context-menu-suggestions-subword-selection.html [ Skip ]
 Bug(GTK) editing/spelling/spelling-backspace-between-lines.html [ Skip ]
-Bug(GTK) editing/spelling/design-mode-spellcheck-off.html [ Skip ]
 Bug(GTK) editing/spelling/spellcheck-attribute.html [ Skip ]
 Bug(GTK) editing/spelling/spelling-attribute-at-child.html [ Skip ]
 Bug(GTK) editing/spelling/spelling-attribute-change.html [ Skip ]

Modified: trunk/LayoutTests/platform/win/TestExpectations (164100 => 164101)


--- trunk/LayoutTests/platform/win/TestExpectations	2014-02-14 12:26:54 UTC (rev 164100)
+++ trunk/LayoutTests/platform/win/TestExpectations	2014-02-14 13:57:53 UTC (rev 164101)
@@ -2449,6 +2449,7 @@
 media/W3C/video/events/event_canplaythrough.html
 
 # Spellchecker behavior tests.
+webkit.org/b/108370 editing/spelling/design-mode-spellcheck-off.html [ Failure ]
 webkit.org/b/108370 editing/spelling/context-menu-suggestions-multiword-selection.html [ Failure ]
 webkit.org/b/108370 editing/spelling/context-menu-suggestions-subword-selection.html [ Failure ]
 webkit.org/b/108370 editing/spelling/spelling-double-clicked-word.html [ Failure ]
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to