Title: [240883] trunk/LayoutTests
Revision
240883
Author
[email protected]
Date
2019-02-01 15:27:30 -0800 (Fri, 01 Feb 2019)

Log Message

Rewrite and rebaseline smart copy paste tests to work on iOS and MacOS
https://bugs.webkit.org/show_bug.cgi?id=194175

Reviewed by Megan Gardner.

Using the functions committed in 194070 Ryosuke wrote, make the
smart copy paste tests run on both iOS and MacOS.
These tests will be turned on in 193786.

* editing/editing.js:
(runEditingTestWithCallbackLogging):
(runDumpAsTextEditingTest):
* editing/pasteboard/smart-paste-001.html:
* editing/pasteboard/smart-paste-002-expected.txt:
* editing/pasteboard/smart-paste-002.html:
* editing/pasteboard/smart-paste-003.html:
* editing/pasteboard/smart-paste-004.html:
* editing/pasteboard/smart-paste-005-expected.txt:
* editing/pasteboard/smart-paste-005.html:
* editing/pasteboard/smart-paste-006-expected.txt:
* editing/pasteboard/smart-paste-006.html:
* editing/pasteboard/smart-paste-007.html:
* editing/pasteboard/smart-paste-008.html:
* platform/mac/editing/pasteboard/smart-paste-008-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (240882 => 240883)


--- trunk/LayoutTests/ChangeLog	2019-02-01 23:12:14 UTC (rev 240882)
+++ trunk/LayoutTests/ChangeLog	2019-02-01 23:27:30 UTC (rev 240883)
@@ -1,3 +1,31 @@
+2019-02-01  Megan Gardner  <[email protected]>
+
+        Rewrite and rebaseline smart copy paste tests to work on iOS and MacOS
+        https://bugs.webkit.org/show_bug.cgi?id=194175
+
+        Reviewed by Megan Gardner.
+        Patch by Ryosuke Niwa.
+
+        Using the functions committed in 194070 Ryosuke wrote, make the
+        smart copy paste tests run on both iOS and MacOS. 
+        These tests will be turned on in 193786.
+
+        * editing/editing.js:
+        (runEditingTestWithCallbackLogging):
+        (runDumpAsTextEditingTest):
+        * editing/pasteboard/smart-paste-001.html:
+        * editing/pasteboard/smart-paste-002-expected.txt:
+        * editing/pasteboard/smart-paste-002.html:
+        * editing/pasteboard/smart-paste-003.html:
+        * editing/pasteboard/smart-paste-004.html:
+        * editing/pasteboard/smart-paste-005-expected.txt:
+        * editing/pasteboard/smart-paste-005.html:
+        * editing/pasteboard/smart-paste-006-expected.txt:
+        * editing/pasteboard/smart-paste-006.html:
+        * editing/pasteboard/smart-paste-007.html:
+        * editing/pasteboard/smart-paste-008.html:
+        * platform/mac/editing/pasteboard/smart-paste-008-expected.txt:
+
 2019-02-01  Wenson Hsieh  <[email protected]>
 
         [iOS] Consistent 1 sec hang when triggering modal alerts while handling synchronous touch events

Modified: trunk/LayoutTests/editing/editing.js (240882 => 240883)


--- trunk/LayoutTests/editing/editing.js	2019-02-01 23:12:14 UTC (rev 240882)
+++ trunk/LayoutTests/editing/editing.js	2019-02-01 23:27:30 UTC (rev 240883)
@@ -924,7 +924,17 @@
     var elem = document.getElementById("test");
     var selection = window.getSelection();
     selection.setPosition(elem, 0);
-    editingTest();
+    
+    const result = editingTest();
+ 
+    if (result instanceof Promise) {
+        if (window.testRunner)
+            testRunner.waitUntilDone();
+        result.then(() => {
+            if (window.testRunner)
+                testRunner.notifyDone();
+        });
+    }
 }
 
 var dumpAsText = false;
@@ -942,7 +952,7 @@
     var elem = document.getElementById("test");
     var selection = window.getSelection();
     selection.setPosition(elem, 0);
-    editingTest();
+    const result = editingTest();
 
     for (var i = 0; i < elementsForDumpingMarkupList.length; i++)
         document.body.appendChild(elementsForDumpingMarkupList[i]);

Modified: trunk/LayoutTests/editing/pasteboard/smart-paste-001.html (240882 => 240883)


--- trunk/LayoutTests/editing/pasteboard/smart-paste-001.html	2019-02-01 23:12:14 UTC (rev 240882)
+++ trunk/LayoutTests/editing/pasteboard/smart-paste-001.html	2019-02-01 23:27:30 UTC (rev 240883)
@@ -39,10 +39,11 @@
 </div>
 </div>
 <script src=""
+<script src=""
 <script>
 
-function editingTest() {
-    doubleClickAtSelectionStart();
+async function editingTest() {
+    await UIHelper.selectWordByDoubleTapOrClick(document.getElementById('test'));
     copyCommand();
     moveSelectionForwardByCharacterCommand();
     pasteCommand();

Modified: trunk/LayoutTests/editing/pasteboard/smart-paste-002-expected.txt (240882 => 240883)


--- trunk/LayoutTests/editing/pasteboard/smart-paste-002-expected.txt	2019-02-01 23:12:14 UTC (rev 240882)
+++ trunk/LayoutTests/editing/pasteboard/smart-paste-002-expected.txt	2019-02-01 23:27:30 UTC (rev 240883)
@@ -1,11 +1,9 @@
 EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 3 of DIV > BODY > HTML > #document
 EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 9 of #text > DIV > DIV > BODY > HTML > #document to 9 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE

Modified: trunk/LayoutTests/editing/pasteboard/smart-paste-002.html (240882 => 240883)


--- trunk/LayoutTests/editing/pasteboard/smart-paste-002.html	2019-02-01 23:12:14 UTC (rev 240882)
+++ trunk/LayoutTests/editing/pasteboard/smart-paste-002.html	2019-02-01 23:27:30 UTC (rev 240883)
@@ -39,13 +39,11 @@
 </div>
 </div>
 <script src=""
+<script src=""
 <script>
 
-function editingTest() {
-    var target = document.getElementById('test');
-    var x = target.offsetLeft + target.offsetWidth / 2;
-    var y = target.offsetTop + target.offsetHeight / 2;
-    doubleClick(x, y);
+async function editingTest() {
+    await UIHelper.selectWordByDoubleTapOrClick(document.getElementById('test'));
     copyCommand();
     moveSelectionBackwardByWordCommand();
     pasteCommand();

Modified: trunk/LayoutTests/editing/pasteboard/smart-paste-003.html (240882 => 240883)


--- trunk/LayoutTests/editing/pasteboard/smart-paste-003.html	2019-02-01 23:12:14 UTC (rev 240882)
+++ trunk/LayoutTests/editing/pasteboard/smart-paste-003.html	2019-02-01 23:27:30 UTC (rev 240883)
@@ -40,10 +40,11 @@
 </div>
 </div>
 <script src=""
+<script src=""
 <script>
 
-function editingTest() {
-    doubleClickAtSelectionStart();
+async function editingTest() {
+    await UIHelper.selectWordByDoubleTapOrClick(document.getElementById('test'));
     copyCommand();
     moveSelectionForwardByCharacterCommand();
     pasteCommand();

Modified: trunk/LayoutTests/editing/pasteboard/smart-paste-004.html (240882 => 240883)


--- trunk/LayoutTests/editing/pasteboard/smart-paste-004.html	2019-02-01 23:12:14 UTC (rev 240882)
+++ trunk/LayoutTests/editing/pasteboard/smart-paste-004.html	2019-02-01 23:27:30 UTC (rev 240883)
@@ -39,10 +39,11 @@
 </div>
 </div>
 <script src=""
+<script src=""
 <script>
 
-function editingTest() {
-    doubleClickAtSelectionStart();
+async function editingTest() {
+    await UIHelper.selectWordByDoubleTapOrClick(document.getElementById('test'));
     copyCommand();
     moveSelectionForwardByCharacterCommand();
     moveSelectionForwardByCharacterCommand();

Modified: trunk/LayoutTests/editing/pasteboard/smart-paste-005-expected.txt (240882 => 240883)


--- trunk/LayoutTests/editing/pasteboard/smart-paste-005-expected.txt	2019-02-01 23:12:14 UTC (rev 240882)
+++ trunk/LayoutTests/editing/pasteboard/smart-paste-005-expected.txt	2019-02-01 23:27:30 UTC (rev 240883)
@@ -1,13 +1,11 @@
 EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 3 of DIV > BODY > HTML > #document
 EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 5 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 3 of #text > DIV > DIV > BODY > HTML > #document to 3 of #text > DIV > DIV > BODY > HTML > #document givenAction:WebViewInsertActionPasted
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 11 of #text > DIV > DIV > BODY > HTML > #document to 11 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 9 of #text > DIV > DIV > BODY > HTML > #document to 9 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE

Modified: trunk/LayoutTests/editing/pasteboard/smart-paste-005.html (240882 => 240883)


--- trunk/LayoutTests/editing/pasteboard/smart-paste-005.html	2019-02-01 23:12:14 UTC (rev 240882)
+++ trunk/LayoutTests/editing/pasteboard/smart-paste-005.html	2019-02-01 23:27:30 UTC (rev 240883)
@@ -40,13 +40,11 @@
 </div>
 </div>
 <script src=""
+<script src=""
 <script>
 
-function editingTest() {
-    var target = document.getElementById('test');
-    var x = target.offsetLeft + target.offsetWidth / 2;
-    var y = target.offsetTop + target.offsetHeight / 2;
-    doubleClick(x, y);
+async function editingTest() {
+    await UIHelper.selectWordByDoubleTapOrClick(document.getElementById('test'));
     copyCommand();
     moveSelectionBackwardByWordCommand();
     moveSelectionForwardByCharacterCommand();

Modified: trunk/LayoutTests/editing/pasteboard/smart-paste-006-expected.txt (240882 => 240883)


--- trunk/LayoutTests/editing/pasteboard/smart-paste-006-expected.txt	2019-02-01 23:12:14 UTC (rev 240882)
+++ trunk/LayoutTests/editing/pasteboard/smart-paste-006-expected.txt	2019-02-01 23:27:30 UTC (rev 240883)
@@ -1,6 +1,7 @@
 EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 3 of DIV > BODY > HTML > #document
 EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: shouldDeleteDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 5 of #text > DIV > DIV > BODY > HTML > #document
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification

Modified: trunk/LayoutTests/editing/pasteboard/smart-paste-006.html (240882 => 240883)


--- trunk/LayoutTests/editing/pasteboard/smart-paste-006.html	2019-02-01 23:12:14 UTC (rev 240882)
+++ trunk/LayoutTests/editing/pasteboard/smart-paste-006.html	2019-02-01 23:27:30 UTC (rev 240883)
@@ -40,11 +40,11 @@
 </div>
 </div>
 <script src=""
+<script src=""
 <script>
 
-function editingTest() {
-    extendSelectionForwardByWordCommand();
-    cutCommand();
+async function editingTest() {
+    await UIHelper.selectWordByDoubleTapOrClick(document.getElementById('test'));    cutCommand();
     typeCharacterCommand('-');
     typeCharacterCommand('-');
     moveSelectionBackwardByCharacterCommand();

Modified: trunk/LayoutTests/editing/pasteboard/smart-paste-007.html (240882 => 240883)


--- trunk/LayoutTests/editing/pasteboard/smart-paste-007.html	2019-02-01 23:12:14 UTC (rev 240882)
+++ trunk/LayoutTests/editing/pasteboard/smart-paste-007.html	2019-02-01 23:27:30 UTC (rev 240883)
@@ -16,15 +16,13 @@
 .scenario:first-line { font-weight: bold; margin-bottom: 16px;}
 .expected-results:first-line { font-weight: bold }
 </style>
-<script src="" language="_javascript_" type="text/_javascript_" ></script>
+<script src=""
+<script src=""
 
 <script>
 
-function editingTest() {
-    var target = document.getElementById('test');
-    var x = target.offsetLeft;
-    var y = target.offsetTop + target.offsetHeight / 2;
-    doubleClick(x, y);
+async function editingTest() {
+    await UIHelper.selectWordByDoubleTapOrClick(document.getElementById('test'));
     cutCommand();
     typeCharacterCommand('.');
     typeCharacterCommand('.');

Modified: trunk/LayoutTests/editing/pasteboard/smart-paste-008.html (240882 => 240883)


--- trunk/LayoutTests/editing/pasteboard/smart-paste-008.html	2019-02-01 23:12:14 UTC (rev 240882)
+++ trunk/LayoutTests/editing/pasteboard/smart-paste-008.html	2019-02-01 23:27:30 UTC (rev 240883)
@@ -6,16 +6,20 @@
 <p>A smart paste is performed into a selection starting in one block and ending in another.  Spaces should surround the pasted word.</p>
 <div id="test" contenteditable="true"><div>foo</div><div>x bar</div></div>
 
-<script type="text/_javascript_" src=""
+<script src=""
+<script src=""
 <script>
-var s = window.getSelection();
 var e = document.getElementById("test");
 
-setSelectionCommand(e, 0, e, 0);
-doubleClickAtSelectionStart();
-copyCommand();
-moveSelectionBackwardByCharacterCommand();
-moveSelectionForwardByCharacterCommand();
-extendSelectionForwardByLineCommand();
-pasteCommand();
+async function runTest() {
+    getSelection().setBaseAndExtent(e, 0, e, 0);
+    await UIHelper.selectWordByDoubleTapOrClick(document.getElementById('test'));
+    copyCommand();
+    moveSelectionBackwardByCharacterCommand();
+    moveSelectionForwardByCharacterCommand();
+    extendSelectionForwardByLineCommand();
+    pasteCommand();
+}
+
+UIHelper.wait(runTest());
 </script>

Modified: trunk/LayoutTests/platform/mac/editing/pasteboard/smart-paste-008-expected.txt (240882 => 240883)


--- trunk/LayoutTests/platform/mac/editing/pasteboard/smart-paste-008-expected.txt	2019-02-01 23:12:14 UTC (rev 240882)
+++ trunk/LayoutTests/platform/mac/editing/pasteboard/smart-paste-008-expected.txt	2019-02-01 23:27:30 UTC (rev 240883)
@@ -1,9 +1,9 @@
 EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 2 of DIV > BODY > HTML > #document
 EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of DIV > DIV > BODY > HTML > #document to 0 of DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > DIV > BODY > HTML > #document to 3 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of #text > DIV > DIV > BODY > HTML > #document to 1 of #text > DIV > DIV > BODY > HTML > #document toDOMRange:range from 0 of #text > DIV > DIV > BODY > HTML > #document to 3 of #text > DIV > DIV > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to