Skip to content

Commit 8ec493d

Browse files
[CP-beta][macOS] Fix FlutterTextInputPluginTest crash (#195340)
This pull request is created by [automatic cherry pick workflow](https://github.com/flutter/flutter/blob/main/docs/releases/Flutter-Cherrypick-Process.md#automatically-creates-a-cherry-pick-request) Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request. ### Issue Link: What is the link to the issue this cherry-pick is addressing? #194251 ### Impact Description: What is the impact (ex. visual jank on Samsung phones, app crash, cannot ship an iOS app)? Does it impact development (ex. flutter doctor crashes when Android Studio is installed), or the shipping of production apps (the app crashes on launch). This information is for domain experts and release engineers to understand the consequences of saying yes or no to the cherry pick. CI test-only change to make macOS `FlutterTextInputPluginTest` less flakey and more stable on macOS 26. ### Changelog Description: Explain this cherry pick: * In one line that is accessible to most Flutter developers. * That describes the state prior to the fix. * That includes which platforms are impacted. See [best practices](https://github.com/flutter/flutter/blob/main/docs/releases/Hotfix-Documentation-Best-Practices.md) for examples. N/A - CI test-only change ### Workaround: Is there a workaround for this issue? Rerun test ### Risk: What is the risk level of this cherry-pick? ### Test Coverage: Are you confident that your fix is well-tested by automated tests? ### Validation Steps: What are the steps to validate that this fix works? Test runs in CI or run locally with `./engine/src/out/host_release_arm64/flutter_desktop_darwin_unittests --gtest_shuffle --gtest_repeat=10`
1 parent e5792f6 commit 8ec493d

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

‎engine/src/flutter/shell/platform/darwin/macos/framework/Source/FlutterTextInputPluginTest.mm‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,17 @@ - (BOOL)isActive;
4545
@interface TextInputTestViewController : FlutterViewController
4646
@end
4747

48-
@implementation TextInputTestViewController
49-
- (nonnull FlutterView*)createFlutterViewWithMTLDevice:(id<MTLDevice>)device
50-
commandQueue:(id<MTLCommandQueue>)commandQueue {
51-
return OCMClassMock([NSView class]);
48+
@implementation TextInputTestViewController {
49+
FlutterView* _flutterViewMock;
50+
}
51+
52+
- (void)loadView {
53+
self.view = [[NSView alloc] initWithFrame:NSZeroRect];
54+
_flutterViewMock = OCMClassMock([FlutterView class]);
55+
}
56+
57+
- (FlutterView*)flutterView {
58+
return _flutterViewMock;
5259
}
5360
@end
5461

0 commit comments

Comments
 (0)