| Flutter macOS Embedder |

FlutterViewTest.mm
Go to the documentation of this file.
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 constexpr int64_t kImplicitViewId = 0ll;
12
13 @interface TestReshapeListener : NSObject <FlutterViewReshapeListener>
14
15 @end
16
17 @implementation TestReshapeListener
18
19 - (void)viewDidReshape:(nonnull NSView*)view {
20 }
21
22 @end
23
24 TEST(FlutterView, ShouldInheritContentsScaleReturnsYes) {
25 id<MTLDevice> device = MTLCreateSystemDefaultDevice();
26 id<MTLCommandQueue> queue = [device newCommandQueue];
27 TestReshapeListener* listener = [[TestReshapeListener alloc] init];
28 FlutterThreadSynchronizer* threadSynchronizer = [[FlutterThreadSynchronizer alloc] init];
29 FlutterView* view = [[FlutterView alloc] initWithMTLDevice:device
30 commandQueue:queue
31 reshapeListener:listener
32 threadSynchronizer:threadSynchronizer
33 viewId:kImplicitViewId];
34 EXPECT_EQ([view layer:view.layer shouldInheritContentsScale:3.0 fromWindow:view.window], YES);
35 }
FlutterViewReshapeListener-p
Definition: FlutterView.h:28
TEST
TEST(FlutterView, ShouldInheritContentsScaleReturnsYes)
Definition: FlutterViewTest.mm:24
FlutterThreadSynchronizer
Definition: FlutterThreadSynchronizer.h:13
TestReshapeListener
Definition: FlutterViewTest.mm:13
FlutterView
Definition: FlutterView.h:39
kImplicitViewId
constexpr int64_t kImplicitViewId
Definition: FlutterViewTest.mm:11
FlutterView.h