-
Notifications
You must be signed in to change notification settings - Fork 2k
Fixed Incorrect Window.Y and Window.Height values when closing a maximized window #29253
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
Changes from 14 commits
db34749
44f9453
e8f8d63
e293f1b
17cc880
cd327ba
776440d
16746e6
5438917
00496fa
e12231f
7eac142
2a29755
e819407
69835f4
c42cd91
9770867
343161c
623fd3e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -154,6 +154,67 @@ await CreateHandlerAndAddToWindow<IWindowHandler>(mainPage, async (handler) => | |
| }); | ||
| } | ||
|
|
||
| [Fact] | ||
| public async Task WindowsBoundsWhenMaximized() | ||
| { | ||
| SetupBuilder(); | ||
| var mainPage = new NavigationPage(new ContentPage()); | ||
|
|
||
| await CreateHandlerAndAddToWindow<IWindowHandler>(mainPage, async (handler) => | ||
| { | ||
| var appWindowPlatform = handler.PlatformView.GetAppWindow(); | ||
| Assert.NotNull(appWindowPlatform?.Presenter); | ||
| var presenter = Assert.IsType<OverlappedPresenter>(appWindowPlatform.Presenter); | ||
|
|
||
| // maximize window | ||
| presenter.Maximize(); | ||
| var appWindow = handler.PlatformView.GetWindow(); | ||
|
Dhivya-SF4094 marked this conversation as resolved.
|
||
| await AssertEventually(() => appWindow.X == 0); | ||
| await AssertEventually(() => appWindow.Y == 0); | ||
| // Verify width and height are non-zero (regression: Height was reported as 0 when maximized) | ||
| await AssertEventually(() => appWindow.Width > 0); | ||
| await AssertEventually(() => appWindow.Height > 0); | ||
|
Dhivya-SF4094 marked this conversation as resolved.
Outdated
Dhivya-SF4094 marked this conversation as resolved.
Outdated
|
||
| }); | ||
| } | ||
|
|
||
| [Fact] | ||
| public async Task WindowsYAndHeightCorrectWhenClosingMaximizedWindow() | ||
| { | ||
| SetupBuilder(); | ||
| var mainPage = new NavigationPage(new ContentPage()); | ||
|
|
||
| double destroyingY = double.NaN; | ||
| double destroyingHeight = double.NaN; | ||
|
|
||
| await CreateHandlerAndAddToWindow<IWindowHandler>(mainPage, async (handler) => | ||
| { | ||
| var window = handler.VirtualView as Window; | ||
| Assert.NotNull(window); | ||
|
|
||
| var appWindowPlatform = handler.PlatformView.GetAppWindow(); | ||
| Assert.NotNull(appWindowPlatform?.Presenter); | ||
| var presenter = Assert.IsType<OverlappedPresenter>(appWindowPlatform.Presenter); | ||
|
|
||
| // Capture the frame values at destroy time so we can verify them after cleanup | ||
| window.Destroying += (s, e) => | ||
| { | ||
| destroyingY = window.Y; | ||
| destroyingHeight = window.Height; | ||
| }; | ||
|
|
||
| // Maximize the window and wait until the frame update reflects the maximized bounds | ||
| presenter.Maximize(); | ||
| await AssertEventually(() => window.Y == 0); | ||
|
Dhivya-SF4094 marked this conversation as resolved.
Outdated
|
||
| await AssertEventually(() => window.Height > 0); | ||
|
Dhivya-SF4094 marked this conversation as resolved.
Outdated
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [major] Regression Prevention and Test Coverage - This does not prove the Destroying-time regression is fixed. |
||
| }); | ||
|
|
||
| // The window is destroyed during CreateHandlerAndAddToWindow cleanup. | ||
| // Verify that the Y and Height values at Destroying time were non-negative / non-zero. | ||
| Assert.False(double.IsNaN(destroyingHeight), "Window.Destroying event was not raised"); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [minor] Regression Prevention — |
||
| Assert.True(destroyingHeight > 0, $"Height should be > 0 when closing a maximized window, but was {destroyingHeight}"); | ||
|
Dhivya-SF4094 marked this conversation as resolved.
Outdated
Dhivya-SF4094 marked this conversation as resolved.
Outdated
|
||
| Assert.True(destroyingY >= 0, $"Y should be >= 0 when closing a maximized window, but was {destroyingY}"); | ||
| } | ||
|
|
||
| [Fact] | ||
| public async Task ToggleFullscreenTitleBarWorks() | ||
| { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.