From f43fc66ae3386373b687a945449e5552e87177ed Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Tue, 31 Jan 2023 16:16:45 +0100 Subject: [PATCH 1/2] Fix failing integration tests on macOS. Looks like maybe macOS 13.1 changed behavior around fullscreen windows, breaking our integration tests. --- .../ElementExtensions.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/Avalonia.IntegrationTests.Appium/ElementExtensions.cs b/tests/Avalonia.IntegrationTests.Appium/ElementExtensions.cs index e7837a6971..b9df420270 100644 --- a/tests/Avalonia.IntegrationTests.Appium/ElementExtensions.cs +++ b/tests/Avalonia.IntegrationTests.Appium/ElementExtensions.cs @@ -118,7 +118,16 @@ namespace Avalonia.IntegrationTests.Appium 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(() => From 6ded9c6e7fd091ca575569780c17969a67713a9d Mon Sep 17 00:00:00 2001 From: Steven Kirk Date: Wed, 1 Feb 2023 14:43:23 +0100 Subject: [PATCH 2/2] Update actual window state after showing window. --- native/Avalonia.Native/src/OSX/WindowImpl.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native/Avalonia.Native/src/OSX/WindowImpl.mm b/native/Avalonia.Native/src/OSX/WindowImpl.mm index f345043f61..ce82f7d83f 100644 --- a/native/Avalonia.Native/src/OSX/WindowImpl.mm +++ b/native/Avalonia.Native/src/OSX/WindowImpl.mm @@ -66,7 +66,7 @@ HRESULT WindowImpl::Show(bool activate, bool isDialog) { _isModal = isDialog; WindowBaseImpl::Show(activate, isDialog); - + GetWindowState(&_actualWindowState); HideOrShowTrafficLights(); return SetWindowState(_lastWindowState);