Title: [260909] trunk/LayoutTests
Revision
260909
Author
[email protected]
Date
2020-04-29 12:12:15 -0700 (Wed, 29 Apr 2020)

Log Message

editing/selection/ios/selection-handles-after-touch-end.html is failing on iOS 13.4 after r260367
https://bugs.webkit.org/show_bug.cgi?id=211185
<rdar://problem/62560030>

Reviewed by Tim Horton.

Clean up a test and test expectation after r260367. Before this change, the test was trying to verify
that selection handles didn't show up before ending a long press when selecting text. However, the test
expectation in platform/ios/editing/selection/ios/selection-handles-after-touch-end-expected.txt prior
to r260367, which overrode editing/selection/ios/selection-handles-after-touch-end-expected.txt, was
verifying that selection handles showed up after making the text selection, but before ending the touch.
r260367 removed this redundant test expectation in favor of a single test expectation file in
editing/selection/ios, but did not transfer over the expectation of non-empty grabber rects before
ending the touch. This is because the version of the iOS SDK I was testing against happened to _not_
show selection handles before ending the touch.

In a more recent version of that iOS SDK, selection handles are now shown again before ending the touch,
which matches behavior expected in iOS 13.4 once again. This means that the expectation across both
versions of iOS is, once again, to show selection handles before ending the touch. As such, fix this
failing test by refactoring it to only verify that selection handles are present after ending the touch.
We can also take this opportunity to rewrite parts of the test to use more modern idioms, like the
testing facilities in `js-test.js` and `ui-helper.js`.

* editing/selection/ios/selection-handles-after-touch-end-expected.txt:
* editing/selection/ios/selection-handles-after-touch-end.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (260908 => 260909)


--- trunk/LayoutTests/ChangeLog	2020-04-29 19:01:50 UTC (rev 260908)
+++ trunk/LayoutTests/ChangeLog	2020-04-29 19:12:15 UTC (rev 260909)
@@ -1,3 +1,31 @@
+2020-04-29  Wenson Hsieh  <[email protected]>
+
+        editing/selection/ios/selection-handles-after-touch-end.html is failing on iOS 13.4 after r260367
+        https://bugs.webkit.org/show_bug.cgi?id=211185
+        <rdar://problem/62560030>
+
+        Reviewed by Tim Horton.
+
+        Clean up a test and test expectation after r260367. Before this change, the test was trying to verify
+        that selection handles didn't show up before ending a long press when selecting text. However, the test
+        expectation in platform/ios/editing/selection/ios/selection-handles-after-touch-end-expected.txt prior
+        to r260367, which overrode editing/selection/ios/selection-handles-after-touch-end-expected.txt, was
+        verifying that selection handles showed up after making the text selection, but before ending the touch.
+        r260367 removed this redundant test expectation in favor of a single test expectation file in
+        editing/selection/ios, but did not transfer over the expectation of non-empty grabber rects before
+        ending the touch. This is because the version of the iOS SDK I was testing against happened to _not_
+        show selection handles before ending the touch.
+
+        In a more recent version of that iOS SDK, selection handles are now shown again before ending the touch,
+        which matches behavior expected in iOS 13.4 once again. This means that the expectation across both
+        versions of iOS is, once again, to show selection handles before ending the touch. As such, fix this
+        failing test by refactoring it to only verify that selection handles are present after ending the touch.
+        We can also take this opportunity to rewrite parts of the test to use more modern idioms, like the
+        testing facilities in `js-test.js` and `ui-helper.js`.
+
+        * editing/selection/ios/selection-handles-after-touch-end-expected.txt:
+        * editing/selection/ios/selection-handles-after-touch-end.html:
+
 2020-04-29  Kenneth Russell  <[email protected]>
 
         REGRESSION (r256784?): Shadertoy demo no longer works in Safari

Modified: trunk/LayoutTests/editing/selection/ios/selection-handles-after-touch-end-expected.txt (260908 => 260909)


--- trunk/LayoutTests/editing/selection/ios/selection-handles-after-touch-end-expected.txt	2020-04-29 19:01:50 UTC (rev 260908)
+++ trunk/LayoutTests/editing/selection/ios/selection-handles-after-touch-end-expected.txt	2020-04-29 19:12:15 UTC (rev 260909)
@@ -1,11 +1,25 @@
 WK
 
-Selection rects before touchend:
-{ left = 0, top = 3, width = 250, height = 167 }
-Selection start handle before touchend: { left = 0, top = 0, width = 0, height = 0 }
-Selection end handle before touchend: { left = 0, top = 0, width = 0, height = 0 }
+This test verifies that selection handles are present after selecting a word via long press. To manually test, long press the word 'WK' until a selection highlight is shown, and verify that selection handles are present after ending the touch.
 
-Selection rects after touchend:
-{ left = 0, top = 3, width = 250, height = 167 }
-Selection start handle after touchend: { left = 0, top = 3, width = 2, height = 167 }
-Selection end handle after touchend: { left = 249, top = 3, width = 2, height = 167 }
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS selectionRects.length is 1
+PASS Math.round(selectionRects[0].left) is 0
+PASS Math.round(selectionRects[0].top) is 3
+PASS Math.round(selectionRects[0].width) is 250
+PASS Math.round(selectionRects[0].height) is 167
+PASS Math.round(startGrabberRect.left) is 0
+PASS Math.round(startGrabberRect.top) is 3
+PASS Math.round(startGrabberRect.width) is 2
+PASS Math.round(startGrabberRect.height) is 167
+PASS Math.round(endGrabberRect.left) is 249
+PASS Math.round(endGrabberRect.top) is 3
+PASS Math.round(endGrabberRect.width) is 2
+PASS Math.round(endGrabberRect.height) is 167
+PASS observedTouchEnd became true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Modified: trunk/LayoutTests/editing/selection/ios/selection-handles-after-touch-end.html (260908 => 260909)


--- trunk/LayoutTests/editing/selection/ios/selection-handles-after-touch-end.html	2020-04-29 19:01:50 UTC (rev 260908)
+++ trunk/LayoutTests/editing/selection/ios/selection-handles-after-touch-end.html	2020-04-29 19:12:15 UTC (rev 260909)
@@ -1,6 +1,7 @@
 <html>
 <head>
 <script src=""
+<script src=""
 <meta name=viewport content="width=device-width">
 <style>
     body, html {
@@ -17,59 +18,44 @@
 
 <body>
 <p id="target">WK</p>
-<pre id="output"></pre>
+<p id="description"></p>
+<p id="console"></p>
 <script>
-if (window.testRunner) {
-    testRunner.dumpAsText();
-    testRunner.waitUntilDone();
-}
+jsTestIsAsync = true;
+observedTouchEnd = false;
 
-function appendOutput(s)
-{
-    const paragraph = document.createElement("div");
-    paragraph.textContent = s;
-    output.appendChild(paragraph);
-}
+document.addEventListener("touchend", async () => {
+    selectionRects = await UIHelper.getUISelectionRects();
+    shouldBe("selectionRects.length", "1");
+    shouldBe("Math.round(selectionRects[0].left)", "0");
+    shouldBe("Math.round(selectionRects[0].top)", "3");
+    shouldBe("Math.round(selectionRects[0].width)", "250");
+    shouldBe("Math.round(selectionRects[0].height)", "167");
 
-function toString(rect)
-{
-    return `{ left = ${Math.round(rect.left)}, top = ${Math.round(rect.top)}, width = ${Math.round(rect.width)}, height = ${Math.round(rect.height)} }`;
-}
+    startGrabberRect = await UIHelper.getSelectionStartGrabberViewRect();
+    shouldBe("Math.round(startGrabberRect.left)", "0");
+    shouldBe("Math.round(startGrabberRect.top)", "3");
+    shouldBe("Math.round(startGrabberRect.width)", "2");
+    shouldBe("Math.round(startGrabberRect.height)", "167");
 
-function checkDone() {
-    if (!window.doneCount)
-        doneCount = 0;
-    if (++doneCount == 3)
-        testRunner.notifyDone();
-}
+    endGrabberRect = await UIHelper.getSelectionEndGrabberViewRect();
+    shouldBe("Math.round(endGrabberRect.left)", "249");
+    shouldBe("Math.round(endGrabberRect.top)", "3");
+    shouldBe("Math.round(endGrabberRect.width)", "2");
+    shouldBe("Math.round(endGrabberRect.height)", "167");
 
-document.addEventListener("selectionchange", async () => {
-    if (!getSelection().rangeCount || getSelection().getRangeAt(0).collapsed)
+    observedTouchEnd = true;
+});
+
+description("This test verifies that selection handles are present after selecting a word via long press. To manually test, long press the word 'WK' until a selection highlight is shown, and verify that selection handles are present after ending the touch.");
+
+addEventListener("load", async () => {
+    if (!window.testRunner)
         return;
 
-    appendOutput("Selection rects before touchend:");
-    (await UIHelper.getUISelectionRects()).map(toString).map(appendOutput);
-    appendOutput(`Selection start handle before touchend: ${toString(await UIHelper.getSelectionStartGrabberViewRect())}`);
-    appendOutput(`Selection end handle before touchend: ${toString(await UIHelper.getSelectionEndGrabberViewRect())}`);
-    appendOutput("\n");
-    testRunner.runUIScript("uiController.liftUpAtPoint(100, 75, 1, () => uiController.uiScriptComplete(''));", checkDone);
+    await UIHelper.longPressElement(target);
+    shouldBecomeEqual("observedTouchEnd", "true", finishJSTest);
 });
-
-document.addEventListener("touchend", async () => {
-    appendOutput("Selection rects after touchend:");
-    (await UIHelper.getUISelectionRects()).map(toString).map(appendOutput);
-    appendOutput(`Selection start handle after touchend: ${toString(await UIHelper.getSelectionStartGrabberViewRect())}`);
-    appendOutput(`Selection end handle after touchend: ${toString(await UIHelper.getSelectionEndGrabberViewRect())}`);
-    checkDone();
-});
-
-if (window.testRunner && testRunner.runUIScript)
-    testRunner.runUIScript("uiController.touchDownAtPoint(100, 75, 1, () => uiController.uiScriptComplete(''));", checkDone);
-else {
-    appendOutput(`This test verifies that selection handles are not present when selecting a word via long press,
-        before ending the long press. To manually test, long press the word "WK" until a selection highlight is shown,
-        and verify that there are no selection handles. Upon release, selection handles should appear.`);
-}
 </script>
 </body>
 </html>
\ No newline at end of file
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to