This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +40
-1
lines changed
shell/platform/darwin/macos Expand file tree Collapse file tree 5 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -2638,6 +2638,7 @@ ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterVie
2638
2638
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterViewEngineProvider.mm + ../../../flutter/LICENSE
2639
2639
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterViewEngineProviderTest.mm + ../../../flutter/LICENSE
2640
2640
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterViewProvider.h + ../../../flutter/LICENSE
2641
+ ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterViewTest.mm + ../../../flutter/LICENSE
2641
2642
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/KeyCodeMap.g.mm + ../../../flutter/LICENSE
2642
2643
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/KeyCodeMap_Internal.h + ../../../flutter/LICENSE
2643
2644
ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/TestFlutterPlatformView.h + ../../../flutter/LICENSE
@@ -5100,6 +5101,7 @@ FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterViewE
5100
5101
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterViewEngineProvider.mm
5101
5102
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterViewEngineProviderTest.mm
5102
5103
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterViewProvider.h
5104
+ FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterViewTest.mm
5103
5105
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/KeyCodeMap.g.mm
5104
5106
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/KeyCodeMap_Internal.h
5105
5107
FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/TestFlutterPlatformView.h
Original file line number Diff line number Diff line change @@ -182,6 +182,7 @@ executable("flutter_desktop_darwin_unittests") {
182
182
" framework/Source/FlutterViewControllerTestUtils.h" ,
183
183
" framework/Source/FlutterViewControllerTestUtils.mm" ,
184
184
" framework/Source/FlutterViewEngineProviderTest.mm" ,
185
+ " framework/Source/FlutterViewTest.mm" ,
185
186
" framework/Source/TestFlutterPlatformView.h" ,
186
187
" framework/Source/TestFlutterPlatformView.mm" ,
187
188
]
Original file line number Diff line number Diff line change 88
88
89
89
FML_DCHECK (platform_view) << " Platform view not found for id: " << platform_view_id;
90
90
91
- CGFloat scale = platform_view .layer .contentsScale ;
91
+ CGFloat scale = default_base_view .layer .contentsScale ;
92
92
platform_view.frame = CGRectMake (layer->offset .x / scale, layer->offset .y / scale,
93
93
layer->size .width / scale, layer->size .height / scale);
94
94
if (platform_view.superview == nil ) {
Original file line number Diff line number Diff line change @@ -106,6 +106,12 @@ - (void)viewDidChangeBackingProperties {
106
106
[_reshapeListener viewDidReshape: self ];
107
107
}
108
108
109
+ - (BOOL )layer : (CALayer *)layer
110
+ shouldInheritContentsScale : (CGFloat)newScale
111
+ fromWindow : (NSWindow *)window {
112
+ return YES ;
113
+ }
114
+
109
115
- (void )shutdown {
110
116
[_threadSynchronizer shutdown ];
111
117
}
Original file line number Diff line number Diff line change
1
+ // Copyright 2013 The Flutter Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ #import " flutter/shell/platform/darwin/macos/framework/Source/FlutterView.h"
6
+
7
+ #import < Metal/Metal.h>
8
+
9
+ #import " flutter/testing/testing.h"
10
+
11
+ @interface TestReshapeListener : NSObject <FlutterViewReshapeListener>
12
+
13
+ @end
14
+
15
+ @implementation TestReshapeListener
16
+
17
+ - (void )viewDidReshape : (nonnull NSView *)view {
18
+ }
19
+
20
+ @end
21
+
22
+ TEST (FlutterView, ShouldInheritContentsScaleReturnsYes) {
23
+ id <MTLDevice > device = MTLCreateSystemDefaultDevice ();
24
+ id <MTLCommandQueue > queue = [device newCommandQueue ];
25
+ TestReshapeListener* listener = [[TestReshapeListener alloc ] init ];
26
+ FlutterView* view = [[FlutterView alloc ] initWithMTLDevice: device
27
+ commandQueue: queue
28
+ reshapeListener: listener];
29
+ EXPECT_EQ ([view layer: view.layer shouldInheritContentsScale: 3.0 fromWindow: view.window], YES );
30
+ }
You can’t perform that action at this time.
0 commit comments