Skip to content

Commit

Permalink
[macOS] Eliminate extraneous loadView calls (#47166)
Browse files Browse the repository at this point in the history
Eliminate unnecessary calls to [NSViewController loadView]. To quote the [documentation][loadview] for this method: "Do not call this method. If you require this method to be called, access the view property."

In several of the existing tests, we do read viewController.view, and the other tests pass without this line regardless.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
  • Loading branch information
cbracken authored and harryterkelsen committed Oct 23, 2023
1 parent 8070e52 commit b54eae3
Showing 1 changed file with 1 addition and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ @implementation AccessibilityBridgeTestViewController
TEST(AccessibilityBridgeMacTest, SendsAccessibilityCreateNotificationToWindowOfFlutterView) {
FlutterViewController* viewController = CreateTestViewController();
FlutterEngine* engine = viewController.engine;
[viewController loadView];

NSWindow* expectedTarget = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 800, 600)
styleMask:NSBorderlessWindowMask
Expand Down Expand Up @@ -122,7 +121,6 @@ @implementation AccessibilityBridgeTestViewController
TEST(AccessibilityBridgeMacTest, NonZeroRootNodeId) {
FlutterViewController* viewController = CreateTestViewController();
FlutterEngine* engine = viewController.engine;
[viewController loadView];

NSWindow* expectedTarget = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 800, 600)
styleMask:NSBorderlessWindowMask
Expand Down Expand Up @@ -192,7 +190,7 @@ @implementation AccessibilityBridgeTestViewController
TEST(AccessibilityBridgeMacTest, DoesNotSendAccessibilityCreateNotificationWhenHeadless) {
FlutterViewController* viewController = CreateTestViewController();
FlutterEngine* engine = viewController.engine;
[viewController loadView];

// Setting up bridge so that the AccessibilityBridgeMacDelegateSpy
// can query semantics information from.
engine.semanticsEnabled = YES;
Expand Down Expand Up @@ -238,7 +236,6 @@ @implementation AccessibilityBridgeTestViewController
TEST(AccessibilityBridgeMacTest, DoesNotSendAccessibilityCreateNotificationWhenNoWindow) {
FlutterViewController* viewController = CreateTestViewController();
FlutterEngine* engine = viewController.engine;
[viewController loadView];

// Setting up bridge so that the AccessibilityBridgeMacDelegateSpy
// can query semantics information from.
Expand Down

0 comments on commit b54eae3

Please sign in to comment.