Restore native window animations and custom caption hit testing (#4888)

* feat: restore native window animations

* fix: disable native caption button hit testing

* test: remove fake window state assertions
This commit is contained in:
Omar
2026-08-03 18:54:06 -05:00
committed by GitHub
parent f7361fdb72
commit b832da622f
4 changed files with 6 additions and 34 deletions
+3 -3
View File
@@ -85,12 +85,12 @@ function Invoke-WPFButton {
} }
} }
"WPFCloseButton" {$sync.Form.Close(); Write-Host "Bye bye!"} "WPFCloseButton" {$sync.Form.Close(); Write-Host "Bye bye!"}
"WPFMinimizeButton" {$sync.Form.WindowState = [Windows.WindowState]::Minimized} "WPFMinimizeButton" {[Windows.SystemCommands]::MinimizeWindow($sync.Form)}
"WPFMaximizeButton" { "WPFMaximizeButton" {
if ($sync.Form.WindowState -eq [Windows.WindowState]::Normal) { if ($sync.Form.WindowState -eq [Windows.WindowState]::Normal) {
$sync.Form.WindowState = [Windows.WindowState]::Maximized [Windows.SystemCommands]::MaximizeWindow($sync.Form)
} else { } else {
$sync.Form.WindowState = [Windows.WindowState]::Normal [Windows.SystemCommands]::RestoreWindow($sync.Form)
} }
} }
"WPFselectedAppsButton" {$sync.selectedAppsPopup.IsOpen = -not $sync.selectedAppsPopup.IsOpen} "WPFselectedAppsButton" {$sync.selectedAppsPopup.IsOpen = -not $sync.selectedAppsPopup.IsOpen}
-28
View File
@@ -445,31 +445,3 @@ Describe "Invoke-WPFButton progress cleanup" {
} }
} }
Describe "Invoke-WPFButton window state" {
BeforeEach {
New-WinUtilUiStateTestContext
$script:sync.ProcessRunning = $true
$script:sync.Form = [pscustomobject]@{
WindowState = [Windows.WindowState]::Normal
}
}
AfterEach {
Remove-Variable -Name sync -Scope Script -ErrorAction SilentlyContinue
Remove-Variable -Name sync -Scope Global -ErrorAction SilentlyContinue
}
It "maximizes a normal window" {
Invoke-WPFButton -Button "WPFMaximizeButton"
$script:sync.Form.WindowState | Should -Be ([Windows.WindowState]::Maximized)
}
It "restores a maximized window" {
$script:sync.Form.WindowState = [Windows.WindowState]::Maximized
Invoke-WPFButton -Button "WPFMaximizeButton"
$script:sync.Form.WindowState | Should -Be ([Windows.WindowState]::Normal)
}
}
+2 -2
View File
@@ -252,10 +252,10 @@ $sync["Form"].Add_MouseDoubleClick({
if ($_.OriginalSource.Name -eq "NavDockPanel" -or if ($_.OriginalSource.Name -eq "NavDockPanel" -or
$_.OriginalSource.Name -eq "GridBesideNavDockPanel") { $_.OriginalSource.Name -eq "GridBesideNavDockPanel") {
if ($sync["Form"].WindowState -eq [Windows.WindowState]::Normal) { if ($sync["Form"].WindowState -eq [Windows.WindowState]::Normal) {
$sync["Form"].WindowState = [Windows.WindowState]::Maximized [Windows.SystemCommands]::MaximizeWindow($sync.Form)
} }
else{ else{
$sync["Form"].WindowState = [Windows.WindowState]::Normal [Windows.SystemCommands]::RestoreWindow($sync.Form)
} }
} }
}) })
+1 -1
View File
@@ -13,7 +13,7 @@
MinHeight="600" MinHeight="600"
Title="WinUtil"> Title="WinUtil">
<WindowChrome.WindowChrome> <WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="0" CornerRadius="10"/> <WindowChrome CaptionHeight="0" CornerRadius="10" UseAeroCaptionButtons="False"/>
</WindowChrome.WindowChrome> </WindowChrome.WindowChrome>
<Window.Resources> <Window.Resources>
<Style TargetType="ToolTip"> <Style TargetType="ToolTip">