Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 92872c4

Browse files
committed
Add FlutterMutatorViewTest
1 parent 4d7c1ca commit 92872c4

File tree

5 files changed

+449
-1
lines changed

5 files changed

+449
-1
lines changed

ci/licenses_golden/licenses_flutter

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2672,6 +2672,7 @@ ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterMou
26722672
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterMouseCursorPlugin.mm + ../../../flutter/LICENSE
26732673
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterMutatorView.h + ../../../flutter/LICENSE
26742674
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterMutatorView.mm + ../../../flutter/LICENSE
2675+
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterMutatorViewTest.mm + ../../../flutter/LICENSE
26752676
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterPlatformNodeDelegateMac.h + ../../../flutter/LICENSE
26762677
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterPlatformNodeDelegateMac.mm + ../../../flutter/LICENSE
26772678
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterPlatformNodeDelegateMacTest.mm + ../../../flutter/LICENSE
@@ -5168,6 +5169,7 @@ FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterMouse
51685169
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterMouseCursorPlugin.mm
51695170
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterMutatorView.h
51705171
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterMutatorView.mm
5172+
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterMutatorViewTest.mm
51715173
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterPlatformNodeDelegateMac.h
51725174
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterPlatformNodeDelegateMac.mm
51735175
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterPlatformNodeDelegateMacTest.mm

shell/platform/darwin/macos/BUILD.gn

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ executable("flutter_desktop_darwin_unittests") {
174174
"framework/Source/FlutterEngineTestUtils.mm",
175175
"framework/Source/FlutterKeyboardManagerTest.mm",
176176
"framework/Source/FlutterMenuPluginTest.mm",
177+
"framework/Source/FlutterMutatorViewTest.mm",
177178
"framework/Source/FlutterPlatformNodeDelegateMacTest.mm",
178179
"framework/Source/FlutterPlatformViewControllerTest.mm",
179180
"framework/Source/FlutterRendererTest.mm",

shell/platform/darwin/macos/framework/Source/FlutterMutatorView.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,10 @@
2222
- (void)applyFlutterLayer:(nonnull const FlutterLayer*)layer;
2323

2424
@end
25+
26+
@interface FlutterMutatorView (Private)
27+
28+
@property(readonly, nonatomic, nonnull) NSMutableArray<NSView*>* pathClipViews;
29+
@property(readonly, nonatomic, nullable) NSView* platformViewContainer;
30+
31+
@end

shell/platform/darwin/macos/framework/Source/FlutterMutatorView.mm

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,14 @@ - (NSView*)platformView {
194194
return _platformView;
195195
}
196196

197+
- (NSMutableArray*)pathClipViews {
198+
return _pathClipViews;
199+
}
200+
201+
- (NSView*)platformViewContainer {
202+
return _platformViewContainer;
203+
}
204+
197205
- (instancetype)initWithPlatformView:(NSView*)platformView {
198206
if (self = [super initWithFrame:NSZeroRect]) {
199207
_platformView = platformView;
@@ -215,7 +223,7 @@ - (BOOL)isFlipped {
215223
/// If clipping to path is needed, CAShapeLayer(s) will be used as mask.
216224
/// Clipping to round rect only clips to path if round corners are intersected.
217225
- (void)applyFlutterLayer:(const FlutterLayer*)layer {
218-
CGFloat scale = self.superview.layer.contentsScale;
226+
CGFloat scale = self.superview != nil ? self.superview.layer.contentsScale : 1.0;
219227

220228
// Initial transform to compensate for scale factor. This is needed because all
221229
// cocoa coordinates are logical but Flutter will send the physical to logical

0 commit comments

Comments
 (0)