Several key event tests in fast/events/ios are failing after <rdar://problem/62197116>
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Jul 2020 02:35:46 +0000 (02:35 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Jul 2020 02:35:46 +0000 (02:35 +0000)
https://bugs.webkit.org/show_bug.cgi?id=213821
<rdar://problem/64821309>

Reviewed by Megan Gardner.

Source/WebKit:

Add an SPI method declaration.

* Platform/spi/ios/UIKitSPI.h:

Tools:

After the UIKit changes in <rdar://problem/62197116>, double tapping the Option key now enters dictation mode
by default, and additionally displays a modal popup prompting the user to set up dictation. Both of these
behaviors interfere with layout tests that attempt to press the option key twice in rapid succession, causing
them to time out or fail.

Fix this by setting the default that determines the modifier key to use as the dictation shortcut to -1, which
disables the dictation keyboard shortcut altogether.

* WebKitTestRunner/ios/TestControllerIOS.mm:
(WTR::TestController::platformResetStateToConsistentValues):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@263784 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/Platform/spi/ios/UIKitSPI.h
Tools/ChangeLog
Tools/WebKitTestRunner/ios/TestControllerIOS.mm

index d735739..a6198d1 100644 (file)
@@ -1,3 +1,15 @@
+2020-06-30  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        Several key event tests in fast/events/ios are failing after <rdar://problem/62197116>
+        https://bugs.webkit.org/show_bug.cgi?id=213821
+        <rdar://problem/64821309>
+
+        Reviewed by Megan Gardner.
+
+        Add an SPI method declaration.
+
+        * Platform/spi/ios/UIKitSPI.h:
+
 2020-06-30  Jiewen Tan  <jiewen_tan@apple.com>
 
         [WebAuthn] Remove whitelistedRpId
index 0e41809..484bf89 100644 (file)
@@ -1064,6 +1064,7 @@ WTF_EXTERN_C_END
 + (UIKeyboardPreferencesController *)sharedPreferencesController;
 - (void)setValue:(id)value forPreferenceKey:(NSString *)key;
 - (BOOL)boolForPreferenceKey:(NSString *)key;
+- (id)valueForPreferenceKey:(NSString *)key;
 @end
 
 @interface UIMenuItem (UIMenuController_SPI)
index a6e1868..52b08a8 100644 (file)
@@ -1,3 +1,22 @@
+2020-06-30  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        Several key event tests in fast/events/ios are failing after <rdar://problem/62197116>
+        https://bugs.webkit.org/show_bug.cgi?id=213821
+        <rdar://problem/64821309>
+
+        Reviewed by Megan Gardner.
+
+        After the UIKit changes in <rdar://problem/62197116>, double tapping the Option key now enters dictation mode
+        by default, and additionally displays a modal popup prompting the user to set up dictation. Both of these
+        behaviors interfere with layout tests that attempt to press the option key twice in rapid succession, causing
+        them to time out or fail.
+
+        Fix this by setting the default that determines the modifier key to use as the dictation shortcut to -1, which
+        disables the dictation keyboard shortcut altogether.
+
+        * WebKitTestRunner/ios/TestControllerIOS.mm:
+        (WTR::TestController::platformResetStateToConsistentValues):
+
 2020-06-30  Geoffrey Garen  <ggaren@apple.com>
 
         [Cocoa] [GTK] RunLoop::Timer::isActive() is incorrect for timers while they are firing
index aac7a35..240f7a1 100644 (file)
@@ -159,10 +159,19 @@ bool TestController::platformResetStateToConsistentValues(const TestOptions& opt
     [[UIApplication sharedApplication] _cancelAllTouches];
     [[UIDevice currentDevice] setOrientation:UIDeviceOrientationPortrait animated:NO];
     UIKeyboardPreferencesController *keyboardPreferences = UIKeyboardPreferencesController.sharedPreferencesController;
-    NSString *automaticMinimizationEnabledPreferenceKey = @"AutomaticMinimizationEnabled";
+    auto globalPreferencesDomainName = CFSTR("com.apple.Preferences");
+    auto automaticMinimizationEnabledPreferenceKey = @"AutomaticMinimizationEnabled";
     if (![keyboardPreferences boolForPreferenceKey:automaticMinimizationEnabledPreferenceKey]) {
         [keyboardPreferences setValue:@YES forPreferenceKey:automaticMinimizationEnabledPreferenceKey];
-        CFPreferencesSetAppValue((__bridge CFStringRef)automaticMinimizationEnabledPreferenceKey, kCFBooleanTrue, CFSTR("com.apple.Preferences"));
+        CFPreferencesSetAppValue((__bridge CFStringRef)automaticMinimizationEnabledPreferenceKey, kCFBooleanTrue, globalPreferencesDomainName);
+    }
+
+    // Disables the dictation keyboard shortcut for testing.
+    auto dictationKeyboardShortcutPreferenceKey = @"HWKeyboardDictationShortcut";
+    auto dictationKeyboardShortcutValueForTesting = @(-1);
+    if (![dictationKeyboardShortcutValueForTesting isEqual:[keyboardPreferences valueForPreferenceKey:dictationKeyboardShortcutPreferenceKey]]) {
+        [keyboardPreferences setValue:dictationKeyboardShortcutValueForTesting forPreferenceKey:dictationKeyboardShortcutPreferenceKey];
+        CFPreferencesSetAppValue((__bridge CFStringRef)dictationKeyboardShortcutPreferenceKey, (__bridge CFNumberRef)dictationKeyboardShortcutValueForTesting, globalPreferencesDomainName);
     }
 
     GSEventSetHardwareKeyboardAttached(true, 0);