Title: [293742] trunk/LayoutTests
Revision
293742
Author
[email protected]
Date
2022-05-03 15:10:46 -0700 (Tue, 03 May 2022)

Log Message

[macOS] Make a couple of grammar checking tests more robust to system spell checker changes
https://bugs.webkit.org/show_bug.cgi?id=240034
rdar://92689657

Reviewed by Aditya Keerthi.

In some versions of macOS, feeding the following sentence to NSSpellChecker:

> "the the adlj adaasj sdklj. there there"

...no longer yields grammar errors at "the the" and "there there", due to presence of duplicated "the" and
"there", which causes a couple of layout tests to time out.

This patch works around the system changes by swizzling out spell checking results, such that we don't need to
rely on the default NSSpellChecker always tagging "the the" and "there there" as grammar errors.

* editing/spelling/inline-spelling-markers-hidpi.html:
* editing/spelling/inline-spelling-markers.html:

Canonical link: https://commits.webkit.org/250230@main

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (293741 => 293742)


--- trunk/LayoutTests/ChangeLog	2022-05-03 21:55:32 UTC (rev 293741)
+++ trunk/LayoutTests/ChangeLog	2022-05-03 22:10:46 UTC (rev 293742)
@@ -1,3 +1,24 @@
+2022-05-03  Wenson Hsieh  <[email protected]>
+
+        [macOS] Make a couple of grammar checking tests more robust to system spell checker changes
+        https://bugs.webkit.org/show_bug.cgi?id=240034
+        rdar://92689657
+
+        Reviewed by Aditya Keerthi.
+
+        In some versions of macOS, feeding the following sentence to NSSpellChecker:
+
+        > "the the adlj adaasj sdklj. there there"
+
+        ...no longer yields grammar errors at "the the" and "there there", due to presence of duplicated "the" and
+        "there", which causes a couple of layout tests to time out.
+
+        This patch works around the system changes by swizzling out spell checking results, such that we don't need to
+        rely on the default NSSpellChecker always tagging "the the" and "there there" as grammar errors.
+
+        * editing/spelling/inline-spelling-markers-hidpi.html:
+        * editing/spelling/inline-spelling-markers.html:
+
 2022-05-03  Truitt Savell  <[email protected]>
 
         Rebase fast/forms/select-list-box-with-height.html and fast/forms/control-restrict-line-height.html

Modified: trunk/LayoutTests/editing/spelling/inline-spelling-markers-hidpi.html (293741 => 293742)


--- trunk/LayoutTests/editing/spelling/inline-spelling-markers-hidpi.html	2022-05-03 21:55:32 UTC (rev 293741)
+++ trunk/LayoutTests/editing/spelling/inline-spelling-markers-hidpi.html	2022-05-03 22:10:46 UTC (rev 293742)
@@ -21,7 +21,8 @@
 </head>
 
 <body>
-<script src=""
+<script src=""
+<script src=""
 LTR
 <div id="testLTR" class="testDiv" contenteditable="true"></div>
 RTL
@@ -101,12 +102,27 @@
 
 if (window.testRunner) {
     testRunner.dumpAsText(true);
-    testRunner.setBackingScaleFactor(2, function () {
-        done();
-    });
+    UIHelper.setSpellCheckerResults({
+        "the the adlj adaasj sdklj. there there\u00A0" : [
+            { type : "spelling", from : 8, to : 12 },
+            { type : "spelling", from : 13, to : 19 },
+            { type : "spelling", from : 20, to : 25 },
+            {
+                type : "grammar",
+                from : 4,
+                to : 7,
+                details : [{ from : 0, to : 3 }]
+            },
+            {
+                type : "grammar",
+                from : 33,
+                to : 38,
+                details : [{ from : 0, to : 5 }]
+            }
+        ]
+    }).then(() => testRunner.setBackingScaleFactor(2, done));
 }
 
 </script>
-<script src=""
 </body>
 </html>

Modified: trunk/LayoutTests/editing/spelling/inline-spelling-markers.html (293741 => 293742)


--- trunk/LayoutTests/editing/spelling/inline-spelling-markers.html	2022-05-03 21:55:32 UTC (rev 293741)
+++ trunk/LayoutTests/editing/spelling/inline-spelling-markers.html	2022-05-03 22:10:46 UTC (rev 293742)
@@ -21,7 +21,8 @@
 </head>
 
 <body>
-<script src=""
+<script src=""
+<script src=""
 LTR
 <div id="testLTR" class="testDiv" contenteditable="true"></div>
 RTL
@@ -106,8 +107,26 @@
 
     finishJSTest();
 }
-done();
+
+UIHelper.setSpellCheckerResults({
+    "the the adlj adaasj sdklj. there there\u00A0" : [
+        { type : "spelling", from : 8, to : 12 },
+        { type : "spelling", from : 13, to : 19 },
+        { type : "spelling", from : 20, to : 25 },
+        {
+            type : "grammar",
+            from : 4,
+            to : 7,
+            details : [{ from : 0, to : 3 }]
+        },
+        {
+            type : "grammar",
+            from : 33,
+            to : 38,
+            details : [{ from : 0, to : 5 }]
+        }
+    ]
+}).then(done);
 </script>
-<script src=""
 </body>
 </html>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to