Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS: Sync actual window state after window show, and fix integration tests on macOS 13.1 #10153

Merged
merged 3 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion native/Avalonia.Native/src/OSX/WindowImpl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
_isModal = isDialog;

WindowBaseImpl::Show(activate, isDialog);

GetWindowState(&_actualWindowState);
HideOrShowTrafficLights();

return SetWindowState(_lastWindowState);
Expand Down
11 changes: 10 additions & 1 deletion tests/Avalonia.IntegrationTests.Appium/ElementExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,16 @@ public static IDisposable OpenWindowWithClick(this AppiumWebElement element)
Thread.Sleep(1000);

var newWindows = session.FindElements(By.XPath("/XCUIElementTypeApplication/XCUIElementTypeWindow"));
var newWindowTitles = newWindows.ToDictionary(x => x.Text);

// Try to find the new window by looking for a window with a title that didn't exist before the button
// was clicked. Sometimes it seems that when a window becomes fullscreen, all other windows in the
// application lose their titles, so filter out windows with no title (this may have started happening
// with macOS 13.1?)
var newWindowTitles = newWindows
.Select(x => (x.Text, x))
.Where(x => !string.IsNullOrEmpty(x.Text))
.ToDictionary(x => x.Text, x => x.x);

var newWindowTitle = Assert.Single(newWindowTitles.Keys.Except(oldWindowTitles.Keys));

return Disposable.Create(() =>
Expand Down