7 #import <Metal/Metal.h>
9 #import "flutter/testing/testing.h"
19 - (void)viewDidReshape:(nonnull NSView*)view {
22 - (BOOL)viewShouldAcceptFirstResponder:(NSView*)view {
29 id<MTLDevice> device = MTLCreateSystemDefaultDevice();
30 id<MTLCommandQueue> queue = [device newCommandQueue];
36 threadSynchronizer:threadSynchronizer
37 viewIdentifier:kImplicitViewId];
38 EXPECT_EQ([view layer:view.layer shouldInheritContentsScale:3.0 fromWindow:view.window], YES);
43 @property(readwrite, nonatomic) NSView* (^onHitTest)(NSPoint point);
51 - (NSView*)hitTest:(NSPoint)point {
52 return self.onHitTest(point);
62 @property(readwrite, nonatomic) BOOL setCalled;
74 id<MTLDevice> device = MTLCreateSystemDefaultDevice();
75 id<MTLCommandQueue> queue = [device newCommandQueue];
81 threadSynchronizer:threadSynchronizer
82 viewIdentifier:kImplicitViewId];
83 NSWindow* window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 800, 600)
84 styleMask:NSBorderlessWindowMask
85 backing:NSBackingStoreBuffered
90 window.contentView = view;
91 __weak NSView* weakView = view;
92 __block BOOL hitTestCalled = NO;
93 __block NSPoint hitTestCoordinate = NSZeroPoint;
94 view.
onHitTest = ^NSView*(NSPoint point) {
96 hitTestCoordinate = point;
99 NSEvent* mouseEvent = [NSEvent mouseEventWithType:NSEventTypeMouseMoved
100 location:NSMakePoint(100, 100)
109 [view cursorUpdate:mouseEvent];
111 EXPECT_TRUE(hitTestCalled);
113 EXPECT_TRUE(CGPointEqualToPoint(hitTestCoordinate, CGPointMake(100, 100)));
118 id<MTLDevice> device = MTLCreateSystemDefaultDevice();
119 id<MTLCommandQueue> queue = [device newCommandQueue];
125 threadSynchronizer:threadSynchronizer
126 viewIdentifier:kImplicitViewId];
127 NSWindow* window = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 800, 600)
128 styleMask:NSBorderlessWindowMask
129 backing:NSBackingStoreBuffered
134 NSView* platformView = [[NSView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)];
136 window.contentView = view;
137 __block BOOL hitTestCalled = NO;
138 __block NSPoint hitTestCoordinate = NSZeroPoint;
139 view.
onHitTest = ^NSView*(NSPoint point) {
141 hitTestCoordinate = point;
144 NSEvent* mouseEvent = [NSEvent mouseEventWithType:NSEventTypeMouseMoved
145 location:NSMakePoint(100, 100)
154 [view cursorUpdate:mouseEvent];
156 EXPECT_TRUE(hitTestCalled);
158 EXPECT_TRUE(CGPointEqualToPoint(hitTestCoordinate, CGPointMake(100, 100)));