mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-08-09 09:31:15 +10:00
Add window-level progress indicator for Run Tweaks and Undo (#4830)
* feat(tweaks): add window-level progress indicator for Run Tweaks and Undo * Hide completed tweaks progress on next action --------- Co-authored-by: Chris Titus <contact@christitus.com>
This commit is contained in:
@@ -34,6 +34,9 @@ BeforeAll {
|
||||
function Set-WinUtilProgressBar {
|
||||
param($Label, $Percent)
|
||||
}
|
||||
function Set-WinUtilTweaksProgressIndicator {
|
||||
param($Visible, $Label, $Percent)
|
||||
}
|
||||
function Write-WinUtilLog {
|
||||
param($Message, $Level, $Component)
|
||||
}
|
||||
|
||||
@@ -44,8 +44,17 @@ namespace System.Windows.Controls
|
||||
. (Join-Path $script:repoRoot "functions\private\Update-WinUtilSelections.ps1")
|
||||
. (Join-Path $script:repoRoot "functions\private\Reset-WPFCheckBoxes.ps1")
|
||||
. (Join-Path $script:repoRoot "functions\public\Invoke-WPFSelectedCheckboxesUpdate.ps1")
|
||||
. (Join-Path $script:repoRoot "functions\public\Invoke-WPFButton.ps1")
|
||||
. (Join-Path $script:repoRoot "functions\public\Invoke-WPFToggleAllCategories.ps1")
|
||||
|
||||
function Set-WinUtilProgressBar {
|
||||
param($Label, $Percent)
|
||||
}
|
||||
|
||||
function Set-WinUtilTweaksProgressIndicator {
|
||||
param($Visible, $Label, $Percent)
|
||||
}
|
||||
|
||||
function script:New-WinUtilFakeCheckBox {
|
||||
param([bool]$IsChecked = $false)
|
||||
|
||||
@@ -272,3 +281,38 @@ Describe "Invoke-WPFToggleAllCategories" {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Invoke-WPFButton progress cleanup" {
|
||||
BeforeEach {
|
||||
New-WinUtilUiStateTestContext
|
||||
Mock Set-WinUtilProgressBar { }
|
||||
Mock Set-WinUtilTweaksProgressIndicator { }
|
||||
}
|
||||
|
||||
AfterEach {
|
||||
Remove-Variable -Name sync -Scope Script -ErrorAction SilentlyContinue
|
||||
Remove-Variable -Name sync -Scope Global -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
It "clears completed progress on the next idle button click" {
|
||||
$script:sync.ProcessRunning = $false
|
||||
|
||||
Invoke-WPFButton -Button "WPFNoOp"
|
||||
|
||||
Should -Invoke Set-WinUtilProgressBar -Times 1 -Exactly -ParameterFilter {
|
||||
$Label -eq "" -and $Percent -eq 0
|
||||
}
|
||||
Should -Invoke Set-WinUtilTweaksProgressIndicator -Times 1 -Exactly -ParameterFilter {
|
||||
$Visible -eq $false
|
||||
}
|
||||
}
|
||||
|
||||
It "leaves progress visible while a process is running" {
|
||||
$script:sync.ProcessRunning = $true
|
||||
|
||||
Invoke-WPFButton -Button "WPFNoOp"
|
||||
|
||||
Should -Not -Invoke Set-WinUtilProgressBar
|
||||
Should -Not -Invoke Set-WinUtilTweaksProgressIndicator
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user