Title: [248496] trunk/Tools
Revision
248496
Author
wenson_hs...@apple.com
Date
2019-08-09 21:00:23 -0700 (Fri, 09 Aug 2019)

Log Message

KeyboardInputTests.CaretSelectionRectAfterRestoringFirstResponder API tests time out on iPad
https://bugs.webkit.org/show_bug.cgi?id=200604
<rdar://problem/51273130>

Reviewed by Megan Gardner.

Tweak some API tests so that they work on iPad simulator. These tests checked that the final caret rect was
{{16, 13}, {2, 15}}; however, this is only correct behavior on iPhone, where we will scale the page so that the
focused element's font size is legible. Note that when the page is scaled, we scale the height but not the
width of the caret, which is why the width of the caret (in content coordinates) decreases while the height
remains the same.

We don't have the same behavior on iPad, so the expected caret rect is {{16, 13}, {3, 15}}, which is equal to
the caret rect at initial scale 1.

* TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (248495 => 248496)


--- trunk/Tools/ChangeLog	2019-08-10 03:19:52 UTC (rev 248495)
+++ trunk/Tools/ChangeLog	2019-08-10 04:00:23 UTC (rev 248496)
@@ -1,3 +1,22 @@
+2019-08-09  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        KeyboardInputTests.CaretSelectionRectAfterRestoringFirstResponder API tests time out on iPad
+        https://bugs.webkit.org/show_bug.cgi?id=200604
+        <rdar://problem/51273130>
+
+        Reviewed by Megan Gardner.
+
+        Tweak some API tests so that they work on iPad simulator. These tests checked that the final caret rect was
+        {{16, 13}, {2, 15}}; however, this is only correct behavior on iPhone, where we will scale the page so that the
+        focused element's font size is legible. Note that when the page is scaled, we scale the height but not the
+        width of the caret, which is why the width of the caret (in content coordinates) decreases while the height
+        remains the same.
+
+        We don't have the same behavior on iPad, so the expected caret rect is {{16, 13}, {3, 15}}, which is equal to
+        the caret rect at initial scale 1.
+
+        * TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm:
+
 2019-08-09  Ali Juma  <aj...@chromium.org>
 
         Don't allow cross-origin iframes to autofocus

Modified: trunk/Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm (248495 => 248496)


--- trunk/Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm	2019-08-10 03:19:52 UTC (rev 248495)
+++ trunk/Tools/TestWebKitAPI/Tests/ios/KeyboardInputTestsIOS.mm	2019-08-10 04:00:23 UTC (rev 248496)
@@ -325,7 +325,8 @@
 
 TEST(KeyboardInputTests, CaretSelectionRectAfterRestoringFirstResponderWithRetainActiveFocusedState)
 {
-    auto expectedCaretRect = CGRectMake(16, 13, 2, 15);
+    // This difference in caret width is due to the fact that we don't zoom in to the input field on iPad, but do on iPhone.
+    auto expectedCaretRect = CGRectMake(16, 13, UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad ? 3 : 2, 15);
     auto webView = webViewWithAutofocusedInput();
     EXPECT_WK_STREQ("INPUT", [webView stringByEvaluatingJavaScript:@"document.activeElement.tagName"]);
     [webView waitForCaretViewFrameToBecome:expectedCaretRect];
@@ -360,7 +361,8 @@
 
 TEST(KeyboardInputTests, CaretSelectionRectAfterRestoringFirstResponder)
 {
-    auto expectedCaretRect = CGRectMake(16, 13, 2, 15);
+    // This difference in caret width is due to the fact that we don't zoom in to the input field on iPad, but do on iPhone.
+    auto expectedCaretRect = CGRectMake(16, 13, UIDevice.currentDevice.userInterfaceIdiom == UIUserInterfaceIdiomPad ? 3 : 2, 15);
     auto webView = webViewWithAutofocusedInput();
     EXPECT_WK_STREQ("INPUT", [webView stringByEvaluatingJavaScript:@"document.activeElement.tagName"]);
     [webView waitForCaretViewFrameToBecome:expectedCaretRect];
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to