This repository was archived by the owner on Feb 25, 2025. It is now read-only.
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 {
396
396
}
397
397
398
398
- (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
+ }
400
404
if (_mouseTrackingMode != FlutterMouseTrackingModeNone && self.flutterView ) {
401
405
NSTrackingAreaOptions options = NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved |
402
406
NSTrackingInVisibleRect | NSTrackingEnabledDuringMouseDrag;
Original file line number Diff line number Diff line change @@ -140,6 +140,16 @@ + (void)respondFalseForSendEvent:(const FlutterKeyEvent&)event
140
140
EXPECT_EQ ([window firstResponder ], viewController.flutterView );
141
141
}
142
142
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
+
143
153
TEST (FlutterViewControllerTest, TestKeyEventsAreSentToFramework) {
144
154
ASSERT_TRUE ([[FlutterViewControllerTestObjC alloc ] testKeyEventsAreSentToFramework ]);
145
155
}
You can’t perform that action at this time.
0 commit comments