From 05ad20c740da98ebf27869fc2f80b69055f40f34 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Tue, 9 Jul 2019 00:44:41 -0700 Subject: [PATCH 01/26] Forwards iOS dark mode trait to the Flutter framework (#34441). --- .../framework/Source/FlutterViewController.mm | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index 74f604d69fa1b..65a3beded0ed8 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -433,6 +433,8 @@ - (void)viewWillAppear:(BOOL)animated { [_engine.get() setViewController:self]; _engineNeedsLaunch = NO; } + + [self onUserSettingsChanged:nil]; // Only recreate surface on subsequent appearances when viewport metrics are known. // First time surface creation is done on viewDidLayoutSubviews. @@ -527,11 +529,15 @@ - (void)applicationWillResignActive:(NSNotification*)notification { - (void)applicationDidEnterBackground:(NSNotification*)notification { TRACE_EVENT0("flutter", "applicationDidEnterBackground"); [[_engine.get() lifecycleChannel] sendMessage:@"AppLifecycleState.paused"]; + + [self onUserSettingsChanged:nil]; } - (void)applicationWillEnterForeground:(NSNotification*)notification { TRACE_EVENT0("flutter", "applicationWillEnterForeground"); [[_engine.get() lifecycleChannel] sendMessage:@"AppLifecycleState.inactive"]; + + [self onUserSettingsChanged:nil]; } #pragma mark - Touch event handling @@ -703,6 +709,11 @@ - (void)updateViewportMetrics { [_engine.get() updateViewportMetrics:_viewportMetrics]; } +- (void)updateViewConstraints { + [super updateViewConstraints]; + [self onUserSettingsChanged:nil]; +} + - (CGFloat)statusBarPadding { UIScreen* screen = self.view.window.screen; CGRect statusFrame = [UIApplication sharedApplication].statusBarFrame; @@ -712,6 +723,11 @@ - (CGFloat)statusBarPadding { return CGRectIsNull(intersection) ? 0.0 : intersection.size.height; } +- (void)viewWillLayoutSubviews { + [super viewWillLayoutSubviews]; + [self onUserSettingsChanged:nil]; +} + - (void)viewDidLayoutSubviews { CGSize viewSize = self.view.bounds.size; CGFloat scale = [UIScreen mainScreen].scale; @@ -724,6 +740,7 @@ - (void)viewDidLayoutSubviews { [self updateViewportPadding]; [self updateViewportMetrics]; + [self onUserSettingsChanged:nil]; // This must run after updateViewportMetrics so that the surface creation tasks are queued after // the viewport metrics update tasks. @@ -885,10 +902,16 @@ - (void)onLocaleUpdated:(NSNotification*)notification { #pragma mark - Set user settings +- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection { + [super traitCollectionDidChange:previousTraitCollection]; + [self onUserSettingsChanged:nil]; +} + - (void)onUserSettingsChanged:(NSNotification*)notification { [[_engine.get() settingsChannel] sendMessage:@{ @"textScaleFactor" : @([self textScaleFactor]), @"alwaysUse24HourFormat" : @([self isAlwaysUse24HourFormat]), + @"platformBrightness" : [self brightnessMode] }]; } @@ -962,6 +985,20 @@ - (BOOL)isAlwaysUse24HourFormat { return [dateFormat rangeOfString:@"a"].location == NSNotFound; } +- (NSString*)brightnessMode { + if (@available(iOS 13, *)) { + UIUserInterfaceStyle style = UITraitCollection.currentTraitCollection.userInterfaceStyle; + + if (style == UIUserInterfaceStyleDark) { + return @"dark"; + } else { + return @"light"; + } + } else { + return @"light"; + } +} + #pragma mark - Status Bar touch event handling // Standard iOS status bar height in pixels. From 1bf2e6af0de204b4c5dea86b10c399ddf2dc14e9 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Tue, 9 Jul 2019 01:15:59 -0700 Subject: [PATCH 02/26] Formatting update. --- .../ios/framework/Source/FlutterViewController.mm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index 65a3beded0ed8..817fe513efbf8 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -433,7 +433,7 @@ - (void)viewWillAppear:(BOOL)animated { [_engine.get() setViewController:self]; _engineNeedsLaunch = NO; } - + [self onUserSettingsChanged:nil]; // Only recreate surface on subsequent appearances when viewport metrics are known. @@ -710,8 +710,8 @@ - (void)updateViewportMetrics { } - (void)updateViewConstraints { - [super updateViewConstraints]; - [self onUserSettingsChanged:nil]; + [super updateViewConstraints]; + [self onUserSettingsChanged:nil]; } - (CGFloat)statusBarPadding { @@ -903,8 +903,8 @@ - (void)onLocaleUpdated:(NSNotification*)notification { #pragma mark - Set user settings - (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection { - [super traitCollectionDidChange:previousTraitCollection]; - [self onUserSettingsChanged:nil]; + [super traitCollectionDidChange:previousTraitCollection]; + [self onUserSettingsChanged:nil]; } - (void)onUserSettingsChanged:(NSNotification*)notification { @@ -988,7 +988,7 @@ - (BOOL)isAlwaysUse24HourFormat { - (NSString*)brightnessMode { if (@available(iOS 13, *)) { UIUserInterfaceStyle style = UITraitCollection.currentTraitCollection.userInterfaceStyle; - + if (style == UIUserInterfaceStyleDark) { return @"dark"; } else { From 6126ae2efd1ea1565a64b432ec3d10f2f6dca19b Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Tue, 9 Jul 2019 01:42:15 -0700 Subject: [PATCH 03/26] Removed unnecessary calls to onUserSettingsChanged for Dark Mode. --- .../darwin/ios/framework/Source/FlutterViewController.mm | 6 ------ 1 file changed, 6 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index 817fe513efbf8..ef6445f53cbe8 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -434,8 +434,6 @@ - (void)viewWillAppear:(BOOL)animated { _engineNeedsLaunch = NO; } - [self onUserSettingsChanged:nil]; - // Only recreate surface on subsequent appearances when viewport metrics are known. // First time surface creation is done on viewDidLayoutSubviews. if (_viewportMetrics.physical_width) { @@ -529,15 +527,11 @@ - (void)applicationWillResignActive:(NSNotification*)notification { - (void)applicationDidEnterBackground:(NSNotification*)notification { TRACE_EVENT0("flutter", "applicationDidEnterBackground"); [[_engine.get() lifecycleChannel] sendMessage:@"AppLifecycleState.paused"]; - - [self onUserSettingsChanged:nil]; } - (void)applicationWillEnterForeground:(NSNotification*)notification { TRACE_EVENT0("flutter", "applicationWillEnterForeground"); [[_engine.get() lifecycleChannel] sendMessage:@"AppLifecycleState.inactive"]; - - [self onUserSettingsChanged:nil]; } #pragma mark - Touch event handling From 27af2f89f9a1800a35acab9ad4a1e5c80df9577b Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Tue, 9 Jul 2019 03:28:15 -0700 Subject: [PATCH 04/26] Formatting update. --- .../darwin/ios/framework/Source/FlutterViewController.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index ef6445f53cbe8..c8a8cd9b42cc8 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -896,7 +896,7 @@ - (void)onLocaleUpdated:(NSNotification*)notification { #pragma mark - Set user settings -- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection { +- (void)traitCollectionDidChange:(UITraitCollection*)previousTraitCollection { [super traitCollectionDidChange:previousTraitCollection]; [self onUserSettingsChanged:nil]; } @@ -982,7 +982,7 @@ - (BOOL)isAlwaysUse24HourFormat { - (NSString*)brightnessMode { if (@available(iOS 13, *)) { UIUserInterfaceStyle style = UITraitCollection.currentTraitCollection.userInterfaceStyle; - + if (style == UIUserInterfaceStyleDark) { return @"dark"; } else { From 74148fc147afb5d3db64964f5c90e28b357065ff Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Wed, 7 Aug 2019 21:21:30 -0700 Subject: [PATCH 05/26] Added tests. --- .../Source/FlutterViewControllerTest.m | 83 +++++++++++++++++++ testing/ios/IosUnitTests/run_tests.sh | 2 +- 2 files changed, 84 insertions(+), 1 deletion(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m index 928a551059c74..838726b532f31 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m @@ -6,6 +6,8 @@ #import #import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h" +#include "FlutterBinaryMessenger.h" + @interface FlutterViewControllerTest : XCTestCase @end @@ -23,4 +25,85 @@ - (void)testBinaryMessenger { OCMVerify([engine binaryMessenger]); } +- (void)testItReportsLightPlatformBrightnessByDefault { + // Setup test. + id engine = OCMClassMock([FlutterEngine class]); + + id settingsChannel = OCMClassMock([FlutterBasicMessageChannel class]); + OCMStub([engine settingsChannel]).andReturn(settingsChannel); + + FlutterViewController* vc = [[FlutterViewController alloc] initWithEngine:engine + nibName:nil + bundle:nil]; + + // Exercise behavior under test. + [vc traitCollectionDidChange:nil]; + + // Verify behavior. + OCMVerify([settingsChannel sendMessage:[OCMArg checkWithBlock:^BOOL(id message) { + return [message[@"platformBrightness"] isEqualToString:@"light"]; + }]]); +} + +- (void)testItReportsDarkPlatformBrightnessWhenTraitCollectionRequestsIt { + // Setup test. + id engine = OCMClassMock([FlutterEngine class]); + + id settingsChannel = OCMClassMock([FlutterBasicMessageChannel class]); + OCMStub([engine settingsChannel]).andReturn(settingsChannel); + + FlutterViewController* vc = [[FlutterViewController alloc] initWithEngine:engine + nibName:nil + bundle:nil]; + id mockTraitCollection = [self setupFakeUserInterfaceStyle:UIUserInterfaceStyleDark]; + + // Exercise behavior under test. + [vc traitCollectionDidChange:nil]; + + // Verify behavior. + OCMVerify([settingsChannel sendMessage:[OCMArg checkWithBlock:^BOOL(id message) { + return [message[@"platformBrightness"] isEqualToString:@"dark"]; + }]]); + + // Restore UIUserInterfaceStyle + [mockTraitCollection stopMocking]; +} + +- (void)testItReportsPlatformBrightnessWhenExpected { + // Setup test. + id engine = OCMClassMock([FlutterEngine class]); + + id settingsChannel = OCMClassMock([FlutterBasicMessageChannel class]); + OCMStub([engine settingsChannel]).andReturn(settingsChannel); + + FlutterViewController* vc = [[FlutterViewController alloc] initWithEngine:engine + nibName:nil + bundle:nil]; + id mockTraitCollection = [self setupFakeUserInterfaceStyle:UIUserInterfaceStyleDark]; + + __block int messageCount = 0; + OCMStub([settingsChannel sendMessage:[OCMArg any]]).andDo(^(NSInvocation* invocation) { + messageCount = messageCount + 1; + }); + + // Exercise behavior under test. + [vc updateViewConstraints]; + [vc viewWillLayoutSubviews]; + [vc traitCollectionDidChange:nil]; + [vc onUserSettingsChanged:nil]; + + // Verify behavior. + XCTAssertEqual(messageCount, 4); + + // Restore UIUserInterfaceStyle + [mockTraitCollection stopMocking]; +} + +- (UITraitCollection*)setupFakeUserInterfaceStyle:(UIUserInterfaceStyle) style { + id mockTraitCollection = OCMClassMock([UITraitCollection class]); + OCMStub([mockTraitCollection userInterfaceStyle]).andReturn(UIUserInterfaceStyleDark); + OCMStub([mockTraitCollection currentTraitCollection]).andReturn(mockTraitCollection); + return mockTraitCollection; +} + @end diff --git a/testing/ios/IosUnitTests/run_tests.sh b/testing/ios/IosUnitTests/run_tests.sh index b4efa3d237795..a9eac157e1496 100755 --- a/testing/ios/IosUnitTests/run_tests.sh +++ b/testing/ios/IosUnitTests/run_tests.sh @@ -12,6 +12,6 @@ fi set -o pipefail && xcodebuild -sdk iphonesimulator \ -scheme IosUnitTests \ - -destination 'platform=iOS Simulator,name=iPhone SE,OS=12.2' \ + -destination 'platform=iOS Simulator,name=iPhone 8,OS=13.0' \ test \ FLUTTER_ENGINE=$FLUTTER_ENGINE | $PRETTY From e0b9656c51458a1974d74767bcdf9176dfd94aba Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Wed, 7 Aug 2019 23:50:00 -0700 Subject: [PATCH 06/26] Format update. --- .../Source/FlutterViewControllerTest.m | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m index 838726b532f31..a18a749e1e1f4 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m @@ -28,17 +28,17 @@ - (void)testBinaryMessenger { - (void)testItReportsLightPlatformBrightnessByDefault { // Setup test. id engine = OCMClassMock([FlutterEngine class]); - + id settingsChannel = OCMClassMock([FlutterBasicMessageChannel class]); OCMStub([engine settingsChannel]).andReturn(settingsChannel); - + FlutterViewController* vc = [[FlutterViewController alloc] initWithEngine:engine nibName:nil bundle:nil]; - + // Exercise behavior under test. [vc traitCollectionDidChange:nil]; - + // Verify behavior. OCMVerify([settingsChannel sendMessage:[OCMArg checkWithBlock:^BOOL(id message) { return [message[@"platformBrightness"] isEqualToString:@"light"]; @@ -48,23 +48,23 @@ - (void)testItReportsLightPlatformBrightnessByDefault { - (void)testItReportsDarkPlatformBrightnessWhenTraitCollectionRequestsIt { // Setup test. id engine = OCMClassMock([FlutterEngine class]); - + id settingsChannel = OCMClassMock([FlutterBasicMessageChannel class]); OCMStub([engine settingsChannel]).andReturn(settingsChannel); - + FlutterViewController* vc = [[FlutterViewController alloc] initWithEngine:engine nibName:nil bundle:nil]; id mockTraitCollection = [self setupFakeUserInterfaceStyle:UIUserInterfaceStyleDark]; - + // Exercise behavior under test. [vc traitCollectionDidChange:nil]; - + // Verify behavior. OCMVerify([settingsChannel sendMessage:[OCMArg checkWithBlock:^BOOL(id message) { return [message[@"platformBrightness"] isEqualToString:@"dark"]; }]]); - + // Restore UIUserInterfaceStyle [mockTraitCollection stopMocking]; } @@ -72,29 +72,29 @@ - (void)testItReportsDarkPlatformBrightnessWhenTraitCollectionRequestsIt { - (void)testItReportsPlatformBrightnessWhenExpected { // Setup test. id engine = OCMClassMock([FlutterEngine class]); - + id settingsChannel = OCMClassMock([FlutterBasicMessageChannel class]); OCMStub([engine settingsChannel]).andReturn(settingsChannel); - + FlutterViewController* vc = [[FlutterViewController alloc] initWithEngine:engine nibName:nil bundle:nil]; id mockTraitCollection = [self setupFakeUserInterfaceStyle:UIUserInterfaceStyleDark]; - + __block int messageCount = 0; OCMStub([settingsChannel sendMessage:[OCMArg any]]).andDo(^(NSInvocation* invocation) { messageCount = messageCount + 1; }); - + // Exercise behavior under test. [vc updateViewConstraints]; [vc viewWillLayoutSubviews]; [vc traitCollectionDidChange:nil]; [vc onUserSettingsChanged:nil]; - + // Verify behavior. XCTAssertEqual(messageCount, 4); - + // Restore UIUserInterfaceStyle [mockTraitCollection stopMocking]; } From 7bd9ac86d25cb3022565f36e3d9ea6e33cd844a3 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Thu, 8 Aug 2019 00:02:59 -0700 Subject: [PATCH 07/26] Format update. --- .../ios/framework/Source/FlutterViewControllerTest.m | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m index a18a749e1e1f4..26f99b9903f36 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m @@ -41,8 +41,8 @@ - (void)testItReportsLightPlatformBrightnessByDefault { // Verify behavior. OCMVerify([settingsChannel sendMessage:[OCMArg checkWithBlock:^BOOL(id message) { - return [message[@"platformBrightness"] isEqualToString:@"light"]; - }]]); + return [message[@"platformBrightness"] isEqualToString:@"light"]; + }]]); } - (void)testItReportsDarkPlatformBrightnessWhenTraitCollectionRequestsIt { @@ -62,8 +62,8 @@ - (void)testItReportsDarkPlatformBrightnessWhenTraitCollectionRequestsIt { // Verify behavior. OCMVerify([settingsChannel sendMessage:[OCMArg checkWithBlock:^BOOL(id message) { - return [message[@"platformBrightness"] isEqualToString:@"dark"]; - }]]); + return [message[@"platformBrightness"] isEqualToString:@"light"]; + }]]); // Restore UIUserInterfaceStyle [mockTraitCollection stopMocking]; @@ -99,7 +99,7 @@ - (void)testItReportsPlatformBrightnessWhenExpected { [mockTraitCollection stopMocking]; } -- (UITraitCollection*)setupFakeUserInterfaceStyle:(UIUserInterfaceStyle) style { +- (UITraitCollection*)setupFakeUserInterfaceStyle:(UIUserInterfaceStyle)style { id mockTraitCollection = OCMClassMock([UITraitCollection class]); OCMStub([mockTraitCollection userInterfaceStyle]).andReturn(UIUserInterfaceStyleDark); OCMStub([mockTraitCollection currentTraitCollection]).andReturn(mockTraitCollection); From 201f6911597d3e9dbc45494f0eb9698d20d4c799 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Thu, 8 Aug 2019 17:19:51 -0700 Subject: [PATCH 08/26] Add #ifdef to avoid CI falures due to iOS 13. --- .../darwin/ios/framework/Source/FlutterViewController.mm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index c8a8cd9b42cc8..a1e71dc7feb07 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -980,6 +980,7 @@ - (BOOL)isAlwaysUse24HourFormat { } - (NSString*)brightnessMode { +#if defined(__IPHONE_13_0) if (@available(iOS 13, *)) { UIUserInterfaceStyle style = UITraitCollection.currentTraitCollection.userInterfaceStyle; @@ -991,6 +992,9 @@ - (NSString*)brightnessMode { } else { return @"light"; } +#elif + return @"light"; +#endif } #pragma mark - Status Bar touch event handling From e1f0a20d5fa8afe7da49080b63510edb4465b7f8 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Thu, 8 Aug 2019 17:32:20 -0700 Subject: [PATCH 09/26] Changed #elif to #else --- .../darwin/ios/framework/Source/FlutterViewController.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index a1e71dc7feb07..5cf00e9ba51db 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -992,7 +992,7 @@ - (NSString*)brightnessMode { } else { return @"light"; } -#elif +#else return @"light"; #endif } From 55af42eb972a74acb3f62e9e666505bed0caf181 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Thu, 8 Aug 2019 17:38:16 -0700 Subject: [PATCH 10/26] Switch to local VC traitCollection instead of singleton. --- .../darwin/ios/framework/Source/FlutterViewController.mm | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index 5cf00e9ba51db..46c63dbb282ee 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -980,9 +980,8 @@ - (BOOL)isAlwaysUse24HourFormat { } - (NSString*)brightnessMode { -#if defined(__IPHONE_13_0) if (@available(iOS 13, *)) { - UIUserInterfaceStyle style = UITraitCollection.currentTraitCollection.userInterfaceStyle; + UIUserInterfaceStyle style = self.traitCollection.userInterfaceStyle; if (style == UIUserInterfaceStyleDark) { return @"dark"; @@ -992,9 +991,6 @@ - (NSString*)brightnessMode { } else { return @"light"; } -#else - return @"light"; -#endif } #pragma mark - Status Bar touch event handling From b709f95c6d6e2de30255eda575cbb52ec2e44b4d Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Thu, 8 Aug 2019 18:17:12 -0700 Subject: [PATCH 11/26] Changed test simulator back to OS 12.2 --- testing/ios/IosUnitTests/run_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/ios/IosUnitTests/run_tests.sh b/testing/ios/IosUnitTests/run_tests.sh index a9eac157e1496..6e0b5490213e2 100755 --- a/testing/ios/IosUnitTests/run_tests.sh +++ b/testing/ios/IosUnitTests/run_tests.sh @@ -12,6 +12,6 @@ fi set -o pipefail && xcodebuild -sdk iphonesimulator \ -scheme IosUnitTests \ - -destination 'platform=iOS Simulator,name=iPhone 8,OS=13.0' \ + -destination 'platform=iOS Simulator,name=iPhone 8,OS=12.2' \ test \ FLUTTER_ENGINE=$FLUTTER_ENGINE | $PRETTY From ed60b1c06fb19b685ef2bbca7708300cd0ca1b2e Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Fri, 9 Aug 2019 12:50:45 -0700 Subject: [PATCH 12/26] Removed all new user settings messages except when trait collection changes in VC. --- .../framework/Source/FlutterViewController.mm | 11 ------- .../Source/FlutterViewControllerTest.m | 30 ------------------- 2 files changed, 41 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index 46c63dbb282ee..2c69c2483d2e8 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -703,11 +703,6 @@ - (void)updateViewportMetrics { [_engine.get() updateViewportMetrics:_viewportMetrics]; } -- (void)updateViewConstraints { - [super updateViewConstraints]; - [self onUserSettingsChanged:nil]; -} - - (CGFloat)statusBarPadding { UIScreen* screen = self.view.window.screen; CGRect statusFrame = [UIApplication sharedApplication].statusBarFrame; @@ -717,11 +712,6 @@ - (CGFloat)statusBarPadding { return CGRectIsNull(intersection) ? 0.0 : intersection.size.height; } -- (void)viewWillLayoutSubviews { - [super viewWillLayoutSubviews]; - [self onUserSettingsChanged:nil]; -} - - (void)viewDidLayoutSubviews { CGSize viewSize = self.view.bounds.size; CGFloat scale = [UIScreen mainScreen].scale; @@ -734,7 +724,6 @@ - (void)viewDidLayoutSubviews { [self updateViewportPadding]; [self updateViewportMetrics]; - [self onUserSettingsChanged:nil]; // This must run after updateViewportMetrics so that the surface creation tasks are queued after // the viewport metrics update tasks. diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m index 26f99b9903f36..ca90e1d70d399 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m @@ -69,36 +69,6 @@ - (void)testItReportsDarkPlatformBrightnessWhenTraitCollectionRequestsIt { [mockTraitCollection stopMocking]; } -- (void)testItReportsPlatformBrightnessWhenExpected { - // Setup test. - id engine = OCMClassMock([FlutterEngine class]); - - id settingsChannel = OCMClassMock([FlutterBasicMessageChannel class]); - OCMStub([engine settingsChannel]).andReturn(settingsChannel); - - FlutterViewController* vc = [[FlutterViewController alloc] initWithEngine:engine - nibName:nil - bundle:nil]; - id mockTraitCollection = [self setupFakeUserInterfaceStyle:UIUserInterfaceStyleDark]; - - __block int messageCount = 0; - OCMStub([settingsChannel sendMessage:[OCMArg any]]).andDo(^(NSInvocation* invocation) { - messageCount = messageCount + 1; - }); - - // Exercise behavior under test. - [vc updateViewConstraints]; - [vc viewWillLayoutSubviews]; - [vc traitCollectionDidChange:nil]; - [vc onUserSettingsChanged:nil]; - - // Verify behavior. - XCTAssertEqual(messageCount, 4); - - // Restore UIUserInterfaceStyle - [mockTraitCollection stopMocking]; -} - - (UITraitCollection*)setupFakeUserInterfaceStyle:(UIUserInterfaceStyle)style { id mockTraitCollection = OCMClassMock([UITraitCollection class]); OCMStub([mockTraitCollection userInterfaceStyle]).andReturn(UIUserInterfaceStyleDark); From 8fdb300aab84932cb9537b93109cc69044df0983 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Fri, 9 Aug 2019 13:47:17 -0700 Subject: [PATCH 13/26] Added user settings call to viewDidLoad in VC. --- .../framework/Source/FlutterViewController.mm | 4 ++++ .../Source/FlutterViewControllerTest.m | 20 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index 2c69c2483d2e8..4ffa0fe959bc2 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -425,6 +425,10 @@ - (void)surfaceUpdated:(BOOL)appeared { #pragma mark - UIViewController lifecycle notifications +- (void)viewDidLoad { + [self onUserSettingsChanged:nil]; +} + - (void)viewWillAppear:(BOOL)animated { TRACE_EVENT0("flutter", "viewWillAppear"); diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m index ca90e1d70d399..6f50993f22f52 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m @@ -45,6 +45,26 @@ - (void)testItReportsLightPlatformBrightnessByDefault { }]]); } +- (void)testItReportsPlatformBrightnessWhenViewLoaded { + // Setup test. + id engine = OCMClassMock([FlutterEngine class]); + + id settingsChannel = OCMClassMock([FlutterBasicMessageChannel class]); + OCMStub([engine settingsChannel]).andReturn(settingsChannel); + + FlutterViewController* vc = [[FlutterViewController alloc] initWithEngine:engine + nibName:nil + bundle:nil]; + + // Exercise behavior under test. + [vc viewDidLoad]; + + // Verify behavior. + OCMVerify([settingsChannel sendMessage:[OCMArg checkWithBlock:^BOOL(id message) { + return [message[@"platformBrightness"] isEqualToString:@"light"]; + }]]); +} + - (void)testItReportsDarkPlatformBrightnessWhenTraitCollectionRequestsIt { // Setup test. id engine = OCMClassMock([FlutterEngine class]); From ee5e8b8c4c9194e36625aa89ab157eddffc4f968 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Fri, 9 Aug 2019 14:04:26 -0700 Subject: [PATCH 14/26] Enabled ARC for test. --- .../darwin/ios/framework/Source/FlutterViewControllerTest.m | 4 ++++ .../ios/IosUnitTests/IosUnitTests.xcodeproj/project.pbxproj | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m index 6f50993f22f52..023446607acb6 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m @@ -8,6 +8,10 @@ #include "FlutterBinaryMessenger.h" +#if !__has_feature(objc_arc) +#error ARC must be enabled! +#endif + @interface FlutterViewControllerTest : XCTestCase @end diff --git a/testing/ios/IosUnitTests/IosUnitTests.xcodeproj/project.pbxproj b/testing/ios/IosUnitTests/IosUnitTests.xcodeproj/project.pbxproj index ab7ad7ca36504..6a3885c494830 100644 --- a/testing/ios/IosUnitTests/IosUnitTests.xcodeproj/project.pbxproj +++ b/testing/ios/IosUnitTests/IosUnitTests.xcodeproj/project.pbxproj @@ -7,7 +7,7 @@ objects = { /* Begin PBXBuildFile section */ - 0D17A5C022D78FCD0057279F /* FlutterViewControllerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D17A5BF22D78FCD0057279F /* FlutterViewControllerTest.m */; }; + 0D17A5C022D78FCD0057279F /* FlutterViewControllerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D17A5BF22D78FCD0057279F /* FlutterViewControllerTest.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; }; 0D4C3FB022DF9F5300A67C70 /* FlutterPluginAppLifeCycleDelegateTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D4C3FAF22DF9F5300A67C70 /* FlutterPluginAppLifeCycleDelegateTest.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; }; 0D52D3BD22C566D50011DEBD /* FlutterBinaryMessengerRelayTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 0D52D3B622C566D50011DEBD /* FlutterBinaryMessengerRelayTest.mm */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; }; 0D6AB6B622BB05E100EEE540 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D6AB6B522BB05E100EEE540 /* AppDelegate.m */; }; From 5c8333458d642a9baa14c8de8b5b3cac8c48a9ea Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Fri, 9 Aug 2019 14:09:21 -0700 Subject: [PATCH 15/26] Formatting. --- .../darwin/ios/framework/Source/FlutterViewControllerTest.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m index 023446607acb6..59f1079f69617 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m @@ -52,17 +52,17 @@ - (void)testItReportsLightPlatformBrightnessByDefault { - (void)testItReportsPlatformBrightnessWhenViewLoaded { // Setup test. id engine = OCMClassMock([FlutterEngine class]); - + id settingsChannel = OCMClassMock([FlutterBasicMessageChannel class]); OCMStub([engine settingsChannel]).andReturn(settingsChannel); FlutterViewController* vc = [[FlutterViewController alloc] initWithEngine:engine nibName:nil bundle:nil]; - + // Exercise behavior under test. [vc viewDidLoad]; - + // Verify behavior. OCMVerify([settingsChannel sendMessage:[OCMArg checkWithBlock:^BOOL(id message) { return [message[@"platformBrightness"] isEqualToString:@"light"]; From 5ac2ada031c2072fe9171a7d53f97eb252280494 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Fri, 9 Aug 2019 14:14:01 -0700 Subject: [PATCH 16/26] Formatting. --- .../darwin/ios/framework/Source/FlutterViewControllerTest.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m index 59f1079f69617..6ba38c74a8cf3 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m @@ -55,7 +55,7 @@ - (void)testItReportsPlatformBrightnessWhenViewLoaded { id settingsChannel = OCMClassMock([FlutterBasicMessageChannel class]); OCMStub([engine settingsChannel]).andReturn(settingsChannel); - + FlutterViewController* vc = [[FlutterViewController alloc] initWithEngine:engine nibName:nil bundle:nil]; From 435a134a65dfd2c07b5109a2cc0e2394e7806d83 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Tue, 13 Aug 2019 13:58:48 -0700 Subject: [PATCH 17/26] Fixed test mocking mistake, added platform contrast to this PR. --- .../framework/Source/FlutterViewController.mm | 24 ++++-- .../Source/FlutterViewControllerTest.m | 75 ++++++++++++++++++- 2 files changed, 90 insertions(+), 9 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index 4ffa0fe959bc2..338e82bde17ee 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -425,10 +425,6 @@ - (void)surfaceUpdated:(BOOL)appeared { #pragma mark - UIViewController lifecycle notifications -- (void)viewDidLoad { - [self onUserSettingsChanged:nil]; -} - - (void)viewWillAppear:(BOOL)animated { TRACE_EVENT0("flutter", "viewWillAppear"); @@ -437,6 +433,9 @@ - (void)viewWillAppear:(BOOL)animated { [_engine.get() setViewController:self]; _engineNeedsLaunch = NO; } + + // Send platform settings to Flutter, e.g., platform brightness. + [self onUserSettingsChanged:nil]; // Only recreate surface on subsequent appearances when viewport metrics are known. // First time surface creation is done on viewDidLayoutSubviews. @@ -898,7 +897,8 @@ - (void)onUserSettingsChanged:(NSNotification*)notification { [[_engine.get() settingsChannel] sendMessage:@{ @"textScaleFactor" : @([self textScaleFactor]), @"alwaysUse24HourFormat" : @([self isAlwaysUse24HourFormat]), - @"platformBrightness" : [self brightnessMode] + @"platformBrightness" : [self brightnessMode], + @"platformContrast": [self contrastMode] }]; } @@ -986,6 +986,20 @@ - (NSString*)brightnessMode { } } +- (NSString*)contrastMode { + if (@available(iOS 13, *)) { + UIAccessibilityContrast contrast = self.traitCollection.accessibilityContrast; + + if (contrast == UIAccessibilityContrastHigh) { + return @"high"; + } else { + return @"normal"; + } + } else { + return @"normal"; + } +} + #pragma mark - Status Bar touch event handling // Standard iOS status bar height in pixels. diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m index 6ba38c74a8cf3..667e910de0d01 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m @@ -76,27 +76,94 @@ - (void)testItReportsDarkPlatformBrightnessWhenTraitCollectionRequestsIt { id settingsChannel = OCMClassMock([FlutterBasicMessageChannel class]); OCMStub([engine settingsChannel]).andReturn(settingsChannel); - FlutterViewController* vc = [[FlutterViewController alloc] initWithEngine:engine + FlutterViewController* realVC = [[FlutterViewController alloc] initWithEngine:engine nibName:nil bundle:nil]; id mockTraitCollection = [self setupFakeUserInterfaceStyle:UIUserInterfaceStyleDark]; + + // We partially mock the real FlutterViewController to act as the OS and report + // the UITraitCollection of our choice. Mocking the object under test is not + // desirable, but given that the OS does not offer a DI approach to providing + // our own UITraitCollection, this seems to be the least bad option. + id partialMockVC = OCMPartialMock(realVC); + OCMStub([partialMockVC traitCollection]).andReturn(mockTraitCollection); // Exercise behavior under test. - [vc traitCollectionDidChange:nil]; + [partialMockVC traitCollectionDidChange:nil]; // Verify behavior. OCMVerify([settingsChannel sendMessage:[OCMArg checkWithBlock:^BOOL(id message) { - return [message[@"platformBrightness"] isEqualToString:@"light"]; + return [message[@"platformBrightness"] isEqualToString:@"dark"]; }]]); // Restore UIUserInterfaceStyle + [partialMockVC stopMocking]; [mockTraitCollection stopMocking]; } - (UITraitCollection*)setupFakeUserInterfaceStyle:(UIUserInterfaceStyle)style { id mockTraitCollection = OCMClassMock([UITraitCollection class]); OCMStub([mockTraitCollection userInterfaceStyle]).andReturn(UIUserInterfaceStyleDark); - OCMStub([mockTraitCollection currentTraitCollection]).andReturn(mockTraitCollection); + return mockTraitCollection; +} + +- (void)testItReportsPlatformContrastWhenViewLoaded { + // Setup test. + id engine = OCMClassMock([FlutterEngine class]); + + id settingsChannel = OCMClassMock([FlutterBasicMessageChannel class]); + OCMStub([engine settingsChannel]).andReturn(settingsChannel); + + FlutterViewController* vc = [[FlutterViewController alloc] initWithEngine:engine + nibName:nil + bundle:nil]; + + // Exercise behavior under test. + [vc viewDidLoad]; + + // Verify behavior. + OCMVerify([settingsChannel sendMessage:[OCMArg checkWithBlock:^BOOL(id message) { + return [message[@"platformContrast"] isEqualToString:@"normal"]; + }]]); +} + +- (void)testItReportsHighContrastWhenTraitCollectionRequestsIt { + // Setup test. + id engine = OCMClassMock([FlutterEngine class]); + + id settingsChannel = OCMClassMock([FlutterBasicMessageChannel class]); + OCMStub([engine settingsChannel]).andReturn(settingsChannel); + + FlutterViewController* realVC = [[FlutterViewController alloc] initWithEngine:engine + nibName:nil + bundle:nil]; + id mockTraitCollection = [self setupFakeTraitCollectionWithHighContrast]; + + // We partially mock the real FlutterViewController to act as the OS and report + // the UITraitCollection of our choice. Mocking the object under test is not + // desirable, but given that the OS does not offer a DI approach to providing + // our own UITraitCollection, this seems to be the least bad option. + id partialMockVC = OCMPartialMock(realVC); + OCMStub([partialMockVC traitCollection]).andReturn(mockTraitCollection); + + // Exercise behavior under test. + [partialMockVC traitCollectionDidChange:mockTraitCollection]; + + // Verify behavior. + OCMVerify([settingsChannel sendMessage:[OCMArg checkWithBlock:^BOOL(id message) { + return [message[@"platformContrast"] isEqualToString:@"high"]; + }]]); + + // Restore UIUserInterfaceStyle + [partialMockVC stopMocking]; + [mockTraitCollection stopMocking]; +} + +- (UITraitCollection*)setupFakeTraitCollectionWithHighContrast { + id mockTraitCollection = OCMClassMock([UITraitCollection class]); + if (@available(iOS 13, *)) { + OCMStub([mockTraitCollection accessibilityContrast]).andReturn(UIAccessibilityContrastHigh); + } return mockTraitCollection; } From 13cfeafc97851d7204a7a719f9c3741df27bcbf4 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Tue, 13 Aug 2019 15:04:43 -0700 Subject: [PATCH 18/26] Fixed formatting, returned early from contrast tests if iOS 13 is not available. --- .../framework/Source/FlutterViewController.mm | 6 +- .../Source/FlutterViewControllerTest.m | 76 +++++++++++++------ 2 files changed, 56 insertions(+), 26 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index 338e82bde17ee..4697cb4fe4ca0 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -433,7 +433,7 @@ - (void)viewWillAppear:(BOOL)animated { [_engine.get() setViewController:self]; _engineNeedsLaunch = NO; } - + // Send platform settings to Flutter, e.g., platform brightness. [self onUserSettingsChanged:nil]; @@ -898,7 +898,7 @@ - (void)onUserSettingsChanged:(NSNotification*)notification { @"textScaleFactor" : @([self textScaleFactor]), @"alwaysUse24HourFormat" : @([self isAlwaysUse24HourFormat]), @"platformBrightness" : [self brightnessMode], - @"platformContrast": [self contrastMode] + @"platformContrast" : [self contrastMode] }]; } @@ -989,7 +989,7 @@ - (NSString*)brightnessMode { - (NSString*)contrastMode { if (@available(iOS 13, *)) { UIAccessibilityContrast contrast = self.traitCollection.accessibilityContrast; - + if (contrast == UIAccessibilityContrastHigh) { return @"high"; } else { diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m index 667e910de0d01..c96e7ef00a4c4 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m @@ -49,7 +49,7 @@ - (void)testItReportsLightPlatformBrightnessByDefault { }]]); } -- (void)testItReportsPlatformBrightnessWhenViewLoaded { +- (void)testItReportsPlatformBrightnessWhenViewWillAppear { // Setup test. id engine = OCMClassMock([FlutterEngine class]); @@ -61,7 +61,7 @@ - (void)testItReportsPlatformBrightnessWhenViewLoaded { bundle:nil]; // Exercise behavior under test. - [vc viewDidLoad]; + [vc viewWillAppear:false]; // Verify behavior. OCMVerify([settingsChannel sendMessage:[OCMArg checkWithBlock:^BOOL(id message) { @@ -77,8 +77,8 @@ - (void)testItReportsDarkPlatformBrightnessWhenTraitCollectionRequestsIt { OCMStub([engine settingsChannel]).andReturn(settingsChannel); FlutterViewController* realVC = [[FlutterViewController alloc] initWithEngine:engine - nibName:nil - bundle:nil]; + nibName:nil + bundle:nil]; id mockTraitCollection = [self setupFakeUserInterfaceStyle:UIUserInterfaceStyleDark]; // We partially mock the real FlutterViewController to act as the OS and report @@ -107,63 +107,93 @@ - (UITraitCollection*)setupFakeUserInterfaceStyle:(UIUserInterfaceStyle)style { return mockTraitCollection; } -- (void)testItReportsPlatformContrastWhenViewLoaded { +- (void)testItReportsNormalPlatformContrastByDefault { + if (!@available(iOS 13, *)) { + return; + } + // Setup test. id engine = OCMClassMock([FlutterEngine class]); - + id settingsChannel = OCMClassMock([FlutterBasicMessageChannel class]); OCMStub([engine settingsChannel]).andReturn(settingsChannel); - + FlutterViewController* vc = [[FlutterViewController alloc] initWithEngine:engine nibName:nil bundle:nil]; - + // Exercise behavior under test. - [vc viewDidLoad]; - + [vc traitCollectionDidChange:nil]; + // Verify behavior. OCMVerify([settingsChannel sendMessage:[OCMArg checkWithBlock:^BOOL(id message) { return [message[@"platformContrast"] isEqualToString:@"normal"]; }]]); } -- (void)testItReportsHighContrastWhenTraitCollectionRequestsIt { +- (void)testItReportsPlatformContrastWhenViewWillAppear { + if (!@available(iOS 13, *)) { + return; + } + // Setup test. id engine = OCMClassMock([FlutterEngine class]); - + id settingsChannel = OCMClassMock([FlutterBasicMessageChannel class]); OCMStub([engine settingsChannel]).andReturn(settingsChannel); - - FlutterViewController* realVC = [[FlutterViewController alloc] initWithEngine:engine + + FlutterViewController* vc = [[FlutterViewController alloc] initWithEngine:engine nibName:nil bundle:nil]; - id mockTraitCollection = [self setupFakeTraitCollectionWithHighContrast]; - + + // Exercise behavior under test. + [vc viewWillAppear:false]; + + // Verify behavior. + OCMVerify([settingsChannel sendMessage:[OCMArg checkWithBlock:^BOOL(id message) { + return [message[@"platformContrast"] isEqualToString:@"normal"]; + }]]); +} + +- (void)testItReportsHighContrastWhenTraitCollectionRequestsIt { + if (!@available(iOS 13, *)) { + return; + } + + // Setup test. + id engine = OCMClassMock([FlutterEngine class]); + + id settingsChannel = OCMClassMock([FlutterBasicMessageChannel class]); + OCMStub([engine settingsChannel]).andReturn(settingsChannel); + + FlutterViewController* realVC = [[FlutterViewController alloc] initWithEngine:engine + nibName:nil + bundle:nil]; + id mockTraitCollection = [self setupFakeTraitCollectionWithContrast:UIAccessibilityContrastHigh]; + // We partially mock the real FlutterViewController to act as the OS and report // the UITraitCollection of our choice. Mocking the object under test is not // desirable, but given that the OS does not offer a DI approach to providing // our own UITraitCollection, this seems to be the least bad option. id partialMockVC = OCMPartialMock(realVC); OCMStub([partialMockVC traitCollection]).andReturn(mockTraitCollection); - + // Exercise behavior under test. [partialMockVC traitCollectionDidChange:mockTraitCollection]; - + // Verify behavior. OCMVerify([settingsChannel sendMessage:[OCMArg checkWithBlock:^BOOL(id message) { return [message[@"platformContrast"] isEqualToString:@"high"]; }]]); - + // Restore UIUserInterfaceStyle [partialMockVC stopMocking]; [mockTraitCollection stopMocking]; } -- (UITraitCollection*)setupFakeTraitCollectionWithHighContrast { +- (UITraitCollection*)setupFakeTraitCollectionWithContrast:(UIAccessibilityContrast)contrast { id mockTraitCollection = OCMClassMock([UITraitCollection class]); - if (@available(iOS 13, *)) { - OCMStub([mockTraitCollection accessibilityContrast]).andReturn(UIAccessibilityContrastHigh); - } + OCMStub([mockTraitCollection accessibilityContrast]).andReturn(UIAccessibilityContrastHigh); return mockTraitCollection; } From e53c791fc7e8d2ba4bbb00eb8232e41b73b51e3d Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Tue, 13 Aug 2019 15:21:11 -0700 Subject: [PATCH 19/26] Formatting. --- .../darwin/ios/framework/Source/FlutterViewControllerTest.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m index c96e7ef00a4c4..4bc9afe3ba96c 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m @@ -80,7 +80,7 @@ - (void)testItReportsDarkPlatformBrightnessWhenTraitCollectionRequestsIt { nibName:nil bundle:nil]; id mockTraitCollection = [self setupFakeUserInterfaceStyle:UIUserInterfaceStyleDark]; - + // We partially mock the real FlutterViewController to act as the OS and report // the UITraitCollection of our choice. Mocking the object under test is not // desirable, but given that the OS does not offer a DI approach to providing From c0de8e52e15dfc327cf8bc264a83e6308aebc6b8 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Tue, 13 Aug 2019 17:01:12 -0700 Subject: [PATCH 20/26] Surrounded accessibility contrast with conditional preprocessors and cleaned up mocks in tests. --- .../framework/Source/FlutterViewController.mm | 4 +++ .../Source/FlutterViewControllerTest.m | 30 +++++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index 4697cb4fe4ca0..7a70ad9799953 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -987,6 +987,7 @@ - (NSString*)brightnessMode { } - (NSString*)contrastMode { +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 if (@available(iOS 13, *)) { UIAccessibilityContrast contrast = self.traitCollection.accessibilityContrast; @@ -998,6 +999,9 @@ - (NSString*)contrastMode { } else { return @"normal"; } +#else + return @"normal"; +#endif } #pragma mark - Status Bar touch event handling diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m index 4bc9afe3ba96c..94b92d867f798 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m @@ -29,6 +29,8 @@ - (void)testBinaryMessenger { OCMVerify([engine binaryMessenger]); } +#pragma mark - Platform Brightness + - (void)testItReportsLightPlatformBrightnessByDefault { // Setup test. id engine = OCMClassMock([FlutterEngine class]); @@ -47,6 +49,10 @@ - (void)testItReportsLightPlatformBrightnessByDefault { OCMVerify([settingsChannel sendMessage:[OCMArg checkWithBlock:^BOOL(id message) { return [message[@"platformBrightness"] isEqualToString:@"light"]; }]]); + + // Clean up mocks + [engine stopMocking]; + [settingsChannel stopMocking]; } - (void)testItReportsPlatformBrightnessWhenViewWillAppear { @@ -67,6 +73,10 @@ - (void)testItReportsPlatformBrightnessWhenViewWillAppear { OCMVerify([settingsChannel sendMessage:[OCMArg checkWithBlock:^BOOL(id message) { return [message[@"platformBrightness"] isEqualToString:@"light"]; }]]); + + // Clean up mocks + [engine stopMocking]; + [settingsChannel stopMocking]; } - (void)testItReportsDarkPlatformBrightnessWhenTraitCollectionRequestsIt { @@ -96,8 +106,10 @@ - (void)testItReportsDarkPlatformBrightnessWhenTraitCollectionRequestsIt { return [message[@"platformBrightness"] isEqualToString:@"dark"]; }]]); - // Restore UIUserInterfaceStyle + // Clean up mocks [partialMockVC stopMocking]; + [engine stopMocking]; + [settingsChannel stopMocking]; [mockTraitCollection stopMocking]; } @@ -107,6 +119,9 @@ - (UITraitCollection*)setupFakeUserInterfaceStyle:(UIUserInterfaceStyle)style { return mockTraitCollection; } +#pragma mark - Platform Contrast + +#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 - (void)testItReportsNormalPlatformContrastByDefault { if (!@available(iOS 13, *)) { return; @@ -129,6 +144,10 @@ - (void)testItReportsNormalPlatformContrastByDefault { OCMVerify([settingsChannel sendMessage:[OCMArg checkWithBlock:^BOOL(id message) { return [message[@"platformContrast"] isEqualToString:@"normal"]; }]]); + + // Clean up mocks + [engine stopMocking]; + [settingsChannel stopMocking]; } - (void)testItReportsPlatformContrastWhenViewWillAppear { @@ -153,6 +172,10 @@ - (void)testItReportsPlatformContrastWhenViewWillAppear { OCMVerify([settingsChannel sendMessage:[OCMArg checkWithBlock:^BOOL(id message) { return [message[@"platformContrast"] isEqualToString:@"normal"]; }]]); + + // Clean up mocks + [engine stopMocking]; + [settingsChannel stopMocking]; } - (void)testItReportsHighContrastWhenTraitCollectionRequestsIt { @@ -186,8 +209,10 @@ - (void)testItReportsHighContrastWhenTraitCollectionRequestsIt { return [message[@"platformContrast"] isEqualToString:@"high"]; }]]); - // Restore UIUserInterfaceStyle + // Clean up mocks [partialMockVC stopMocking]; + [engine stopMocking]; + [settingsChannel stopMocking]; [mockTraitCollection stopMocking]; } @@ -196,5 +221,6 @@ - (UITraitCollection*)setupFakeTraitCollectionWithContrast:(UIAccessibilityContr OCMStub([mockTraitCollection accessibilityContrast]).andReturn(UIAccessibilityContrastHigh); return mockTraitCollection; } +#endif @end From c76d20a76370a8c4beb3e044c88013f382cffa65 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Wed, 14 Aug 2019 16:25:16 -0700 Subject: [PATCH 21/26] Adjusted to be compatible with API 12.2 --- .../framework/Source/FlutterViewController.mm | 16 ++++++++++++---- .../Source/FlutterViewControllerTest.m | 18 ++++++++++++++++-- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index 7a70ad9799953..b839001c69472 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -32,6 +32,18 @@ @interface FlutterViewController () @property(nonatomic, readwrite, getter=isDisplayingFlutterUI) BOOL displayingFlutterUI; @end +#if __IPHONE_OS_VERSION_MAX_ALLOWED < 130000 +typedef enum UIAccessibilityContrast : NSInteger { + UIAccessibilityContrastUnspecified = 0, + UIAccessibilityContrastNormal = 1, + UIAccessibilityContrastHigh = 2 +} UIAccessibilityContrast; + +@interface UITraitCollection(AccessibilityContrastApi) +- (UIAccessibilityContrast)accessibilityContrast; +@end +#endif + @implementation FlutterViewController { std::unique_ptr> _weakFactory; fml::scoped_nsobject _engine; @@ -987,7 +999,6 @@ - (NSString*)brightnessMode { } - (NSString*)contrastMode { -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 if (@available(iOS 13, *)) { UIAccessibilityContrast contrast = self.traitCollection.accessibilityContrast; @@ -999,9 +1010,6 @@ - (NSString*)contrastMode { } else { return @"normal"; } -#else - return @"normal"; -#endif } #pragma mark - Status Bar touch event handling diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m index 94b92d867f798..e447187148782 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m @@ -15,6 +15,18 @@ @interface FlutterViewControllerTest : XCTestCase @end +#if __IPHONE_OS_VERSION_MAX_ALLOWED < 130000 +typedef enum UIAccessibilityContrast : NSInteger { + UIAccessibilityContrastUnspecified = 0, + UIAccessibilityContrastNormal = 1, + UIAccessibilityContrastHigh = 2 +} UIAccessibilityContrast; + +@interface UITraitCollection(AccessibilityContrastApi) +- (UIAccessibilityContrast)accessibilityContrast; +@end +#endif + @implementation FlutterViewControllerTest - (void)testBinaryMessenger { @@ -80,6 +92,10 @@ - (void)testItReportsPlatformBrightnessWhenViewWillAppear { } - (void)testItReportsDarkPlatformBrightnessWhenTraitCollectionRequestsIt { + if (!@available(iOS 13, *)) { + return; + } + // Setup test. id engine = OCMClassMock([FlutterEngine class]); @@ -121,7 +137,6 @@ - (UITraitCollection*)setupFakeUserInterfaceStyle:(UIUserInterfaceStyle)style { #pragma mark - Platform Contrast -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 - (void)testItReportsNormalPlatformContrastByDefault { if (!@available(iOS 13, *)) { return; @@ -221,6 +236,5 @@ - (UITraitCollection*)setupFakeTraitCollectionWithContrast:(UIAccessibilityContr OCMStub([mockTraitCollection accessibilityContrast]).andReturn(UIAccessibilityContrastHigh); return mockTraitCollection; } -#endif @end From 557fb06c192fec8ea08c034e5ae635335c87fa74 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Wed, 14 Aug 2019 20:13:29 -0700 Subject: [PATCH 22/26] Formatting --- .../darwin/ios/framework/Source/FlutterViewController.mm | 2 +- .../darwin/ios/framework/Source/FlutterViewControllerTest.m | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index b839001c69472..8aaf8bb1a6e36 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -39,7 +39,7 @@ @interface FlutterViewController () UIAccessibilityContrastHigh = 2 } UIAccessibilityContrast; -@interface UITraitCollection(AccessibilityContrastApi) +@interface UITraitCollection (AccessibilityContrastApi) - (UIAccessibilityContrast)accessibilityContrast; @end #endif diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m index e447187148782..5c64e65670a8b 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m @@ -22,7 +22,7 @@ @interface FlutterViewControllerTest : XCTestCase UIAccessibilityContrastHigh = 2 } UIAccessibilityContrast; -@interface UITraitCollection(AccessibilityContrastApi) +@interface UITraitCollection (AccessibilityContrastApi) - (UIAccessibilityContrast)accessibilityContrast; @end #endif @@ -95,7 +95,7 @@ - (void)testItReportsDarkPlatformBrightnessWhenTraitCollectionRequestsIt { if (!@available(iOS 13, *)) { return; } - + // Setup test. id engine = OCMClassMock([FlutterEngine class]); From 7bfdd78b544e4b01003b9e85d2bed44d623cb3f7 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Thu, 15 Aug 2019 13:18:15 -0700 Subject: [PATCH 23/26] PR Updates. --- .../framework/Source/FlutterViewController.mm | 10 +++++++++- .../Source/FlutterViewControllerTest.m | 20 ++++++++++++------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm index 8aaf8bb1a6e36..4504ea7f93d54 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewController.mm @@ -32,6 +32,8 @@ @interface FlutterViewController () @property(nonatomic, readwrite, getter=isDisplayingFlutterUI) BOOL displayingFlutterUI; @end +// The following conditional compilation defines an API 13 concept on earlier API targets so that +// a compiler compiling against API 12 or below does not blow up due to non-existent members. #if __IPHONE_OS_VERSION_MAX_ALLOWED < 130000 typedef enum UIAccessibilityContrast : NSInteger { UIAccessibilityContrastUnspecified = 0, @@ -39,7 +41,7 @@ @interface FlutterViewController () UIAccessibilityContrastHigh = 2 } UIAccessibilityContrast; -@interface UITraitCollection (AccessibilityContrastApi) +@interface UITraitCollection (MethodsFromNewerSDK) - (UIAccessibilityContrast)accessibilityContrast; @end #endif @@ -984,6 +986,9 @@ - (BOOL)isAlwaysUse24HourFormat { return [dateFormat rangeOfString:@"a"].location == NSNotFound; } +// The brightness mode of the platform, e.g., light or dark, expressed as a string that +// is understood by the Flutter framework. See the settings system channel for more +// information. - (NSString*)brightnessMode { if (@available(iOS 13, *)) { UIUserInterfaceStyle style = self.traitCollection.userInterfaceStyle; @@ -998,6 +1003,9 @@ - (NSString*)brightnessMode { } } +// The contrast mode of the platform, e.g., normal or high, expressed as a string that is +// understood by the Flutter framework. See the settings system channel for more +// information. - (NSString*)contrastMode { if (@available(iOS 13, *)) { UIAccessibilityContrast contrast = self.traitCollection.accessibilityContrast; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m index 5c64e65670a8b..30ac3ec81a0c7 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m @@ -15,6 +15,8 @@ @interface FlutterViewControllerTest : XCTestCase @end +// The following conditional compilation defines an API 13 concept on earlier API targets so that +// a compiler compiling against API 12 or below does not blow up due to non-existent members. #if __IPHONE_OS_VERSION_MAX_ALLOWED < 130000 typedef enum UIAccessibilityContrast : NSInteger { UIAccessibilityContrastUnspecified = 0, @@ -22,7 +24,7 @@ @interface FlutterViewControllerTest : XCTestCase UIAccessibilityContrastHigh = 2 } UIAccessibilityContrast; -@interface UITraitCollection (AccessibilityContrastApi) +@interface UITraitCollection (MethodsFromNewerSDK) - (UIAccessibilityContrast)accessibilityContrast; @end #endif @@ -105,7 +107,7 @@ - (void)testItReportsDarkPlatformBrightnessWhenTraitCollectionRequestsIt { FlutterViewController* realVC = [[FlutterViewController alloc] initWithEngine:engine nibName:nil bundle:nil]; - id mockTraitCollection = [self setupFakeUserInterfaceStyle:UIUserInterfaceStyleDark]; + id mockTraitCollection = [self fakeTraitCollectionWithUserInterfaceStyle:UIUserInterfaceStyleDark]; // We partially mock the real FlutterViewController to act as the OS and report // the UITraitCollection of our choice. Mocking the object under test is not @@ -129,9 +131,11 @@ - (void)testItReportsDarkPlatformBrightnessWhenTraitCollectionRequestsIt { [mockTraitCollection stopMocking]; } -- (UITraitCollection*)setupFakeUserInterfaceStyle:(UIUserInterfaceStyle)style { +// Creates a mocked UITraitCollection with nil values for everything except userInterfaceStyle, +// which is set to the given "style". +- (UITraitCollection*)fakeTraitCollectionWithUserInterfaceStyle:(UIUserInterfaceStyle)style { id mockTraitCollection = OCMClassMock([UITraitCollection class]); - OCMStub([mockTraitCollection userInterfaceStyle]).andReturn(UIUserInterfaceStyleDark); + OCMStub([mockTraitCollection userInterfaceStyle]).andReturn(style); return mockTraitCollection; } @@ -207,7 +211,7 @@ - (void)testItReportsHighContrastWhenTraitCollectionRequestsIt { FlutterViewController* realVC = [[FlutterViewController alloc] initWithEngine:engine nibName:nil bundle:nil]; - id mockTraitCollection = [self setupFakeTraitCollectionWithContrast:UIAccessibilityContrastHigh]; + id mockTraitCollection = [self fakeTraitCollectionWithContrast:UIAccessibilityContrastHigh]; // We partially mock the real FlutterViewController to act as the OS and report // the UITraitCollection of our choice. Mocking the object under test is not @@ -231,9 +235,11 @@ - (void)testItReportsHighContrastWhenTraitCollectionRequestsIt { [mockTraitCollection stopMocking]; } -- (UITraitCollection*)setupFakeTraitCollectionWithContrast:(UIAccessibilityContrast)contrast { +// Creates a mocked UITraitCollection with nil values for everything except accessibilityContrast, +// which is set to the given "contrast". +- (UITraitCollection*)fakeTraitCollectionWithContrast:(UIAccessibilityContrast)contrast { id mockTraitCollection = OCMClassMock([UITraitCollection class]); - OCMStub([mockTraitCollection accessibilityContrast]).andReturn(UIAccessibilityContrastHigh); + OCMStub([mockTraitCollection accessibilityContrast]).andReturn(contrast); return mockTraitCollection; } From a4053eb8eb6cdeaf5bdf5bb5bf3a837b368543ec Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Thu, 15 Aug 2019 13:22:39 -0700 Subject: [PATCH 24/26] Formatting --- .../darwin/ios/framework/Source/FlutterViewControllerTest.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m index 30ac3ec81a0c7..e152e72c74110 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m @@ -107,7 +107,8 @@ - (void)testItReportsDarkPlatformBrightnessWhenTraitCollectionRequestsIt { FlutterViewController* realVC = [[FlutterViewController alloc] initWithEngine:engine nibName:nil bundle:nil]; - id mockTraitCollection = [self fakeTraitCollectionWithUserInterfaceStyle:UIUserInterfaceStyleDark]; + id mockTraitCollection = + [self fakeTraitCollectionWithUserInterfaceStyle:UIUserInterfaceStyleDark]; // We partially mock the real FlutterViewController to act as the OS and report // the UITraitCollection of our choice. Mocking the object under test is not From 19214335476300ea7ef2ec56eab622c5ec963473 Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Thu, 15 Aug 2019 13:40:47 -0700 Subject: [PATCH 25/26] Formatting --- .../darwin/ios/framework/Source/FlutterViewControllerTest.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m index e152e72c74110..ca431da779094 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.m @@ -108,7 +108,7 @@ - (void)testItReportsDarkPlatformBrightnessWhenTraitCollectionRequestsIt { nibName:nil bundle:nil]; id mockTraitCollection = - [self fakeTraitCollectionWithUserInterfaceStyle:UIUserInterfaceStyleDark]; + [self fakeTraitCollectionWithUserInterfaceStyle:UIUserInterfaceStyleDark]; // We partially mock the real FlutterViewController to act as the OS and report // the UITraitCollection of our choice. Mocking the object under test is not From 0e2a1b5e4c98250c96787b1914ca4074eef2cbed Mon Sep 17 00:00:00 2001 From: Matt Carroll Date: Thu, 15 Aug 2019 13:50:16 -0700 Subject: [PATCH 26/26] Reverted run_tests.h device type. --- testing/ios/IosUnitTests/run_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/ios/IosUnitTests/run_tests.sh b/testing/ios/IosUnitTests/run_tests.sh index 6e0b5490213e2..b4efa3d237795 100755 --- a/testing/ios/IosUnitTests/run_tests.sh +++ b/testing/ios/IosUnitTests/run_tests.sh @@ -12,6 +12,6 @@ fi set -o pipefail && xcodebuild -sdk iphonesimulator \ -scheme IosUnitTests \ - -destination 'platform=iOS Simulator,name=iPhone 8,OS=12.2' \ + -destination 'platform=iOS Simulator,name=iPhone SE,OS=12.2' \ test \ FLUTTER_ENGINE=$FLUTTER_ENGINE | $PRETTY