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
26382638ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterViewEngineProvider.mm + ../../../flutter/LICENSE
26392639ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterViewEngineProviderTest.mm + ../../../flutter/LICENSE
26402640ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterViewProvider.h + ../../../flutter/LICENSE
2641+ ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterViewTest.mm + ../../../flutter/LICENSE
26412642ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/KeyCodeMap.g.mm + ../../../flutter/LICENSE
26422643ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/KeyCodeMap_Internal.h + ../../../flutter/LICENSE
26432644ORIGIN: ../../../flutter/shell/platform/darwin/macos/framework/Source/TestFlutterPlatformView.h + ../../../flutter/LICENSE
@@ -5100,6 +5101,7 @@ FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterViewE
51005101FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterViewEngineProvider.mm
51015102FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterViewEngineProviderTest.mm
51025103FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterViewProvider.h
5104+ FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/FlutterViewTest.mm
51035105FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/KeyCodeMap.g.mm
51045106FILE: ../../../flutter/shell/platform/darwin/macos/framework/Source/KeyCodeMap_Internal.h
51055107FILE: ../../../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") {
182182 " framework/Source/FlutterViewControllerTestUtils.h" ,
183183 " framework/Source/FlutterViewControllerTestUtils.mm" ,
184184 " framework/Source/FlutterViewEngineProviderTest.mm" ,
185+ " framework/Source/FlutterViewTest.mm" ,
185186 " framework/Source/TestFlutterPlatformView.h" ,
186187 " framework/Source/TestFlutterPlatformView.mm" ,
187188 ]
Original file line number Diff line number Diff line change 8888
8989 FML_DCHECK (platform_view) << " Platform view not found for id: " << platform_view_id;
9090
91- CGFloat scale = platform_view .layer .contentsScale ;
91+ CGFloat scale = default_base_view .layer .contentsScale ;
9292 platform_view.frame = CGRectMake (layer->offset .x / scale, layer->offset .y / scale,
9393 layer->size .width / scale, layer->size .height / scale);
9494 if (platform_view.superview == nil ) {
Original file line number Diff line number Diff line change @@ -106,6 +106,12 @@ - (void)viewDidChangeBackingProperties {
106106 [_reshapeListener viewDidReshape: self ];
107107}
108108
109+ - (BOOL )layer : (CALayer *)layer
110+ shouldInheritContentsScale : (CGFloat)newScale
111+ fromWindow : (NSWindow *)window {
112+ return YES ;
113+ }
114+
109115- (void )shutdown {
110116 [_threadSynchronizer shutdown ];
111117}
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