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},
62 .on_should_close = [] {},
63 .on_will_close = [] {},
64 .notify_listeners = [] {},
68 int64_t engineId =
reinterpret_cast<int64_t
>(engine);
76 EXPECT_NE(viewController, nil);
77 CGSize size = viewController.view.frame.size;
78 EXPECT_EQ(size.width, 800);
79 EXPECT_EQ(size.height, 600);
86 .size = {.width = 800, .height = 600},
87 .on_should_close = [] {},
88 .on_will_close = [] {},
89 .notify_listeners = [] {},
94 NSString* fixtures = @(flutter::testing::GetFixturesPath());
95 NSLog(
@"Fixtures path: %@", fixtures);
97 initWithAssetsPath:fixtures
98 ICUDataPath:[fixtures stringByAppendingString:
@"/icudtl.dat"]];
100 static std::optional<flutter::Isolate> isolate;
101 isolate = std::nullopt;
106 allowHeadlessExecution:YES];
108 [engine runWithEntrypoint:
@"testWindowControllerRetainCycle"];
110 int64_t engineId =
reinterpret_cast<int64_t
>(engine);
113 FML_DCHECK(isolate.has_value());
117 EXPECT_EQ(handle, 1);
120 [engine.windowController closeAllWindows];
121 [engine shutDownEngine];
123 EXPECT_EQ(weakEngine, nil);
129 .size = {.width = 800, .height = 600},
130 .on_should_close = [] {},
131 .on_will_close = [] {},
132 .notify_listeners = [] {},
136 int64_t engine_id =
reinterpret_cast<int64_t
>(engine);
143 viewController = [engine viewControllerForIdentifier:handle];
144 EXPECT_EQ(viewController, nil);
150 .size = {.width = 800, .height = 600},
151 .on_should_close = [] {},
152 .on_will_close = [] {},
153 .notify_listeners = [] {},
157 int64_t engine_id =
reinterpret_cast<int64_t
>(engine);
164 EXPECT_EQ(window_handle, (__bridge
void*)viewController.view.window);
170 .size = {.width = 800, .height = 600},
171 .on_should_close = [] {},
172 .on_will_close = [] {},
173 .notify_listeners = [] {},
177 int64_t engine_id =
reinterpret_cast<int64_t
>(engine);
183 NSWindow* window = viewController.view.window;
184 void* windowHandle = (__bridge
void*)window;
186 EXPECT_EQ(window.zoomed, NO);
187 EXPECT_EQ(window.miniaturized, NO);
188 EXPECT_EQ(window.styleMask & NSWindowStyleMaskFullScreen, 0u);
191 CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.5,
false);
192 EXPECT_EQ(window.zoomed, YES);
195 CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.5,
false);
196 EXPECT_EQ(window.zoomed, NO);
201 CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.5,
false);
202 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)