| 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 TestFlutterViewDelegate : NSObject <FlutterViewDelegate>
14
15 @end
16
17 @implementation TestFlutterViewDelegate
18
19 - (void)viewDidReshape:(nonnull NSView*)view {
20 }
21
22 - (BOOL)viewShouldAcceptFirstResponder:(NSView*)view {
23 return YES;
24 }
25
26 @end
27
28 TEST(FlutterView, ShouldInheritContentsScaleReturnsYes) {
29 id<MTLDevice> device = MTLCreateSystemDefaultDevice();
30 id<MTLCommandQueue> queue = [device newCommandQueue];
31 TestFlutterViewDelegate* delegate = [[TestFlutterViewDelegate alloc] init];
32 FlutterThreadSynchronizer* threadSynchronizer = [[FlutterThreadSynchronizer alloc] init];
33 FlutterView* view = [[FlutterView alloc] initWithMTLDevice:device
34 commandQueue:queue
35 delegate:delegate
36 threadSynchronizer:threadSynchronizer
37 viewId:kImplicitViewId];
38 EXPECT_EQ([view layer:view.layer shouldInheritContentsScale:3.0 fromWindow:view.window], YES);
39 }
TEST
TEST(FlutterView, ShouldInheritContentsScaleReturnsYes)
Definition: FlutterViewTest.mm:28
FlutterThreadSynchronizer
Definition: FlutterThreadSynchronizer.h:13
TestFlutterViewDelegate
Definition: FlutterViewTest.mm:13
FlutterView
Definition: FlutterView.h:45
kImplicitViewId
constexpr int64_t kImplicitViewId
Definition: FlutterViewTest.mm:11
FlutterView.h
FlutterViewDelegate-p
Definition: FlutterView.h:28