File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
shell/platform/darwin/macos/framework/Source Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -396,7 +396,11 @@ - (void)listenForMetaModifiedKeyUpEvents {
396396}
397397
398398- (void )configureTrackingArea {
399- NSAssert (self.viewLoaded, @" View must be loaded before setting tracking area" );
399+ if (!self.viewLoaded ) {
400+ // The viewDidLoad will call configureTrackingArea again when
401+ // the view is actually loaded.
402+ return ;
403+ }
400404 if (_mouseTrackingMode != FlutterMouseTrackingModeNone && self.flutterView ) {
401405 NSTrackingAreaOptions options = NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved |
402406 NSTrackingInVisibleRect | NSTrackingEnabledDuringMouseDrag;
Original file line number Diff line number Diff line change @@ -140,6 +140,16 @@ + (void)respondFalseForSendEvent:(const FlutterKeyEvent&)event
140140 EXPECT_EQ ([window firstResponder ], viewController.flutterView );
141141}
142142
143+ TEST (FlutterViewController, CanSetMouseTrackingModeBeforeViewLoaded) {
144+ NSString * fixtures = @(testing::GetFixturesPath ());
145+ FlutterDartProject* project = [[FlutterDartProject alloc ]
146+ initWithAssetsPath: fixtures
147+ ICUDataPath: [fixtures stringByAppendingString: @" /icudtl.dat" ]];
148+ FlutterViewController* viewController = [[FlutterViewController alloc ] initWithProject: project];
149+ viewController.mouseTrackingMode = FlutterMouseTrackingModeInActiveApp;
150+ ASSERT_EQ (viewController.mouseTrackingMode , FlutterMouseTrackingModeInActiveApp);
151+ }
152+
143153TEST (FlutterViewControllerTest, TestKeyEventsAreSentToFramework) {
144154 ASSERT_TRUE ([[FlutterViewControllerTestObjC alloc ] testKeyEventsAreSentToFramework ]);
145155}
You can’t perform that action at this time.
0 commit comments