From b3cfd9290c0bdb2766599c8ce081820bd3a0fb60 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Wed, 6 Sep 2023 15:31:14 -0700 Subject: [PATCH 1/3] Revert "Revert "Reland "Build iOS unittest target in unopt builds" (#44356)"" (#45346)" This reverts commit ca513c99925793198f1a72b2ce17d6d90f37ee3c. fix 1 fix fix temp ci change fix name space fix fix fix format revert fix draft fix unittest fix fromat eof line --- .ci.yaml | 2 +- BUILD.gn | 4 + shell/platform/darwin/ios/BUILD.gn | 2 +- .../Source/FlutterChannelKeyResponderTest.mm | 3 + .../Source/FlutterEmbedderKeyResponderTest.mm | 6 +- .../Source/FlutterEngineGroupTest.mm | 1 + .../framework/Source/FlutterEngineTest_mrc.mm | 1 + .../framework/Source/FlutterFakeKeyEvents.h | 31 +++-- .../framework/Source/FlutterFakeKeyEvents.mm | 5 + .../Source/FlutterKeyboardManagerTest.mm | 2 + .../Source/FlutterPlatformViewsTest.mm | 127 +++++++++--------- .../Source/FlutterTextureRegistryRelayTest.mm | 1 + .../Source/FlutterUndoManagerPluginTest.mm | 2 +- .../Source/FlutterViewControllerTest.mm | 21 +-- .../Source/FlutterViewControllerTest_mrc.mm | 84 ++++++------ .../ios/framework/Source/FlutterViewTest.mm | 15 ++- .../framework/Source/SemanticsObjectTest.mm | 24 ++-- .../framework/Source/VsyncWaiterIosTest.mm | 9 +- .../Source/accessibility_bridge_test.mm | 6 +- .../ios/platform_message_handler_ios_test.mm | 2 +- 20 files changed, 187 insertions(+), 161 deletions(-) diff --git a/.ci.yaml b/.ci.yaml index 484dabfa97843..06512b60669b8 100644 --- a/.ci.yaml +++ b/.ci.yaml @@ -393,7 +393,7 @@ targets: - name: Mac mac_clang_tidy recipe: engine_v2/engine_v2 - presubmit: false + presubmit: true timeout: 120 properties: config_name: mac_clang_tidy diff --git a/BUILD.gn b/BUILD.gn index 05fbbb093360a..704c0f2c8628d 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -149,6 +149,10 @@ group("unittests") { [ "//flutter/shell/platform/android:flutter_shell_native_unittests" ] } + if (is_ios) { + public_deps += [ "//flutter/shell/platform/darwin/ios:ios_test_flutter" ] + } + # Compile all unittests targets if enabled. if (enable_unittests) { public_deps += [ diff --git a/shell/platform/darwin/ios/BUILD.gn b/shell/platform/darwin/ios/BUILD.gn index f726f41f23a95..fe180c2af422f 100644 --- a/shell/platform/darwin/ios/BUILD.gn +++ b/shell/platform/darwin/ios/BUILD.gn @@ -270,7 +270,7 @@ source_set("ios_test_flutter_mrc") { shared_library("ios_test_flutter") { testonly = true - visibility = [ ":*" ] + visibility = [ "*" ] cflags = [ "-fvisibility=default", "-F$platform_frameworks_path", diff --git a/shell/platform/darwin/ios/framework/Source/FlutterChannelKeyResponderTest.mm b/shell/platform/darwin/ios/framework/Source/FlutterChannelKeyResponderTest.mm index fcdcb37cb0b0d..07c8a71b85c2b 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterChannelKeyResponderTest.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterChannelKeyResponderTest.mm @@ -18,9 +18,12 @@ namespace { API_AVAILABLE(ios(13.4)) +// NOLINTNEXTLINE(readability-identifier-naming) constexpr UIKeyboardHIDUsage keyACode = (UIKeyboardHIDUsage)0x4; // KeyA iOS scan code. } // namespace +using namespace flutter::testing; + API_AVAILABLE(ios(13.4)) @interface FlutterChannelKeyResponderTest : XCTestCase @property(copy, nonatomic) FlutterUIPressProxy* testKeyDownEvent API_AVAILABLE(ios(13.4)); diff --git a/shell/platform/darwin/ios/framework/Source/FlutterEmbedderKeyResponderTest.mm b/shell/platform/darwin/ios/framework/Source/FlutterEmbedderKeyResponderTest.mm index f29d3b2d13664..0aac9fdaf3926 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterEmbedderKeyResponderTest.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterEmbedderKeyResponderTest.mm @@ -15,6 +15,7 @@ #include "flutter/shell/platform/embedder/test_utils/key_codes.g.h" using namespace flutter::testing::keycodes; +using namespace flutter::testing; FLUTTER_ASSERT_ARC; @@ -43,7 +44,7 @@ - (instancetype)initWithEvent:(const FlutterKeyEvent*)event if (event->character != nullptr) { size_t len = strlen(event->character); char* character = new char[len + 1]; - strcpy(character, event->character); + strlcpy(character, event->character, len + 1); _data->character = character; } _callback = callback; @@ -63,8 +64,9 @@ - (void)respond:(BOOL)handled { } - (void)dealloc { - if (_data->character != nullptr) + if (_data->character != nullptr) { delete[] _data->character; + } delete _data; } @end diff --git a/shell/platform/darwin/ios/framework/Source/FlutterEngineGroupTest.mm b/shell/platform/darwin/ios/framework/Source/FlutterEngineGroupTest.mm index db43205c051f8..3bcb473d5b223 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterEngineGroupTest.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterEngineGroupTest.mm @@ -130,6 +130,7 @@ - (void)testReleasesProjectOnDealloc { __weak FlutterDartProject* weakProject; @autoreleasepool { FlutterDartProject* mockProject = OCMClassMock([FlutterDartProject class]); + // NOLINTNEXTLINE(clang-analyzer-deadcode.DeadStores) FlutterEngineGroup* group = [[FlutterEngineGroup alloc] initWithName:@"foo" project:mockProject]; weakProject = mockProject; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterEngineTest_mrc.mm b/shell/platform/darwin/ios/framework/Source/FlutterEngineTest_mrc.mm index 1acf3755f07b5..35ad2c4c21bbb 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterEngineTest_mrc.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterEngineTest_mrc.mm @@ -60,6 +60,7 @@ - (void)testEnableSemanticsWhenFlutterViewAccessibilityDidCall { engine.ensureSemanticsEnabledCalled = NO; [engine flutterViewAccessibilityDidCall]; XCTAssertTrue(engine.ensureSemanticsEnabledCalled); + [engine release]; } @end diff --git a/shell/platform/darwin/ios/framework/Source/FlutterFakeKeyEvents.h b/shell/platform/darwin/ios/framework/Source/FlutterFakeKeyEvents.h index 387ec5a7bb6af..d2996c1e4a5b2 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterFakeKeyEvents.h +++ b/shell/platform/darwin/ios/framework/Source/FlutterFakeKeyEvents.h @@ -47,26 +47,29 @@ API_AVAILABLE(ios(13.4)) @property(readwrite, nonatomic) NSString* dataCharactersIgnoringModifiers; @end -FlutterUIPressProxy* keyDownEvent(UIKeyboardHIDUsage keyCode, - UIKeyModifierFlags modifierFlags = 0x0, - NSTimeInterval timestamp = 0.0f, - const char* characters = "", - const char* charactersIgnoringModifiers = "") +namespace flutter { +namespace testing { +extern FlutterUIPressProxy* keyDownEvent(UIKeyboardHIDUsage keyCode, + UIKeyModifierFlags modifierFlags = 0x0, + NSTimeInterval timestamp = 0.0f, + const char* characters = "", + const char* charactersIgnoringModifiers = "") API_AVAILABLE(ios(13.4)); -FlutterUIPressProxy* keyUpEvent(UIKeyboardHIDUsage keyCode, - UIKeyModifierFlags modifierFlags = 0x0, - NSTimeInterval timestamp = 0.0f, - const char* characters = "", - const char* charactersIgnoringModifiers = "") - API_AVAILABLE(ios(13.4)); - -FlutterUIPressProxy* keyEventWithPhase(UIPressPhase phase, - UIKeyboardHIDUsage keyCode, +extern FlutterUIPressProxy* keyUpEvent(UIKeyboardHIDUsage keyCode, UIKeyModifierFlags modifierFlags = 0x0, NSTimeInterval timestamp = 0.0f, const char* characters = "", const char* charactersIgnoringModifiers = "") API_AVAILABLE(ios(13.4)); +extern FlutterUIPressProxy* keyEventWithPhase(UIPressPhase phase, + UIKeyboardHIDUsage keyCode, + UIKeyModifierFlags modifierFlags = 0x0, + NSTimeInterval timestamp = 0.0f, + const char* characters = "", + const char* charactersIgnoringModifiers = "") + API_AVAILABLE(ios(13.4)); +} // namespace testing +} // namespace flutter #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTER_FAKE_KEY_EVENTS_H_ diff --git a/shell/platform/darwin/ios/framework/Source/FlutterFakeKeyEvents.mm b/shell/platform/darwin/ios/framework/Source/FlutterFakeKeyEvents.mm index abbdbc062632a..aaca2b898581a 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterFakeKeyEvents.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterFakeKeyEvents.mm @@ -84,6 +84,9 @@ - (NSString*)charactersIgnoringModifiers API_AVAILABLE(ios(13.4)) { } @end +namespace flutter { +namespace testing { + FlutterUIPressProxy* keyDownEvent(UIKeyboardHIDUsage keyCode, UIKeyModifierFlags modifierFlags, NSTimeInterval timestamp, @@ -123,3 +126,5 @@ - (NSString*)charactersIgnoringModifiers API_AVAILABLE(ios(13.4)) { type:UIEventTypePresses timestamp:timestamp]; } +} // namespace testing +} // namespace flutter diff --git a/shell/platform/darwin/ios/framework/Source/FlutterKeyboardManagerTest.mm b/shell/platform/darwin/ios/framework/Source/FlutterKeyboardManagerTest.mm index 764a64b242cad..5568c38016db9 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterKeyboardManagerTest.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterKeyboardManagerTest.mm @@ -21,6 +21,8 @@ class PointerDataPacket {}; } // namespace flutter +using namespace flutter::testing; + /// Sometimes we have to use a custom mock to avoid retain cycles in ocmock. @interface FlutterEnginePartialMock : FlutterEngine @property(nonatomic, strong) FlutterBasicMessageChannel* lifecycleChannel; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViewsTest.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViewsTest.mm index bba450217747a..c1a970eac987a 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViewsTest.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViewsTest.mm @@ -125,7 +125,7 @@ void UpdateAssetResolverByType(std::unique_ptr updated_a } // namespace flutter namespace { -fml::RefPtr CreateNewThread(std::string name) { +fml::RefPtr CreateNewThread(const std::string& name) { auto thread = std::make_unique(name); auto runner = thread->GetTaskRunner(); return runner; @@ -155,7 +155,7 @@ - (void)testFlutterViewOnlyCreateOnceInOneFrame { /*is_gpu_disabled_sync_switch=*/nil); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -211,7 +211,7 @@ - (void)testCanCreatePlatformViewWithoutFlutterView { /*is_gpu_disabled_sync_switch=*/nil); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -265,7 +265,7 @@ - (void)testApplyBackdropFilter { /*is_gpu_disabled_sync_switch=*/nil); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -337,7 +337,7 @@ - (void)testApplyBackdropFilterWithCorrectFrame { /*is_gpu_disabled_sync_switch=*/nil); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -409,7 +409,7 @@ - (void)testApplyMultipleBackdropFilters { /*is_gpu_disabled_sync_switch=*/nil); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -482,7 +482,7 @@ - (void)testAddBackdropFilters { /*is_gpu_disabled_sync_switch=*/nil); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -595,7 +595,7 @@ - (void)testRemoveBackdropFilters { /*is_gpu_disabled_sync_switch=*/nil); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -732,7 +732,7 @@ - (void)testEditBackdropFilters { /*is_gpu_disabled_sync_switch=*/nil); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -1009,7 +1009,7 @@ - (void)testApplyBackdropFilterNotDlBlurImageFilter { /*is_gpu_disabled_sync_switch=*/nil); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -1208,29 +1208,29 @@ - (void)testApplyBackdropFilterCorrectAPI { // The gaussianBlur filter is extracted from UIVisualEffectView. // Each test requires a new PlatformViewFilter // Valid UIVisualEffectView API - UIVisualEffectView* visualEffectView = [[UIVisualEffectView alloc] - initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]]; + UIVisualEffectView* visualEffectView = [[[UIVisualEffectView alloc] + initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]] autorelease]; PlatformViewFilter* platformViewFilter = - [[PlatformViewFilter alloc] initWithFrame:CGRectMake(0, 0, 10, 10) - blurRadius:5 - visualEffectView:visualEffectView]; + [[[PlatformViewFilter alloc] initWithFrame:CGRectMake(0, 0, 10, 10) + blurRadius:5 + visualEffectView:visualEffectView] autorelease]; XCTAssertNotNil(platformViewFilter); } - (void)testApplyBackdropFilterAPIChangedInvalidUIVisualEffectView { [PlatformViewFilter resetPreparation]; - UIVisualEffectView* visualEffectView = [[UIVisualEffectView alloc] init]; + UIVisualEffectView* visualEffectView = [[[UIVisualEffectView alloc] init] autorelease]; PlatformViewFilter* platformViewFilter = - [[PlatformViewFilter alloc] initWithFrame:CGRectMake(0, 0, 10, 10) - blurRadius:5 - visualEffectView:visualEffectView]; + [[[PlatformViewFilter alloc] initWithFrame:CGRectMake(0, 0, 10, 10) + blurRadius:5 + visualEffectView:visualEffectView] autorelease]; XCTAssertNil(platformViewFilter); } - (void)testApplyBackdropFilterAPIChangedNoGaussianBlurFilter { [PlatformViewFilter resetPreparation]; - UIVisualEffectView* editedUIVisualEffectView = [[UIVisualEffectView alloc] - initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]]; + UIVisualEffectView* editedUIVisualEffectView = [[[UIVisualEffectView alloc] + initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]] autorelease]; NSArray* subviews = editedUIVisualEffectView.subviews; for (UIView* view in subviews) { if ([NSStringFromClass([view class]) hasSuffix:@"BackdropView"]) { @@ -1244,16 +1244,16 @@ - (void)testApplyBackdropFilterAPIChangedNoGaussianBlurFilter { } } PlatformViewFilter* platformViewFilter = - [[PlatformViewFilter alloc] initWithFrame:CGRectMake(0, 0, 10, 10) - blurRadius:5 - visualEffectView:editedUIVisualEffectView]; + [[[PlatformViewFilter alloc] initWithFrame:CGRectMake(0, 0, 10, 10) + blurRadius:5 + visualEffectView:editedUIVisualEffectView] autorelease]; XCTAssertNil(platformViewFilter); } - (void)testApplyBackdropFilterAPIChangedInvalidInputRadius { [PlatformViewFilter resetPreparation]; - UIVisualEffectView* editedUIVisualEffectView = [[UIVisualEffectView alloc] - initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]]; + UIVisualEffectView* editedUIVisualEffectView = [[[UIVisualEffectView alloc] + initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]] autorelease]; NSArray* subviews = editedUIVisualEffectView.subviews; for (UIView* view in subviews) { if ([NSStringFromClass([view class]) hasSuffix:@"BackdropView"]) { @@ -1268,20 +1268,20 @@ - (void)testApplyBackdropFilterAPIChangedInvalidInputRadius { } PlatformViewFilter* platformViewFilter = - [[PlatformViewFilter alloc] initWithFrame:CGRectMake(0, 0, 10, 10) - blurRadius:5 - visualEffectView:editedUIVisualEffectView]; + [[[PlatformViewFilter alloc] initWithFrame:CGRectMake(0, 0, 10, 10) + blurRadius:5 + visualEffectView:editedUIVisualEffectView] autorelease]; XCTAssertNil(platformViewFilter); } - (void)testBackdropFilterVisualEffectSubviewBackgroundColor { - UIVisualEffectView* visualEffectView = [[UIVisualEffectView alloc] - initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]]; + UIVisualEffectView* visualEffectView = [[[UIVisualEffectView alloc] + initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight]] autorelease]; PlatformViewFilter* platformViewFilter = - [[PlatformViewFilter alloc] initWithFrame:CGRectMake(0, 0, 10, 10) - blurRadius:5 - visualEffectView:visualEffectView]; - CGColorRef visualEffectSubviewBackgroundColor; + [[[PlatformViewFilter alloc] initWithFrame:CGRectMake(0, 0, 10, 10) + blurRadius:5 + visualEffectView:visualEffectView] autorelease]; + CGColorRef visualEffectSubviewBackgroundColor = nil; for (UIView* view in [platformViewFilter backdropFilterView].subviews) { if ([NSStringFromClass([view class]) hasSuffix:@"VisualEffectSubview"]) { visualEffectSubviewBackgroundColor = view.layer.backgroundColor; @@ -1309,7 +1309,7 @@ - (void)testCompositePlatformView { /*is_gpu_disabled_sync_switch=*/nil); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -1365,7 +1365,7 @@ - (void)testBackdropFilterCorrectlyPushedAndReset { /*is_gpu_disabled_sync_switch=*/nil); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -1459,7 +1459,7 @@ - (void)testChildClippingViewShouldBeTheBoundingRectOfPlatformView { /*is_gpu_disabled_sync_switch=*/nil); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -1530,7 +1530,7 @@ - (void)testClipsDoNotInterceptWithPlatformViewShouldNotAddMaskView { /*is_gpu_disabled_sync_switch=*/nil); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -1597,7 +1597,7 @@ - (void)testClipRRectOnlyHasCornersInterceptWithPlatformViewShouldAddMaskView { /*is_gpu_disabled_sync_switch=*/nil); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -1663,7 +1663,7 @@ - (void)testClipRect { /*is_gpu_disabled_sync_switch=*/nil); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -1736,7 +1736,7 @@ - (void)testClipRRect { /*is_gpu_disabled_sync_switch=*/nil); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -1809,7 +1809,7 @@ - (void)testClipPath { /*is_gpu_disabled_sync_switch=*/nil); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -1883,7 +1883,7 @@ - (void)testSetFlutterViewControllerAfterCreateCanStillDispatchTouchEvents { /*is_gpu_disabled_sync_switch=*/nil); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -1947,7 +1947,7 @@ - (void)testSetFlutterViewControllerInTheMiddleOfTouchEventShouldStillAllowGestu /*is_gpu_disabled_sync_switch=*/nil); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -2068,7 +2068,7 @@ - (void)testSetFlutterViewControllerInTheMiddleOfTouchEventShouldStillAllowGestu /*is_gpu_disabled_sync_switch=*/nil); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -2179,7 +2179,7 @@ - (void)testFlutterPlatformViewTouchesCancelledEventAreForcedToBeCancelled { /*is_gpu_disabled_sync_switch=*/nil); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -2241,7 +2241,7 @@ - (void)testFlutterPlatformViewControllerSubmitFrameWithoutFlutterViewNotCrashin /*is_gpu_disabled_sync_switch=*/nil); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -2306,7 +2306,7 @@ - (void)testFlutterPlatformViewControllerSubmitFrameWithoutFlutterViewNotCrashin flutterPlatformViewsController->SetFlutterView(mockFlutterView); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -2356,7 +2356,7 @@ - (void)testFlutterPlatformViewControllerBeginFrameShouldResetCompisitionOrder { flutterPlatformViewsController->SetFlutterView(mockFlutterView); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -2412,7 +2412,7 @@ - (void)testFlutterPlatformViewControllerBeginFrameShouldResetCompisitionOrder { flutterPlatformViewsController->SetFlutterView(mockFlutterView); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -2510,7 +2510,7 @@ - (void)testFlutterPlatformViewControllerBeginFrameShouldResetCompisitionOrder { flutterPlatformViewsController->SetFlutterView(mockFlutterView); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -2608,7 +2608,7 @@ - (void)testThreadMergeAtEndFrame { flutterPlatformViewsController->SetFlutterView(mockFlutterView); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -2668,8 +2668,8 @@ - (int)alphaOfPoint:(CGPoint)point onView:(UIView*)view { - (void)testHasFirstResponderInViewHierarchySubtree_viewItselfBecomesFirstResponder { // For view to become the first responder, it must be a descendant of a UIWindow - UIWindow* window = [[UIWindow alloc] init]; - UITextField* textField = [[UITextField alloc] init]; + UIWindow* window = [[[UIWindow alloc] init] autorelease]; + UITextField* textField = [[[UITextField alloc] init] autorelease]; [window addSubview:textField]; [textField becomeFirstResponder]; @@ -2682,10 +2682,10 @@ - (void)testHasFirstResponderInViewHierarchySubtree_viewItselfBecomesFirstRespon - (void)testHasFirstResponderInViewHierarchySubtree_descendantViewBecomesFirstResponder { // For view to become the first responder, it must be a descendant of a UIWindow - UIWindow* window = [[UIWindow alloc] init]; - UIView* view = [[UIView alloc] init]; - UIView* childView = [[UIView alloc] init]; - UITextField* textField = [[UITextField alloc] init]; + UIWindow* window = [[[UIWindow alloc] init] autorelease]; + UIView* view = [[[UIView alloc] init] autorelease]; + UIView* childView = [[[UIView alloc] init] autorelease]; + UITextField* textField = [[[UITextField alloc] init] autorelease]; [window addSubview:view]; [view addSubview:childView]; [childView addSubview:textField]; @@ -2738,6 +2738,7 @@ - (void)testMaskViewsReleasedWhenPoolIsReleased { // The only retain left is our manual retain called inside the autorelease pool, meaning the // maskViews are dealloc'd. XCTAssertEqual(retainedView.retainCount, 1u); + [retainedView release]; } - (void)testClipMaskViewIsReused { @@ -2758,7 +2759,7 @@ - (void)testClipMaskViewIsReused { /*is_gpu_disabled_sync_switch=*/nil); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -2840,7 +2841,7 @@ - (void)testDifferentClipMaskViewIsUsedForEachView { /*is_gpu_disabled_sync_switch=*/nil); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -2943,7 +2944,7 @@ - (void)testDisposingViewInCompositionOrderDoNotCrash { flutterPlatformViewsController->SetFlutterView(mockFlutterView); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -3048,7 +3049,7 @@ - (void)testOnlyPlatformViewsAreRemovedWhenReset { /*is_gpu_disabled_sync_switch=*/nil); FlutterPlatformViewsTestMockFlutterPlatformFactory* factory = - [[FlutterPlatformViewsTestMockFlutterPlatformFactory new] autorelease]; + [[[FlutterPlatformViewsTestMockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); diff --git a/shell/platform/darwin/ios/framework/Source/FlutterTextureRegistryRelayTest.mm b/shell/platform/darwin/ios/framework/Source/FlutterTextureRegistryRelayTest.mm index 36b473dea8acd..790b484075e3f 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterTextureRegistryRelayTest.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterTextureRegistryRelayTest.mm @@ -61,6 +61,7 @@ - (void)testRetainCycle { weakEngine = engine; } XCTAssertNil(weakEngine); + XCTAssertNotNil(strongRelay); } @end diff --git a/shell/platform/darwin/ios/framework/Source/FlutterUndoManagerPluginTest.mm b/shell/platform/darwin/ios/framework/Source/FlutterUndoManagerPluginTest.mm index 0a30cb1dfb871..24f9bba023582 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterUndoManagerPluginTest.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterUndoManagerPluginTest.mm @@ -41,7 +41,7 @@ - (void)setUp { self.undoManagerPlugin = [[FlutterUndoManagerPluginForTest alloc] initWithDelegate:self.engine]; - self.viewController = [FlutterViewController new]; + self.viewController = [[FlutterViewController alloc] init]; self.undoManagerPlugin.viewController = self.viewController; self.undoManager = OCMClassMock([NSUndoManager class]); diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.mm index e348978f51010..fdf6a70ca3659 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.mm @@ -22,6 +22,8 @@ FLUTTER_ASSERT_ARC +using namespace flutter::testing; + @interface FlutterEngine () - (FlutterTextInputPlugin*)textInputPlugin; - (void)sendKeyEvent:(const FlutterKeyEvent&)event @@ -57,8 +59,9 @@ - (void)notifyLowMemory { - (void)sendKeyEvent:(const FlutterKeyEvent&)event callback:(FlutterKeyEventCallback)callback userData:(void*)userData API_AVAILABLE(ios(9.0)) { - if (callback == nil) + if (callback == nil) { return; + } // NSAssert(callback != nullptr, @"Invalid callback"); // Response is async, so we have to post it to the run loop instead of calling // it directly. @@ -1179,10 +1182,6 @@ - (void)testItReportsDarkPlatformBrightnessWhenTraitCollectionRequestsIt { // Setup test. id settingsChannel = OCMClassMock([FlutterBasicMessageChannel class]); OCMStub([self.mockEngine settingsChannel]).andReturn(settingsChannel); - - FlutterViewController* realVC = [[FlutterViewController alloc] initWithEngine:self.mockEngine - nibName:nil - bundle:nil]; id mockTraitCollection = [self fakeTraitCollectionWithUserInterfaceStyle:UIUserInterfaceStyleDark]; @@ -1190,7 +1189,9 @@ - (void)testItReportsDarkPlatformBrightnessWhenTraitCollectionRequestsIt { // 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); + id partialMockVC = OCMPartialMock([[FlutterViewController alloc] initWithEngine:self.mockEngine + nibName:nil + bundle:nil]); OCMStub([partialMockVC traitCollection]).andReturn(mockTraitCollection); // Exercise behavior under test. @@ -1283,16 +1284,15 @@ - (void)testItReportsHighContrastWhenTraitCollectionRequestsIt { id settingsChannel = OCMClassMock([FlutterBasicMessageChannel class]); OCMStub([self.mockEngine settingsChannel]).andReturn(settingsChannel); - FlutterViewController* realVC = [[FlutterViewController alloc] initWithEngine:self.mockEngine - nibName:nil - bundle:nil]; 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 // 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); + id partialMockVC = OCMPartialMock([[FlutterViewController alloc] initWithEngine:self.mockEngine + nibName:nil + bundle:nil]); OCMStub([partialMockVC traitCollection]).andReturn(mockTraitCollection); // Exercise behavior under test. @@ -1575,6 +1575,7 @@ - (void)testWillDeallocNotification { [[XCTestExpectation alloc] initWithDescription:@"notification called"]; id engine = [[MockEngine alloc] init]; @autoreleasepool { + // NOLINTNEXTLINE(clang-analyzer-deadcode.DeadStores) FlutterViewController* realVC = [[FlutterViewController alloc] initWithEngine:engine nibName:nil bundle:nil]; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest_mrc.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest_mrc.mm index bb691f033ee95..c0bd4ea9afe92 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest_mrc.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest_mrc.mm @@ -51,11 +51,10 @@ - (void)testSetupKeyboardAnimationVsyncClientWillCreateNewVsyncClientForFlutterV id mockDisplayLinkManager = [OCMockObject mockForClass:[DisplayLinkManager class]]; double maxFrameRate = 120; [[[mockDisplayLinkManager stub] andReturnValue:@(maxFrameRate)] displayRefreshRate]; - FlutterEngine* engine = [[FlutterEngine alloc] init]; + FlutterEngine* engine = [[[FlutterEngine alloc] init] autorelease]; [engine runWithEntrypoint:nil]; - FlutterViewController* viewController = [[FlutterViewController alloc] initWithEngine:engine - nibName:nil - bundle:nil]; + FlutterViewController* viewController = + [[[FlutterViewController alloc] initWithEngine:engine nibName:nil bundle:nil] autorelease]; FlutterKeyboardAnimationCallback callback = ^(fml::TimePoint targetTime) { }; [viewController setUpKeyboardAnimationVsyncClient:callback]; @@ -76,11 +75,10 @@ - (void)testSetupKeyboardAnimationVsyncClientWillCreateNewVsyncClientForFlutterV id mockDisplayLinkManager = [OCMockObject mockForClass:[DisplayLinkManager class]]; double maxFrameRate = 120; [[[mockDisplayLinkManager stub] andReturnValue:@(maxFrameRate)] displayRefreshRate]; - FlutterEngine* engine = [[FlutterEngine alloc] init]; + FlutterEngine* engine = [[[FlutterEngine alloc] init] autorelease]; [engine runWithEntrypoint:nil]; - FlutterViewController* viewController = [[FlutterViewController alloc] initWithEngine:engine - nibName:nil - bundle:nil]; + FlutterViewController* viewController = + [[[FlutterViewController alloc] initWithEngine:engine nibName:nil bundle:nil] autorelease]; [viewController createTouchRateCorrectionVSyncClientIfNeeded]; XCTAssertNotNil(viewController.touchRateCorrectionVSyncClient); } @@ -90,11 +88,10 @@ - (void)testCreateTouchRateCorrectionVSyncClientWillNotCreateNewVSyncClientWhenC double maxFrameRate = 120; [[[mockDisplayLinkManager stub] andReturnValue:@(maxFrameRate)] displayRefreshRate]; - FlutterEngine* engine = [[FlutterEngine alloc] init]; + FlutterEngine* engine = [[[FlutterEngine alloc] init] autorelease]; [engine runWithEntrypoint:nil]; - FlutterViewController* viewController = [[FlutterViewController alloc] initWithEngine:engine - nibName:nil - bundle:nil]; + FlutterViewController* viewController = + [[[FlutterViewController alloc] initWithEngine:engine nibName:nil bundle:nil] autorelease]; [viewController createTouchRateCorrectionVSyncClientIfNeeded]; VSyncClient* clientBefore = viewController.touchRateCorrectionVSyncClient; XCTAssertNotNil(clientBefore); @@ -110,11 +107,10 @@ - (void)testCreateTouchRateCorrectionVSyncClientWillNotCreateVsyncClientWhenRefr id mockDisplayLinkManager = [OCMockObject mockForClass:[DisplayLinkManager class]]; double maxFrameRate = 60; [[[mockDisplayLinkManager stub] andReturnValue:@(maxFrameRate)] displayRefreshRate]; - FlutterEngine* engine = [[FlutterEngine alloc] init]; + FlutterEngine* engine = [[[FlutterEngine alloc] init] autorelease]; [engine runWithEntrypoint:nil]; - FlutterViewController* viewController = [[FlutterViewController alloc] initWithEngine:engine - nibName:nil - bundle:nil]; + FlutterViewController* viewController = + [[[FlutterViewController alloc] initWithEngine:engine nibName:nil bundle:nil] autorelease]; [viewController createTouchRateCorrectionVSyncClientIfNeeded]; XCTAssertNil(viewController.touchRateCorrectionVSyncClient); } @@ -123,67 +119,72 @@ - (void)testTriggerTouchRateCorrectionVSyncClientCorrectly { id mockDisplayLinkManager = [OCMockObject mockForClass:[DisplayLinkManager class]]; double maxFrameRate = 120; [[[mockDisplayLinkManager stub] andReturnValue:@(maxFrameRate)] displayRefreshRate]; - FlutterEngine* engine = [[FlutterEngine alloc] init]; + FlutterEngine* engine = [[[FlutterEngine alloc] init] autorelease]; [engine runWithEntrypoint:nil]; - FlutterViewController* viewController = [[FlutterViewController alloc] initWithEngine:engine - nibName:nil - bundle:nil]; + FlutterViewController* viewController = + [[[FlutterViewController alloc] initWithEngine:engine nibName:nil bundle:nil] autorelease]; [viewController loadView]; [viewController viewDidLoad]; VSyncClient* client = viewController.touchRateCorrectionVSyncClient; CADisplayLink* link = [client getDisplayLink]; - UITouch* fakeTouchBegan = [[UITouch alloc] init]; + UITouch* fakeTouchBegan = [[[UITouch alloc] init] autorelease]; fakeTouchBegan.phase = UITouchPhaseBegan; - UITouch* fakeTouchMove = [[UITouch alloc] init]; + UITouch* fakeTouchMove = [[[UITouch alloc] init] autorelease]; fakeTouchMove.phase = UITouchPhaseMoved; - UITouch* fakeTouchEnd = [[UITouch alloc] init]; + UITouch* fakeTouchEnd = [[[UITouch alloc] init] autorelease]; fakeTouchEnd.phase = UITouchPhaseEnded; - UITouch* fakeTouchCancelled = [[UITouch alloc] init]; + UITouch* fakeTouchCancelled = [[[UITouch alloc] init] autorelease]; fakeTouchCancelled.phase = UITouchPhaseCancelled; [viewController - triggerTouchRateCorrectionIfNeeded:[[NSSet alloc] initWithObjects:fakeTouchBegan, nil]]; + triggerTouchRateCorrectionIfNeeded:[[[NSSet alloc] initWithObjects:fakeTouchBegan, nil] + autorelease]]; XCTAssertFalse(link.isPaused); [viewController - triggerTouchRateCorrectionIfNeeded:[[NSSet alloc] initWithObjects:fakeTouchEnd, nil]]; + triggerTouchRateCorrectionIfNeeded:[[[NSSet alloc] initWithObjects:fakeTouchEnd, nil] + autorelease]]; XCTAssertTrue(link.isPaused); [viewController - triggerTouchRateCorrectionIfNeeded:[[NSSet alloc] initWithObjects:fakeTouchMove, nil]]; + triggerTouchRateCorrectionIfNeeded:[[[NSSet alloc] initWithObjects:fakeTouchMove, nil] + autorelease]]; XCTAssertFalse(link.isPaused); [viewController - triggerTouchRateCorrectionIfNeeded:[[NSSet alloc] initWithObjects:fakeTouchCancelled, nil]]; + triggerTouchRateCorrectionIfNeeded:[[[NSSet alloc] initWithObjects:fakeTouchCancelled, nil] + autorelease]]; XCTAssertTrue(link.isPaused); [viewController - triggerTouchRateCorrectionIfNeeded:[[NSSet alloc] - initWithObjects:fakeTouchBegan, fakeTouchEnd, nil]]; + triggerTouchRateCorrectionIfNeeded:[[[NSSet alloc] + initWithObjects:fakeTouchBegan, fakeTouchEnd, nil] + autorelease]]; XCTAssertFalse(link.isPaused); [viewController - triggerTouchRateCorrectionIfNeeded:[[NSSet alloc] initWithObjects:fakeTouchEnd, - fakeTouchCancelled, nil]]; + triggerTouchRateCorrectionIfNeeded:[[[NSSet alloc] + initWithObjects:fakeTouchEnd, fakeTouchCancelled, nil] + autorelease]]; XCTAssertTrue(link.isPaused); [viewController - triggerTouchRateCorrectionIfNeeded:[[NSSet alloc] - initWithObjects:fakeTouchMove, fakeTouchEnd, nil]]; + triggerTouchRateCorrectionIfNeeded:[[[NSSet alloc] + initWithObjects:fakeTouchMove, fakeTouchEnd, nil] + autorelease]]; XCTAssertFalse(link.isPaused); } - (void)testFlutterViewControllerStartKeyboardAnimationWillCreateVsyncClientCorrectly { - FlutterEngine* engine = [[FlutterEngine alloc] init]; + FlutterEngine* engine = [[[FlutterEngine alloc] init] autorelease]; [engine runWithEntrypoint:nil]; - FlutterViewController* viewController = [[FlutterViewController alloc] initWithEngine:engine - nibName:nil - bundle:nil]; + FlutterViewController* viewController = + [[[FlutterViewController alloc] initWithEngine:engine nibName:nil bundle:nil] autorelease]; viewController.targetViewInsetBottom = 100; [viewController startKeyBoardAnimation:0.25]; XCTAssertNotNil(viewController.keyboardAnimationVSyncClient); @@ -191,11 +192,10 @@ - (void)testFlutterViewControllerStartKeyboardAnimationWillCreateVsyncClientCorr - (void) testSetupKeyboardAnimationVsyncClientWillNotCreateNewVsyncClientWhenKeyboardAnimationCallbackIsNil { - FlutterEngine* engine = [[FlutterEngine alloc] init]; + FlutterEngine* engine = [[[FlutterEngine alloc] init] autorelease]; [engine runWithEntrypoint:nil]; - FlutterViewController* viewController = [[FlutterViewController alloc] initWithEngine:engine - nibName:nil - bundle:nil]; + FlutterViewController* viewController = + [[[FlutterViewController alloc] initWithEngine:engine nibName:nil bundle:nil] autorelease]; [viewController setUpKeyboardAnimationVsyncClient:nil]; XCTAssertNil(viewController.keyboardAnimationVSyncClient); } diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewTest.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewTest.mm index 23d9b2dc527e6..78f95210e37e6 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewTest.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewTest.mm @@ -43,23 +43,26 @@ @interface FlutterViewTest : XCTestCase @implementation FlutterViewTest - (void)testFlutterViewEnableSemanticsWhenIsAccessibilityElementIsCalled { - FakeDelegate* delegate = [[FakeDelegate alloc] init]; - FlutterView* view = [[FlutterView alloc] initWithDelegate:delegate opaque:NO enableWideGamut:NO]; + FakeDelegate* delegate = [[[FakeDelegate alloc] init] autorelease]; + FlutterView* view = [[[FlutterView alloc] initWithDelegate:delegate opaque:NO + enableWideGamut:NO] autorelease]; delegate.callbackCalled = NO; XCTAssertFalse(view.isAccessibilityElement); XCTAssertTrue(delegate.callbackCalled); } - (void)testFlutterViewBackgroundColorIsNotNil { - FakeDelegate* delegate = [[FakeDelegate alloc] init]; - FlutterView* view = [[FlutterView alloc] initWithDelegate:delegate opaque:NO enableWideGamut:NO]; + FakeDelegate* delegate = [[[FakeDelegate alloc] init] autorelease]; + FlutterView* view = [[[FlutterView alloc] initWithDelegate:delegate opaque:NO + enableWideGamut:NO] autorelease]; XCTAssertNotNil(view.backgroundColor); } - (void)testIgnoreWideColorWithoutImpeller { - FakeDelegate* delegate = [[FakeDelegate alloc] init]; + FakeDelegate* delegate = [[[FakeDelegate alloc] init] autorelease]; delegate.isUsingImpeller = NO; - FlutterView* view = [[FlutterView alloc] initWithDelegate:delegate opaque:NO enableWideGamut:YES]; + FlutterView* view = [[[FlutterView alloc] initWithDelegate:delegate opaque:NO + enableWideGamut:YES] autorelease]; [view layoutSubviews]; XCTAssertTrue([view.layer isKindOfClass:NSClassFromString(@"CAMetalLayer")]); CAMetalLayer* layer = (CAMetalLayer*)view.layer; diff --git a/shell/platform/darwin/ios/framework/Source/SemanticsObjectTest.mm b/shell/platform/darwin/ios/framework/Source/SemanticsObjectTest.mm index c2200af6a6881..0ae81d6048e4d 100644 --- a/shell/platform/darwin/ios/framework/Source/SemanticsObjectTest.mm +++ b/shell/platform/darwin/ios/framework/Source/SemanticsObjectTest.mm @@ -12,6 +12,12 @@ const CGRect kScreenSize = CGRectMake(0, 0, 600, 800); +// copied from clang document: https://clang-analyzer.llvm.org/faq.html#unlocalized_string +__attribute__((annotate("returns_localized_nsstring"))) static inline NSString* +LocalizationNotNeeded(NSString* s) { + return s; +} + namespace flutter { namespace { @@ -660,9 +666,9 @@ - (void)testFlutterScrollableSemanticsObjectWithLabelValueHintIsNotHiddenWhenVoi [scrollable accessibilityBridgeDidFinishUpdate]; UIScrollView* scrollView = [scrollable nativeAccessibility]; XCTAssertTrue(scrollView.isAccessibilityElement); - XCTAssertTrue([scrollView.accessibilityLabel isEqualToString:@"label"]); - XCTAssertTrue([scrollView.accessibilityValue isEqualToString:@"value"]); - XCTAssertTrue([scrollView.accessibilityHint isEqualToString:@"hint"]); + XCTAssertTrue([scrollView.accessibilityLabel isEqualToString:LocalizationNotNeeded(@"label")]); + XCTAssertTrue([scrollView.accessibilityValue isEqualToString:LocalizationNotNeeded(@"value")]); + XCTAssertTrue([scrollView.accessibilityHint isEqualToString:LocalizationNotNeeded(@"hint")]); } - (void)testFlutterSemanticsObjectMergeTooltipToLabel { @@ -788,7 +794,7 @@ - (void)testSemanticsObjectBuildsAttributedString { FlutterSemanticsObject* object = [[FlutterSemanticsObject alloc] initWithBridge:bridge uid:0]; [object setSemanticsNode:&node]; NSMutableAttributedString* expectedAttributedLabel = - [[NSMutableAttributedString alloc] initWithString:@"label"]; + [[NSMutableAttributedString alloc] initWithString:LocalizationNotNeeded(@"label")]; NSDictionary* attributeDict = @{ UIAccessibilitySpeechAttributeSpellOut : @YES, }; @@ -797,7 +803,7 @@ - (void)testSemanticsObjectBuildsAttributedString { [object.accessibilityAttributedLabel isEqualToAttributedString:expectedAttributedLabel]); NSMutableAttributedString* expectedAttributedValue = - [[NSMutableAttributedString alloc] initWithString:@"value"]; + [[NSMutableAttributedString alloc] initWithString:LocalizationNotNeeded(@"value")]; attributeDict = @{ UIAccessibilitySpeechAttributeSpellOut : @YES, }; @@ -806,7 +812,7 @@ - (void)testSemanticsObjectBuildsAttributedString { [object.accessibilityAttributedValue isEqualToAttributedString:expectedAttributedValue]); NSMutableAttributedString* expectedAttributedHint = - [[NSMutableAttributedString alloc] initWithString:@"hint"]; + [[NSMutableAttributedString alloc] initWithString:LocalizationNotNeeded(@"hint")]; attributeDict = @{ UIAccessibilitySpeechAttributeLanguage : @"en-MX", }; @@ -935,7 +941,7 @@ - (void)testFlutterSwitchSemanticsObjectMatchesUISwitch { nativeSwitch.on = YES; XCTAssertEqual(object.accessibilityTraits, nativeSwitch.accessibilityTraits); - XCTAssertEqual(object.accessibilityValue, nativeSwitch.accessibilityValue); + XCTAssertEqualObjects(object.accessibilityValue, nativeSwitch.accessibilityValue); // Set the toggled to false; flutter::SemanticsNode update; @@ -947,7 +953,7 @@ - (void)testFlutterSwitchSemanticsObjectMatchesUISwitch { nativeSwitch.on = NO; XCTAssertEqual(object.accessibilityTraits, nativeSwitch.accessibilityTraits); - XCTAssertEqual(object.accessibilityValue, nativeSwitch.accessibilityValue); + XCTAssertEqualObjects(object.accessibilityValue, nativeSwitch.accessibilityValue); } - (void)testFlutterSemanticsObjectOfRadioButton { @@ -987,7 +993,7 @@ - (void)testFlutterSwitchSemanticsObjectMatchesUISwitchDisabled { nativeSwitch.enabled = NO; XCTAssertEqual(object.accessibilityTraits, nativeSwitch.accessibilityTraits); - XCTAssertEqual(object.accessibilityValue, nativeSwitch.accessibilityValue); + XCTAssertEqualObjects(object.accessibilityValue, nativeSwitch.accessibilityValue); } - (void)testSemanticsObjectDeallocated { diff --git a/shell/platform/darwin/ios/framework/Source/VsyncWaiterIosTest.mm b/shell/platform/darwin/ios/framework/Source/VsyncWaiterIosTest.mm index eace6585198ed..39fc0341fc7bc 100644 --- a/shell/platform/darwin/ios/framework/Source/VsyncWaiterIosTest.mm +++ b/shell/platform/darwin/ios/framework/Source/VsyncWaiterIosTest.mm @@ -13,7 +13,7 @@ FLUTTER_ASSERT_NOT_ARC namespace { -fml::RefPtr CreateNewThread(std::string name) { +fml::RefPtr CreateNewThread(const std::string& name) { auto thread = std::make_unique(name); auto runner = thread->GetTaskRunner(); return runner; @@ -48,8 +48,6 @@ - (void)testSetAllowPauseAfterVsyncCorrect { [vsyncClient await]; [vsyncClient onDisplayLink:link]; XCTAssertTrue(link.isPaused); - - [vsyncClient release]; } - (void)testSetCorrectVariableRefreshRates { @@ -72,7 +70,6 @@ - (void)testSetCorrectVariableRefreshRates { } else { XCTAssertEqualWithAccuracy(link.preferredFramesPerSecond, maxFrameRate, 0.1); } - [vsyncClient release]; } - (void)testDoNotSetVariableRefreshRatesIfCADisableMinimumFrameDurationOnPhoneIsNotOn { @@ -95,7 +92,6 @@ - (void)testDoNotSetVariableRefreshRatesIfCADisableMinimumFrameDurationOnPhoneIs } else { XCTAssertEqualWithAccuracy(link.preferredFramesPerSecond, 0, 0.1); } - [vsyncClient release]; } - (void)testDoNotSetVariableRefreshRatesIfCADisableMinimumFrameDurationOnPhoneIsNotSet { @@ -114,7 +110,6 @@ - (void)testDoNotSetVariableRefreshRatesIfCADisableMinimumFrameDurationOnPhoneIs } else { XCTAssertEqualWithAccuracy(link.preferredFramesPerSecond, 0, 0.1); } - [vsyncClient release]; } - (void)testAwaitAndPauseWillWorkCorrectly { @@ -132,8 +127,6 @@ - (void)testAwaitAndPauseWillWorkCorrectly { [vsyncClient pause]; XCTAssertTrue(link.isPaused); - - [vsyncClient release]; } - (void)testRefreshRateUpdatedTo80WhenThraedsMerge { diff --git a/shell/platform/darwin/ios/framework/Source/accessibility_bridge_test.mm b/shell/platform/darwin/ios/framework/Source/accessibility_bridge_test.mm index 283d4fe02decd..ac44da5370b9d 100644 --- a/shell/platform/darwin/ios/framework/Source/accessibility_bridge_test.mm +++ b/shell/platform/darwin/ios/framework/Source/accessibility_bridge_test.mm @@ -125,7 +125,7 @@ void PostAccessibilityNotification(UIAccessibilityNotifications notification, } // namespace flutter namespace { -fml::RefPtr CreateNewThread(std::string name) { +fml::RefPtr CreateNewThread(const std::string& name) { auto thread = std::make_unique(name); auto runner = thread->GetTaskRunner(); return runner; @@ -288,7 +288,7 @@ - (void)testSemanticsDeallocated { std::string label = "some label"; flutterPlatformViewsController->SetFlutterView(mockFlutterView); - MockFlutterPlatformFactory* factory = [[MockFlutterPlatformFactory new] autorelease]; + MockFlutterPlatformFactory* factory = [[[MockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); @@ -342,7 +342,7 @@ - (void)testSemanticsDeallocatedWithoutLoadingView { /*worker_task_runner=*/nil, /*is_gpu_disabled_sync_switch=*/nil); - MockFlutterPlatformFactory* factory = [[MockFlutterPlatformFactory new] autorelease]; + MockFlutterPlatformFactory* factory = [[[MockFlutterPlatformFactory alloc] init] autorelease]; flutterPlatformViewsController->RegisterViewFactory( factory, @"MockFlutterPlatformView", FlutterPlatformViewGestureRecognizersBlockingPolicyEager); diff --git a/shell/platform/darwin/ios/platform_message_handler_ios_test.mm b/shell/platform/darwin/ios/platform_message_handler_ios_test.mm index 92164577651af..c1988bc2158f4 100644 --- a/shell/platform/darwin/ios/platform_message_handler_ios_test.mm +++ b/shell/platform/darwin/ios/platform_message_handler_ios_test.mm @@ -18,7 +18,7 @@ namespace { using namespace flutter; -fml::RefPtr CreateNewThread(std::string name) { +fml::RefPtr CreateNewThread(const std::string& name) { auto thread = std::make_unique(name); auto runner = thread->GetTaskRunner(); return runner; From 16e08035e86b625440529ad104bf361ac9ee1961 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Fri, 8 Sep 2023 13:41:50 -0700 Subject: [PATCH 2/3] review format fix fix fix --- .../Source/FlutterChannelKeyResponderTest.mm | 16 +++++---------- .../Source/FlutterEngineGroupTest.mm | 2 +- .../Source/FlutterPlatformViewsTest.mm | 4 ++-- .../Source/FlutterViewControllerTest.mm | 1 + .../framework/Source/SemanticsObjectTest.mm | 20 ++++++++----------- 5 files changed, 17 insertions(+), 26 deletions(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterChannelKeyResponderTest.mm b/shell/platform/darwin/ios/framework/Source/FlutterChannelKeyResponderTest.mm index 07c8a71b85c2b..16b26ceabd601 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterChannelKeyResponderTest.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterChannelKeyResponderTest.mm @@ -16,12 +16,6 @@ XCTAssertTrue([value isEqualToString:expected], \ @"String \"%@\" not equal to the expected value of \"%@\"", value, expected) -namespace { -API_AVAILABLE(ios(13.4)) -// NOLINTNEXTLINE(readability-identifier-naming) -constexpr UIKeyboardHIDUsage keyACode = (UIKeyboardHIDUsage)0x4; // KeyA iOS scan code. -} // namespace - using namespace flutter::testing; API_AVAILABLE(ios(13.4)) @@ -38,8 +32,8 @@ - (void)setUp { } else { XCTSkip(@"Required API not present for test."); } - _testKeyDownEvent = keyDownEvent(keyACode, 0x0, 0.0f, "a", "a"); - _testKeyUpEvent = keyUpEvent(keyACode, 0x0, 0.0f); + _testKeyDownEvent = keyDownEvent(UIKeyboardHIDUsageKeyboardA, 0x0, 0.0f, "a", "a"); + _testKeyUpEvent = keyUpEvent(UIKeyboardHIDUsageKeyboardA, 0x0, 0.0f); } - (void)tearDown API_AVAILABLE(ios(13.4)) { @@ -79,7 +73,7 @@ - (void)testBasicKeyEvent API_AVAILABLE(ios(13.4)) { XCTAssertEqual([messages count], 1u); XCTAssertStrEqual([messages lastObject][@"keymap"], @"ios"); XCTAssertStrEqual([messages lastObject][@"type"], @"keydown"); - XCTAssertEqual([[messages lastObject][@"keyCode"] intValue], keyACode); + XCTAssertEqual([[messages lastObject][@"keyCode"] intValue], UIKeyboardHIDUsageKeyboardA); XCTAssertEqual([[messages lastObject][@"modifiers"] intValue], 0x0); XCTAssertStrEqual([messages lastObject][@"characters"], @"a"); XCTAssertStrEqual([messages lastObject][@"charactersIgnoringModifiers"], @"a"); @@ -100,7 +94,7 @@ - (void)testBasicKeyEvent API_AVAILABLE(ios(13.4)) { XCTAssertEqual([messages count], 1u); XCTAssertStrEqual([messages lastObject][@"keymap"], @"ios"); XCTAssertStrEqual([messages lastObject][@"type"], @"keyup"); - XCTAssertEqual([[messages lastObject][@"keyCode"] intValue], keyACode); + XCTAssertEqual([[messages lastObject][@"keyCode"] intValue], UIKeyboardHIDUsageKeyboardA); XCTAssertEqual([[messages lastObject][@"modifiers"] intValue], 0x0); XCTAssertEqual([responses count], 1u); @@ -137,7 +131,7 @@ - (void)testEmptyResponseIsTakenAsHandled API_AVAILABLE(ios(13.4)) { XCTAssertEqual([messages count], 1u); XCTAssertStrEqual([messages lastObject][@"keymap"], @"ios"); XCTAssertStrEqual([messages lastObject][@"type"], @"keydown"); - XCTAssertEqual([[messages lastObject][@"keyCode"] intValue], keyACode); + XCTAssertEqual([[messages lastObject][@"keyCode"] intValue], UIKeyboardHIDUsageKeyboardA); XCTAssertEqual([[messages lastObject][@"modifiers"] intValue], 0x0); XCTAssertStrEqual([messages lastObject][@"characters"], @"a"); XCTAssertStrEqual([messages lastObject][@"charactersIgnoringModifiers"], @"a"); diff --git a/shell/platform/darwin/ios/framework/Source/FlutterEngineGroupTest.mm b/shell/platform/darwin/ios/framework/Source/FlutterEngineGroupTest.mm index 3bcb473d5b223..77929ea6b4c20 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterEngineGroupTest.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterEngineGroupTest.mm @@ -130,9 +130,9 @@ - (void)testReleasesProjectOnDealloc { __weak FlutterDartProject* weakProject; @autoreleasepool { FlutterDartProject* mockProject = OCMClassMock([FlutterDartProject class]); - // NOLINTNEXTLINE(clang-analyzer-deadcode.DeadStores) FlutterEngineGroup* group = [[FlutterEngineGroup alloc] initWithName:@"foo" project:mockProject]; + XCTAssertNotNil(group); weakProject = mockProject; XCTAssertNotNil(weakProject); group = nil; diff --git a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViewsTest.mm b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViewsTest.mm index c1a970eac987a..1e6dad56089aa 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterPlatformViewsTest.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterPlatformViewsTest.mm @@ -2645,8 +2645,8 @@ - (void)testThreadMergeAtEndFrame { // Unmerge threads before the end of the test // TaskRunners are required to be unmerged before destruction. - while (raster_thread_merger->DecrementLease() != fml::RasterThreadStatus::kUnmergedNow) - ; + while (raster_thread_merger->DecrementLease() != fml::RasterThreadStatus::kUnmergedNow) { + } } - (int)alphaOfPoint:(CGPoint)point onView:(UIView*)view { diff --git a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.mm b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.mm index fdf6a70ca3659..35ffaac68bfbe 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterViewControllerTest.mm @@ -1585,6 +1585,7 @@ - (void)testWillDeallocNotification { usingBlock:^(NSNotification* _Nonnull note) { [expectation fulfill]; }]; + XCTAssertNotNil(realVC); realVC = nil; } [self waitForExpectations:@[ expectation ] timeout:1.0]; diff --git a/shell/platform/darwin/ios/framework/Source/SemanticsObjectTest.mm b/shell/platform/darwin/ios/framework/Source/SemanticsObjectTest.mm index 0ae81d6048e4d..2a3f7e799e40f 100644 --- a/shell/platform/darwin/ios/framework/Source/SemanticsObjectTest.mm +++ b/shell/platform/darwin/ios/framework/Source/SemanticsObjectTest.mm @@ -12,12 +12,6 @@ const CGRect kScreenSize = CGRectMake(0, 0, 600, 800); -// copied from clang document: https://clang-analyzer.llvm.org/faq.html#unlocalized_string -__attribute__((annotate("returns_localized_nsstring"))) static inline NSString* -LocalizationNotNeeded(NSString* s) { - return s; -} - namespace flutter { namespace { @@ -666,9 +660,11 @@ - (void)testFlutterScrollableSemanticsObjectWithLabelValueHintIsNotHiddenWhenVoi [scrollable accessibilityBridgeDidFinishUpdate]; UIScrollView* scrollView = [scrollable nativeAccessibility]; XCTAssertTrue(scrollView.isAccessibilityElement); - XCTAssertTrue([scrollView.accessibilityLabel isEqualToString:LocalizationNotNeeded(@"label")]); - XCTAssertTrue([scrollView.accessibilityValue isEqualToString:LocalizationNotNeeded(@"value")]); - XCTAssertTrue([scrollView.accessibilityHint isEqualToString:LocalizationNotNeeded(@"hint")]); + XCTAssertTrue( + [scrollView.accessibilityLabel isEqualToString:NSLocalizedString(@"label", @"test")]); + XCTAssertTrue( + [scrollView.accessibilityValue isEqualToString:NSLocalizedString(@"value", @"test")]); + XCTAssertTrue([scrollView.accessibilityHint isEqualToString:NSLocalizedString(@"hint", @"test")]); } - (void)testFlutterSemanticsObjectMergeTooltipToLabel { @@ -794,7 +790,7 @@ - (void)testSemanticsObjectBuildsAttributedString { FlutterSemanticsObject* object = [[FlutterSemanticsObject alloc] initWithBridge:bridge uid:0]; [object setSemanticsNode:&node]; NSMutableAttributedString* expectedAttributedLabel = - [[NSMutableAttributedString alloc] initWithString:LocalizationNotNeeded(@"label")]; + [[NSMutableAttributedString alloc] initWithString:NSLocalizedString(@"label", @"test")]; NSDictionary* attributeDict = @{ UIAccessibilitySpeechAttributeSpellOut : @YES, }; @@ -803,7 +799,7 @@ - (void)testSemanticsObjectBuildsAttributedString { [object.accessibilityAttributedLabel isEqualToAttributedString:expectedAttributedLabel]); NSMutableAttributedString* expectedAttributedValue = - [[NSMutableAttributedString alloc] initWithString:LocalizationNotNeeded(@"value")]; + [[NSMutableAttributedString alloc] initWithString:NSLocalizedString(@"value", @"test")]; attributeDict = @{ UIAccessibilitySpeechAttributeSpellOut : @YES, }; @@ -812,7 +808,7 @@ - (void)testSemanticsObjectBuildsAttributedString { [object.accessibilityAttributedValue isEqualToAttributedString:expectedAttributedValue]); NSMutableAttributedString* expectedAttributedHint = - [[NSMutableAttributedString alloc] initWithString:LocalizationNotNeeded(@"hint")]; + [[NSMutableAttributedString alloc] initWithString:NSLocalizedString(@"hint", @"test")]; attributeDict = @{ UIAccessibilitySpeechAttributeLanguage : @"en-MX", }; From 61427e07738a4f05c7c673b3e3e5126090afec02 Mon Sep 17 00:00:00 2001 From: Chris Yang Date: Tue, 12 Sep 2023 11:41:20 -0700 Subject: [PATCH 3/3] revert presubmit flag --- .ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci.yaml b/.ci.yaml index 06512b60669b8..484dabfa97843 100644 --- a/.ci.yaml +++ b/.ci.yaml @@ -393,7 +393,7 @@ targets: - name: Mac mac_clang_tidy recipe: engine_v2/engine_v2 - presubmit: true + presubmit: false timeout: 120 properties: config_name: mac_clang_tidy