102 int64_t engineId =
reinterpret_cast<int64_t
>(
engine);
106 .size = {.width = 800, .height = 600},
107 .on_should_close = [] {},
108 .on_will_close = [] {},
109 .notify_listeners = [] {},
112 EXPECT_EQ(parentViewId, 1);
118 rect->
left = parent_rect.left + 10;
119 rect->
top = parent_rect.top + 10;
131 .parent_view_id = parentViewId,
132 .on_should_close = [] {},
133 .on_will_close = [] {},
134 .notify_listeners = [] {},
135 .on_get_window_position = position_callback,
138 const int64_t tooltipViewId =
140 EXPECT_NE(tooltipViewId, 0);
146 int64_t engineId =
reinterpret_cast<int64_t
>(
engine);
150 .size = {.width = 800, .height = 600},
151 .on_should_close = [] {},
152 .on_will_close = [] {},
153 .notify_listeners = [] {},
156 EXPECT_EQ(parentViewId, 1);
162 rect->
left = parent_rect.left + 10;
163 rect->
top = parent_rect.top + 10;
175 .parent_view_id = parentViewId,
176 .on_should_close = [] {},
177 .on_will_close = [] {},
178 .notify_listeners = [] {},
179 .on_get_window_position = position_callback,
182 const int64_t tooltipViewId =
184 EXPECT_NE(tooltipViewId, 0);
190 .size = {.width = 800, .height = 600},
191 .on_should_close = [] {},
192 .on_will_close = [] {},
193 .notify_listeners = [] {},
199 NSLog(
@"Fixtures path: %@", fixtures);
201 initWithAssetsPath:fixtures
202 ICUDataPath:[fixtures stringByAppendingString:
@"/icudtl.dat"]];
204 static std::optional<flutter::Isolate> isolate;
205 isolate = std::nullopt;
210 allowHeadlessExecution:YES];
212 [
engine runWithEntrypoint:
@"testWindowControllerRetainCycle"];
214 int64_t engineId =
reinterpret_cast<int64_t
>(
engine);
221 EXPECT_EQ(handle, 1);
224 [
engine.windowController closeAllWindows];
227 EXPECT_EQ(weakEngine, nil);
233 .size = {.width = 800, .height = 600},
234 .on_should_close = [] {},
235 .on_will_close = [] {},
236 .notify_listeners = [] {},
240 int64_t engine_id =
reinterpret_cast<int64_t
>(
engine);
254 .size = {.width = 800, .height = 600},
255 .on_should_close = [] {},
256 .on_will_close = [] {},
257 .notify_listeners = [] {},
261 int64_t engine_id =
reinterpret_cast<int64_t
>(
engine);
268 EXPECT_EQ(window_handle, (__bridge
void*)
viewController.view.window);
274 .size = {.width = 800, .height = 600},
275 .on_should_close = [] {},
276 .on_will_close = [] {},
277 .notify_listeners = [] {},
281 int64_t engine_id =
reinterpret_cast<int64_t
>(
engine);
288 void* windowHandle = (__bridge
void*)
window;
290 EXPECT_EQ(
window.zoomed, NO);
291 EXPECT_EQ(
window.miniaturized, NO);
292 EXPECT_EQ(
window.styleMask & NSWindowStyleMaskFullScreen, 0u);
295 CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.5,
false);
296 EXPECT_EQ(
window.zoomed, YES);
299 CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.5,
false);
300 EXPECT_EQ(
window.zoomed, NO);
305 CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.5,
false);
306 EXPECT_EQ(
window.miniaturized, YES);
312 .size = {.width = 800, .height = 600},
313 .on_should_close = [] {},
314 .on_will_close = [] {},
315 .notify_listeners = [] {},
318 int64_t engine_id =
reinterpret_cast<int64_t
>(
engine);
331 EXPECT_NE(viewController1, nil);
332 EXPECT_NE(viewController2, nil);
333 EXPECT_NE(viewController3, nil);
336 [
engine engineCallbackOnPreEngineRestart];
339 viewController1 = [
engine viewControllerForIdentifier:handle1];
340 viewController2 = [
engine viewControllerForIdentifier:handle2];
341 viewController3 = [
engine viewControllerForIdentifier:handle3];
342 EXPECT_EQ(viewController1, nil);
343 EXPECT_EQ(viewController2, nil);
344 EXPECT_EQ(viewController3, nil);
350 int64_t engineId =
reinterpret_cast<int64_t
>(
engine);
355 .size = {.width = 800, .height = 600},
356 .on_should_close = [] {},
357 .on_will_close = [] {},
358 .notify_listeners = [] {},
360 int64_t parentViewId =
362 EXPECT_EQ(parentViewId, 1);
368 rect->
left = parent_rect.left;
369 rect->
top = parent_rect.top;
383 .parent_view_id = parentViewId,
384 .on_should_close = [] {},
385 .on_will_close = [] {},
386 .notify_listeners = [] {},
387 .on_get_window_position = position_callback,
390 const int64_t tooltipViewId =
392 EXPECT_NE(tooltipViewId, 0);
397 EXPECT_EQ(flutterView.sizedToContents, YES);
399 CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.1,
false);
401 [flutterView.sizingDelegate viewDidUpdateContents:flutterView withSize:NSMakeSize(1000, 1000)];
405 CGSize maxSize = flutterView.maximumContentSize;
406 EXPECT_LE(maxSize.width, 500);
407 EXPECT_LE(maxSize.height, 400);
411 NSWindow* parentWindow = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 800, 600)
412 styleMask:NSWindowStyleMaskTitled
413 backing:NSBackingStoreBuffered
415 [parentWindow setReleasedWhenClosed:NO];
416 NSWindow* childWindow = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 100, 100)
417 styleMask:NSWindowStyleMaskBorderless
418 backing:NSBackingStoreBuffered
420 [childWindow setReleasedWhenClosed:NO];
423 [parentWindow setFrame:NSMakeRect(100, 100, 800, 600) display:NO];
424 [childWindow setFrame:NSMakeRect(150, 150, 100, 100) display:NO];
427 [parentWindow addChildWindow:childWindow ordered:NSWindowAbove];
433 NSRect parentContentRect = [parentWindow contentRectForFrameRect:parentWindow.frame];
435 double expectedX = 150 - parentContentRect.origin.x;
436 double expectedY = (parentContentRect.origin.y + parentContentRect.size.height) - (150 + 100);
438 EXPECT_NEAR(offset.
x, expectedX, 0.001);
439 EXPECT_NEAR(offset.
y, expectedY, 0.001);
441 [parentWindow removeChildWindow:childWindow];
443 [parentWindow close];