Title: [163529] trunk/LayoutTests
Revision
163529
Author
[email protected]
Date
2014-02-06 02:50:58 -0800 (Thu, 06 Feb 2014)

Log Message

Verify copy/paste of misspellings asynchronously
https://bugs.webkit.org/show_bug.cgi?id=128246

Reviewed by Ryosuke Niwa.

Refactoring two spelling tests that use copy/paste to be able to
verify spelling markers asynchronously.
Additionally, use evalAndLog() to make test expectation more readable.
Fix the description according to the tests.

Start off verifying whether spelling marker is available when continuous spell
checking (spellcheck attribute, respectively) is on.
Without this test case, the tests passed even spellchecking
or copy/paste were not implemented (EFL).

* editing/spelling/spellcheck-paste-continuous-disabled-expected.txt:
* editing/spelling/spellcheck-paste-continuous-disabled.html:
Remove unnecessary spellcheck=true attribute. It's default value and we
do not manipulate it at all.
Add destination element where paste operation is performed.

* editing/spelling/spellcheck-paste-disabled-expected.txt:
* editing/spelling/spellcheck-paste-disabled.html:

* platform/efl/TestExpectations:
Mark spellcheck-paste-continuous-disabled.html as failing since EFL does not
implement copy/paste feature.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (163528 => 163529)


--- trunk/LayoutTests/ChangeLog	2014-02-06 10:05:00 UTC (rev 163528)
+++ trunk/LayoutTests/ChangeLog	2014-02-06 10:50:58 UTC (rev 163529)
@@ -1,3 +1,33 @@
+2014-02-06  Grzegorz Czajkowski  <[email protected]>
+
+        Verify copy/paste of misspellings asynchronously
+        https://bugs.webkit.org/show_bug.cgi?id=128246
+
+        Reviewed by Ryosuke Niwa.
+
+        Refactoring two spelling tests that use copy/paste to be able to
+        verify spelling markers asynchronously.
+        Additionally, use evalAndLog() to make test expectation more readable.
+        Fix the description according to the tests.
+
+        Start off verifying whether spelling marker is available when continuous spell
+        checking (spellcheck attribute, respectively) is on.
+        Without this test case, the tests passed even spellchecking
+        or copy/paste were not implemented (EFL).
+
+        * editing/spelling/spellcheck-paste-continuous-disabled-expected.txt:
+        * editing/spelling/spellcheck-paste-continuous-disabled.html:
+        Remove unnecessary spellcheck=true attribute. It's default value and we
+        do not manipulate it at all.
+        Add destination element where paste operation is performed.
+
+        * editing/spelling/spellcheck-paste-disabled-expected.txt:
+        * editing/spelling/spellcheck-paste-disabled.html:
+
+        * platform/efl/TestExpectations:
+        Mark spellcheck-paste-continuous-disabled.html as failing since EFL does not
+        implement copy/paste feature.
+
 2014-02-06  László Langó  <[email protected]>
 
         Create a HTMLUnknownElement when using createElement('image')

Modified: trunk/LayoutTests/editing/spelling/spellcheck-paste-continuous-disabled-expected.txt (163528 => 163529)


--- trunk/LayoutTests/editing/spelling/spellcheck-paste-continuous-disabled-expected.txt	2014-02-06 10:05:00 UTC (rev 163528)
+++ trunk/LayoutTests/editing/spelling/spellcheck-paste-continuous-disabled-expected.txt	2014-02-06 10:50:58 UTC (rev 163529)
@@ -1,12 +1,23 @@
-Test if WebKit does not spellcheck text when pasting text and continuous spellcheck is turned off. To test manually, disable continuous spellcheck, copy the text "zz apple" and paste it to the textarea. When "zz" is not marked as misspelled, this test succeeds.
+Test if WebKit does not spellcheck text when pasting text and continuous spellcheck is turned off. To test manually, copy the text "zz apple", disable continuous spellcheck and paste it to editable element below. When "zz" is not marked as misspelled, this test succeeds.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS internals.hasSpellingMarker(0, 2) is true
-PASS internals.hasSpellingMarker(0, 2) is false
+document.execCommand("InsertText", false, "z")
+document.execCommand("InsertText", false, "z")
+document.execCommand("InsertText", false, " ")
+document.execCommand("InsertText", false, "a")
+document.execCommand("InsertText", false, "p")
+document.execCommand("InsertText", false, "p")
+document.execCommand("InsertText", false, "l")
+document.execCommand("InsertText", false, "e")
+PASS internals.hasSpellingMarker(0, 2) became true
+document.execCommand('Copy')
+internals.setContinuousSpellCheckingEnabled(false)
+document.execCommand('Paste')
+PASS internals.hasSpellingMarker(0, 2) became different from true
 PASS successfullyParsed is true
 
 TEST COMPLETE
 zz apple
-
+zz apple

Modified: trunk/LayoutTests/editing/spelling/spellcheck-paste-continuous-disabled.html (163528 => 163529)


--- trunk/LayoutTests/editing/spelling/spellcheck-paste-continuous-disabled.html	2014-02-06 10:05:00 UTC (rev 163528)
+++ trunk/LayoutTests/editing/spelling/spellcheck-paste-continuous-disabled.html	2014-02-06 10:50:58 UTC (rev 163529)
@@ -6,33 +6,46 @@
 </head>
 <body>
 <div>
-<div id="src" contenteditable="true" spellcheck="true"></div>
+<div id="src" contenteditable="true"></div>
+<div id="dst" contenteditable="true"></div>
 </div>
 <script language="_javascript_">
 description('Test if WebKit does not spellcheck text when pasting text and continuous spellcheck is turned off. ' +
-            'To test manually, disable continuous spellcheck, copy the text "zz apple" and paste it to the textarea. ' +
+            'To test manually, copy the text "zz apple", disable continuous spellcheck and paste it to editable element below. ' +
             'When "zz" is not marked as misspelled, this test succeeds.');
 
-// Insert a misspelled word to initialize a spellchecker.
+jsTestIsAsync = true;
+
+if (window.internals) {
+    internals.settings.setUnifiedTextCheckerEnabled(true);
+    internals.settings.setAsynchronousSpellCheckingEnabled(true);
+}
+
 var srcNode = document.getElementById('src');
 srcNode.focus();
-document.execCommand("InsertText", false, 'z');
-document.execCommand("InsertText", false, 'z');
-document.execCommand("InsertText", false, ' ');
-document.execCommand("InsertText", false, 'a');
-document.execCommand("InsertText", false, 'p');
-document.execCommand("InsertText", false, 'p');
-document.execCommand("InsertText", false, 'l');
-document.execCommand("InsertText", false, 'e');
-shouldBeTrue('internals.hasSpellingMarker(0, 2)');
-window.getSelection().selectAllChildren(srcNode);
-document.execCommand('Copy');
+evalAndLog('document.execCommand("InsertText", false, "z")');
+evalAndLog('document.execCommand("InsertText", false, "z")');
+evalAndLog('document.execCommand("InsertText", false, " ")');
+evalAndLog('document.execCommand("InsertText", false, "a")');
+evalAndLog('document.execCommand("InsertText", false, "p")');
+evalAndLog('document.execCommand("InsertText", false, "p")');
+evalAndLog('document.execCommand("InsertText", false, "l")');
+evalAndLog('document.execCommand("InsertText", false, "e")');
 
-internals.setContinuousSpellCheckingEnabled(false);
+if (window.internals) {
+    shouldBecomeEqual('internals.hasSpellingMarker(0, 2)', 'true', function() {
+        window.getSelection().selectAllChildren(srcNode);
+        evalAndLog("document.execCommand('Copy')");
 
-document.execCommand('Paste');
-shouldBeFalse('internals.hasSpellingMarker(0, 2)');
+        evalAndLog("internals.setContinuousSpellCheckingEnabled(false)");
 
+        var dstNode = document.getElementById('dst');
+        dstNode.focus();
+        evalAndLog("document.execCommand('Paste')");
+        shouldBecomeDifferent('internals.hasSpellingMarker(0, 2)', 'true', finishJSTest);
+     });
+}
+
 </script>
 <script src=""
 </body>

Modified: trunk/LayoutTests/editing/spelling/spellcheck-paste-disabled-expected.txt (163528 => 163529)


--- trunk/LayoutTests/editing/spelling/spellcheck-paste-disabled-expected.txt	2014-02-06 10:05:00 UTC (rev 163528)
+++ trunk/LayoutTests/editing/spelling/spellcheck-paste-disabled-expected.txt	2014-02-06 10:50:58 UTC (rev 163529)
@@ -3,11 +3,20 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS internals.hasSpellingMarker(0, 2) is true
-PASS internals.hasSpellingMarker(0, 2) is false
+document.execCommand("InsertText", false, "z")
+document.execCommand("InsertText", false, "z")
+document.execCommand("InsertText", false, " ")
+document.execCommand("InsertText", false, "a")
+document.execCommand("InsertText", false, "p")
+document.execCommand("InsertText", false, "p")
+document.execCommand("InsertText", false, "l")
+document.execCommand("InsertText", false, "e")
+PASS internals.hasSpellingMarker(0, 2) became true
+document.execCommand("Copy")
+document.execCommand("Paste")
+PASS internals.hasSpellingMarker(0, 2) became different from true
 PASS successfullyParsed is true
 
 TEST COMPLETE
 zz apple
-
 zz apple

Modified: trunk/LayoutTests/editing/spelling/spellcheck-paste-disabled.html (163528 => 163529)


--- trunk/LayoutTests/editing/spelling/spellcheck-paste-disabled.html	2014-02-06 10:05:00 UTC (rev 163528)
+++ trunk/LayoutTests/editing/spelling/spellcheck-paste-disabled.html	2014-02-06 10:50:58 UTC (rev 163529)
@@ -6,7 +6,7 @@
 </head>
 <body>
 <div>
-<div id="src" contenteditable="true" spellcheck="true"></div><br/>
+<div id="src" contenteditable="true" spellcheck="true"></div>
 <div id="dst" contenteditable="true" spellcheck="false"></div>
 </div>
 <script language="_javascript_">
@@ -14,26 +14,36 @@
             'To test manually, copy the text "zz apple" and paste it to the textarea. ' +
             'When "zz" is not marked as misspelled, this test succeeds.');
 
-// Insert a misspelled word to initialize a spellchecker.
+jsTestIsAsync = true;
+
+if (window.internals) {
+    internals.settings.setUnifiedTextCheckerEnabled(true);
+    internals.settings.setAsynchronousSpellCheckingEnabled(true);
+}
+
 var srcNode = document.getElementById('src');
 srcNode.focus();
-document.execCommand("InsertText", false, 'z');
-document.execCommand("InsertText", false, 'z');
-document.execCommand("InsertText", false, ' ');
-document.execCommand("InsertText", false, 'a');
-document.execCommand("InsertText", false, 'p');
-document.execCommand("InsertText", false, 'p');
-document.execCommand("InsertText", false, 'l');
-document.execCommand("InsertText", false, 'e');
-shouldBeTrue('internals.hasSpellingMarker(0, 2)');
-window.getSelection().selectAllChildren(srcNode);
-document.execCommand('Copy');
+evalAndLog('document.execCommand("InsertText", false, "z")');
+evalAndLog('document.execCommand("InsertText", false, "z")');
+evalAndLog('document.execCommand("InsertText", false, " ")');
+evalAndLog('document.execCommand("InsertText", false, "a")');
+evalAndLog('document.execCommand("InsertText", false, "p")');
+evalAndLog('document.execCommand("InsertText", false, "p")');
+evalAndLog('document.execCommand("InsertText", false, "l")');
+evalAndLog('document.execCommand("InsertText", false, "e")');
 
-var dstNode = document.getElementById('dst');
-dstNode.focus();
-document.execCommand('Paste');
-shouldBeFalse('internals.hasSpellingMarker(0, 2)');
+if (window.internals) {
+    shouldBecomeEqual('internals.hasSpellingMarker(0, 2)', 'true', function() {
+        window.getSelection().selectAllChildren(srcNode);
+        evalAndLog('document.execCommand("Copy")');
 
+        var dstNode = document.getElementById('dst');
+        dstNode.focus();
+        evalAndLog('document.execCommand("Paste")');
+        shouldBecomeDifferent('internals.hasSpellingMarker(0, 2)', 'true', finishJSTest);
+     });
+}
+
 </script>
 <script src=""
 </body>

Modified: trunk/LayoutTests/platform/efl/TestExpectations (163528 => 163529)


--- trunk/LayoutTests/platform/efl/TestExpectations	2014-02-06 10:05:00 UTC (rev 163528)
+++ trunk/LayoutTests/platform/efl/TestExpectations	2014-02-06 10:50:58 UTC (rev 163529)
@@ -890,6 +890,7 @@
 webkit.org/b/84338 editing/pasteboard/testcase-9507.html [ Failure ]
 webkit.org/b/84338 editing/spelling/spellcheck-async-mutation.html [ Failure ]
 webkit.org/b/84338 editing/spelling/spellcheck-queue.html [ Failure ]
+webkit.org/b/84338 editing/spelling/spellcheck-paste-continuous-disabled.html [ Failure ]
 webkit.org/b/84338 editing/spelling/spellcheck-paste-disabled.html [ Failure ]
 webkit.org/b/84338 editing/spelling/spellcheck-paste.html [ Failure ]
 webkit.org/b/84338 editing/style/apply-through-end-of-document.html [ Failure ]
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to