12 #import "flutter/testing/testing.h"
13 #import "third_party/googletest/googletest/include/gtest/gtest.h"
26 bool signalled =
false;
28 AddNativeCallback(
"SignalNativeTest", CREATE_NATIVE_ENTRY([&](Dart_NativeArguments args) {
34 CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.1,
false);
48 FML_LOG(ERROR) <<
"Isolate is not set.";
61 .size = {.width = 800, .height = 600},
63 .notify_listeners = [] {},
67 int64_t engineId =
reinterpret_cast<int64_t
>(engine);
75 EXPECT_NE(viewController, nil);
76 CGSize size = viewController.view.frame.size;
77 EXPECT_EQ(size.width, 800);
78 EXPECT_EQ(size.height, 600);
85 .size = {.width = 800, .height = 600},
87 .notify_listeners = [] {},
92 NSString* fixtures = @(flutter::testing::GetFixturesPath());
93 NSLog(
@"Fixtures path: %@", fixtures);
95 initWithAssetsPath:fixtures
96 ICUDataPath:[fixtures stringByAppendingString:
@"/icudtl.dat"]];
98 static std::optional<flutter::Isolate> isolate;
99 isolate = std::nullopt;
104 allowHeadlessExecution:YES];
106 [engine runWithEntrypoint:
@"testWindowControllerRetainCycle"];
108 int64_t engineId =
reinterpret_cast<int64_t
>(engine);
111 FML_DCHECK(isolate.has_value());
115 EXPECT_EQ(handle, 1);
118 [engine.windowController closeAllWindows];
119 [engine shutDownEngine];
121 EXPECT_EQ(weakEngine, nil);
127 .size = {.width = 800, .height = 600},
129 .notify_listeners = [] {},
133 int64_t engine_id =
reinterpret_cast<int64_t
>(engine);
140 viewController = [engine viewControllerForIdentifier:handle];
141 EXPECT_EQ(viewController, nil);
147 .size = {.width = 800, .height = 600},
149 .notify_listeners = [] {},
153 int64_t engine_id =
reinterpret_cast<int64_t
>(engine);
160 EXPECT_EQ(window_handle, (__bridge
void*)viewController.view.window);
166 .size = {.width = 800, .height = 600},
168 .notify_listeners = [] {},
172 int64_t engine_id =
reinterpret_cast<int64_t
>(engine);
178 NSWindow* window = viewController.view.window;
179 void* windowHandle = (__bridge
void*)window;
181 EXPECT_EQ(window.zoomed, NO);
182 EXPECT_EQ(window.miniaturized, NO);
183 EXPECT_EQ(window.styleMask & NSWindowStyleMaskFullScreen, 0u);
186 CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.5,
false);
187 EXPECT_EQ(window.zoomed, YES);
190 CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.5,
false);
191 EXPECT_EQ(window.zoomed, NO);
196 CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.5,
false);
197 EXPECT_EQ(window.miniaturized, YES);
FLUTTER_DARWIN_EXPORT int64_t InternalFlutter_WindowController_CreateRegularWindow(int64_t engine_id, const FlutterWindowCreationRequest *request)
FLUTTER_DARWIN_EXPORT void InternalFlutter_Window_SetMaximized(void *window, bool maximized)
FLUTTER_DARWIN_EXPORT void InternalFlutter_Window_Destroy(int64_t engine_id, void *window)
FLUTTER_DARWIN_EXPORT void * InternalFlutter_Window_GetHandle(int64_t engine_id, FlutterViewIdentifier view_id)
FLUTTER_DARWIN_EXPORT void InternalFlutter_Window_Minimize(void *window)
void AddNativeCallback(const char *name, Dart_NativeFunction function)
FlutterEngine * GetFlutterEngine()
std::optional< flutter::Isolate > isolate_
FlutterWindowControllerTest()=default
flutter::Isolate & isolate()
TEST_F(AccessibilityBridgeMacWindowTest, SendsAccessibilityCreateNotificationFlutterViewWindow)