From 4faea5af7db54d87a01b6a1a5d304193aebef89a Mon Sep 17 00:00:00 2001 From: Chun-Heng Tai Date: Mon, 18 Nov 2024 11:02:00 -0800 Subject: [PATCH] update --- runtime/runtime_controller_unittests.cc | 54 +++++++++---------- .../framework/Source/accessibility_bridge.mm | 3 +- shell/platform/darwin/ios/platform_view_ios.h | 6 +-- .../platform/darwin/ios/platform_view_ios.mm | 12 ++--- .../darwin/ios/platform_view_ios_test.mm | 12 ++--- 5 files changed, 38 insertions(+), 49 deletions(-) diff --git a/runtime/runtime_controller_unittests.cc b/runtime/runtime_controller_unittests.cc index 6534d60434ac6..414bf3d9127a9 100644 --- a/runtime/runtime_controller_unittests.cc +++ b/runtime/runtime_controller_unittests.cc @@ -6,8 +6,8 @@ #include "flutter/runtime/runtime_delegate.h" #include "flutter/lib/ui/semantics/semantics_update.h" -#include "flutter/testing/testing.h" #include "flutter/shell/common/shell_test.h" +#include "flutter/testing/testing.h" namespace flutter { @@ -20,20 +20,18 @@ class MockRuntimeDelegate : public RuntimeDelegate { FontCollection font; std::vector updates; std::vector actions; - std::string DefaultRouteName() override { - return ""; - } + std::string DefaultRouteName() override { return ""; } void ScheduleFrame(bool regenerate_layer_trees = true) override {} void OnAllViewsRendered() override {} void Render(int64_t view_id, - std::unique_ptr layer_tree, - float device_pixel_ratio) override {} + std::unique_ptr layer_tree, + float device_pixel_ratio) override {} void UpdateSemantics(SemanticsNodeUpdates update, - CustomAccessibilityActionUpdates actions) override { + CustomAccessibilityActionUpdates actions) override { this->updates.push_back(update); this->actions.push_back(actions); } @@ -41,54 +39,50 @@ class MockRuntimeDelegate : public RuntimeDelegate { void HandlePlatformMessage( std::unique_ptr message) override {} - FontCollection& GetFontCollection() override { - return font; - } + FontCollection& GetFontCollection() override { return font; } - std::shared_ptr GetAssetManager() override { - return nullptr; - } + std::shared_ptr GetAssetManager() override { return nullptr; } void OnRootIsolateCreated() override {}; void UpdateIsolateDescription(const std::string isolate_name, - int64_t isolate_port) override {}; + int64_t isolate_port) override {}; void SetNeedsReportTimings(bool value) override {}; - std::unique_ptr> - ComputePlatformResolvedLocale( + std::unique_ptr> ComputePlatformResolvedLocale( const std::vector& supported_locale_data) override { return nullptr; } void RequestDartDeferredLibrary(intptr_t loading_unit_id) override {} - std::weak_ptr GetPlatformMessageHandler() const override { + std::weak_ptr GetPlatformMessageHandler() + const override { return {}; } void SendChannelUpdate(std::string name, bool listening) override {} double GetScaledFontSize(double unscaled_font_size, - int configuration_id) const override { + int configuration_id) const override { return 0.0; } }; class RuntimeControllerTester { public: - RuntimeControllerTester(UIDartState::Context& context) : context_(context), - runtime_controller_(delegate_, - nullptr, - {}, - {}, - {}, - {}, - {}, - nullptr, - context_) { - } + RuntimeControllerTester(UIDartState::Context& context) + : context_(context), + runtime_controller_(delegate_, + nullptr, + {}, + {}, + {}, + {}, + {}, + nullptr, + context_) {} MockRuntimeDelegate delegate_; UIDartState::Context& context_; @@ -144,5 +138,5 @@ TEST_F(RuntimeControllerTest, CanHandleAttributedStrings) { DestroyShell(std::move(shell), task_runners); } -} +} // namespace testing } // namespace flutter diff --git a/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm b/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm index 1483955d1b7e4..e93a642dfca53 100644 --- a/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm +++ b/shell/platform/darwin/ios/framework/Source/accessibility_bridge.mm @@ -348,7 +348,8 @@ static bool DidFlagChange(const flutter::SemanticsNode& oldNode, NSString* type = message[@"type"]; if ([type isEqualToString:@"announce"]) { NSString* messageToAnnounce = message[@"data"][@"message"]; - ios_delegate_->PostAccessibilityNotification(UIAccessibilityAnnouncementNotification, messageToAnnounce); + ios_delegate_->PostAccessibilityNotification(UIAccessibilityAnnouncementNotification, + messageToAnnounce); } if ([type isEqualToString:@"focus"]) { SemanticsObject* node = objects_[message[@"nodeId"]]; diff --git a/shell/platform/darwin/ios/platform_view_ios.h b/shell/platform/darwin/ios/platform_view_ios.h index e0cd97ff448dd..5c173e5f5ab6a 100644 --- a/shell/platform/darwin/ios/platform_view_ios.h +++ b/shell/platform/darwin/ios/platform_view_ios.h @@ -25,7 +25,7 @@ namespace flutter { namespace testing { - class TestPlatformViewIOS; +class TestPlatformViewIOS; } /** @@ -107,9 +107,7 @@ class PlatformViewIOS : public PlatformView { return platform_message_handler_; } - AccessibilityBridge* GetAccessibilityBridge() { - return accessibility_bridge_.get(); - } + AccessibilityBridge* GetAccessibilityBridge() { return accessibility_bridge_.get(); } /** * Handles accessibility message from accessibility channel. diff --git a/shell/platform/darwin/ios/platform_view_ios.mm b/shell/platform/darwin/ios/platform_view_ios.mm index 4affb7e04cf3a..648bd482cbd91 100644 --- a/shell/platform/darwin/ios/platform_view_ios.mm +++ b/shell/platform/darwin/ios/platform_view_ios.mm @@ -65,10 +65,10 @@ new PlatformMessageHandlerIos(task_runners.GetPlatformTaskRunner())) {} accessibility_bridge_.reset(); } if (owner_controller) { - accessibility_channel_ = - [[FlutterBasicMessageChannel alloc] initWithName:@"flutter/accessibility" - binaryMessenger:owner_controller.engine.binaryMessenger - codec:[FlutterStandardMessageCodec sharedInstance]]; + accessibility_channel_ = [[FlutterBasicMessageChannel alloc] + initWithName:@"flutter/accessibility" + binaryMessenger:owner_controller.engine.binaryMessenger + codec:[FlutterStandardMessageCodec sharedInstance]]; [accessibility_channel_ setMessageHandler:^(id message, FlutterReply reply) { handleAccessibilityMessage(message, reply); }]; @@ -130,8 +130,8 @@ new PlatformMessageHandlerIos(task_runners.GetPlatformTaskRunner())) {} BOOL generating = [message[@"data"][@"generating"] boolValue]; if (generating) { if (!accessibility_bridge_) { - accessibility_bridge_ = std::make_unique( - owner_controller_, this, platform_views_controller_); + accessibility_bridge_ = std::make_unique(owner_controller_, this, + platform_views_controller_); } } else { accessibility_bridge_.reset(); diff --git a/shell/platform/darwin/ios/platform_view_ios_test.mm b/shell/platform/darwin/ios/platform_view_ios_test.mm index 77ecae851de25..f6dec584342e1 100644 --- a/shell/platform/darwin/ios/platform_view_ios_test.mm +++ b/shell/platform/darwin/ios/platform_view_ios_test.mm @@ -103,15 +103,11 @@ - (void)testCreate { thread_task_runner->PostTask([&] { platform_view->SetOwnerViewController(flutterViewController); XCTAssertFalse(platform_view->GetAccessibilityBridge()); - platform_view->handleAccessibilityMessage(@{ - @"type": @"generatingSemanticsTree", - @"data": @{@"generating": @(YES)} - }, nil); + platform_view->handleAccessibilityMessage( + @{@"type" : @"generatingSemanticsTree", @"data" : @{@"generating" : @(YES)}}, nil); XCTAssertTrue(platform_view->GetAccessibilityBridge()); - platform_view->handleAccessibilityMessage(@{ - @"type": @"generatingSemanticsTree", - @"data": @{@"generating": @(NO)} - }, nil); + platform_view->handleAccessibilityMessage( + @{@"type" : @"generatingSemanticsTree", @"data" : @{@"generating" : @(NO)}}, nil); XCTAssertFalse(platform_view->GetAccessibilityBridge()); latch.Signal(); });