diff --git a/config/tweaks.json b/config/tweaks.json index 625d986e..ff0eecbb 100644 --- a/config/tweaks.json +++ b/config/tweaks.json @@ -1454,8 +1454,7 @@ "Value": "0", "Type": "DWord", "OriginalValue": "1", - "DefaultState": "false", - "link": "https://winutil.christitus.com/dev/tweaks/customize-preferences/scrollbars" + "DefaultState": "false" } ], "link": "https://winutil.christitus.com/code-reference/tweaks/customize-preferences/scrollbars" diff --git a/functions/public/Invoke-WPFInstall.ps1 b/functions/public/Invoke-WPFInstall.ps1 index f4b93386..0d62a80b 100644 --- a/functions/public/Invoke-WPFInstall.ps1 +++ b/functions/public/Invoke-WPFInstall.ps1 @@ -3,19 +3,21 @@ function Invoke-WPFInstall { .SYNOPSIS Installs the selected programs using winget, if one or more of the selected programs are already installed on the system, winget will try and perform an upgrade if there's a newer version to install. #> - - $PackagesToInstall = $sync.selectedApps | Foreach-Object { $sync.configs.applicationsHashtable.$_ } + param( + [Parameter(Mandatory = $false)] + [PSObject[]]$PackagesToInstall = $($sync.selectedApps | Foreach-Object { $sync.configs.applicationsHashtable.$_ }) + ) if($sync.ProcessRunning) { $msg = "[Invoke-WPFInstall] An Install process is currently running." - Show-WinUtilMessage -Message $msg -Title "Winutil" -Button "OK" -Icon "Warning" + Show-WinUtilMessage -Message $msg -Title "WinUtil" -Button "OK" -Icon "Warning" return } if ($PackagesToInstall.Count -eq 0) { $WarningMsg = "Please select the program(s) to install or upgrade." - Show-WinUtilMessage -Message $WarningMsg -Title $AppTitle -Button "OK" -Icon "Warning" + Show-WinUtilMessage -Message $WarningMsg -Title "WinUtil" -Button "OK" -Icon "Warning" return } diff --git a/functions/public/Invoke-WPFPresets.ps1 b/functions/public/Invoke-WPFPresets.ps1 index 01e9cd40..5019d339 100644 --- a/functions/public/Invoke-WPFPresets.ps1 +++ b/functions/public/Invoke-WPFPresets.ps1 @@ -38,8 +38,8 @@ function Invoke-WPFPresets { "WPFTweak*" { $sync.selectedTweaks = [System.Collections.Generic.List[string]]::new() } "WPFInstall*" { $sync.selectedApps = [System.Collections.Generic.List[string]]::new() } "WPFAppx*" { $sync.selectedAppx = [System.Collections.Generic.List[string]]::new() } - "WPFeatures" { $sync.selectedFeatures = [System.Collections.Generic.List[string]]::new() } - "WPFToggle" { $sync.selectedToggles = [System.Collections.Generic.List[string]]::new() } + "WPFFeature*" { $sync.selectedFeatures = [System.Collections.Generic.List[string]]::new() } + "WPFToggle*" { $sync.selectedToggles = [System.Collections.Generic.List[string]]::new() } default {} } diff --git a/functions/public/Invoke-WPFUIElements.ps1 b/functions/public/Invoke-WPFUIElements.ps1 index 82b5c14a..85d0c516 100644 --- a/functions/public/Invoke-WPFUIElements.ps1 +++ b/functions/public/Invoke-WPFUIElements.ps1 @@ -327,6 +327,7 @@ function Invoke-WPFUIElements { $groupStackPanel = New-Object Windows.Controls.StackPanel $groupStackPanel.Orientation = "Vertical" [System.Windows.Automation.AutomationProperties]::SetName($groupStackPanel, $entryInfo.GroupName) + $radioButtonGroups[$entryInfo.GroupName] = $groupStackPanel # Add the group container to the ItemsControl $itemsControl.Items.Add($groupStackPanel) | Out-Null diff --git a/functions/public/Invoke-WPFUnInstall.ps1 b/functions/public/Invoke-WPFUnInstall.ps1 index cdf86f3b..4144ad37 100644 --- a/functions/public/Invoke-WPFUnInstall.ps1 +++ b/functions/public/Invoke-WPFUnInstall.ps1 @@ -11,13 +11,13 @@ function Invoke-WPFUnInstall { if($sync.ProcessRunning) { $msg = "[Invoke-WPFUnInstall] Install process is currently running" - Show-WinUtilMessage -Message $msg -Title "Winutil" -Button "OK" -Icon "Warning" + Show-WinUtilMessage -Message $msg -Title "WinUtil" -Button "OK" -Icon "Warning" return } if ($PackagesToUninstall.Count -eq 0) { $WarningMsg = "Please select the program(s) to uninstall" - Show-WinUtilMessage -Message $WarningMsg -Title $AppTitle -Button "OK" -Icon "Warning" + Show-WinUtilMessage -Message $WarningMsg -Title "WinUtil" -Button "OK" -Icon "Warning" return } diff --git a/pester/install-workflow.Tests.ps1 b/pester/install-workflow.Tests.ps1 index f2de1eae..1689bf1c 100644 --- a/pester/install-workflow.Tests.ps1 +++ b/pester/install-workflow.Tests.ps1 @@ -66,7 +66,6 @@ BeforeAll { $selectedApps.Add($key) } - $script:AppTitle = "Winutil" $script:sync = [Hashtable]::Synchronized(@{ ProcessRunning = $ProcessRunning selectedApps = $selectedApps @@ -122,7 +121,6 @@ Describe "Invoke-WPFInstall entrypoint" { AfterEach { Remove-Variable -Name sync -Scope Script -ErrorAction SilentlyContinue - Remove-Variable -Name AppTitle -Scope Script -ErrorAction SilentlyContinue Remove-Variable -Name capturedInstallScriptBlock -Scope Script -ErrorAction SilentlyContinue Remove-Variable -Name capturedInstallParameterList -Scope Script -ErrorAction SilentlyContinue } @@ -146,6 +144,23 @@ Describe "Invoke-WPFInstall entrypoint" { } } + It "queues the explicit app popup package over the selected apps" { + $explicitPackage = New-WinUtilPackage -Name "VLC" -Winget "VideoLAN.VLC" -Choco "vlc" + + Invoke-WPFInstall -PackagesToInstall $explicitPackage + + Should -Invoke -CommandName Invoke-WPFRunspace -Times 1 -Exactly -ParameterFilter { + $ScriptBlock -is [scriptblock] -and + $ParameterList.Count -eq 2 -and + $ParameterList[0][0] -eq "PackagesToInstall" -and + @($ParameterList[0][1]).Count -eq 1 -and + @($ParameterList[0][1])[0].winget -eq "VideoLAN.VLC" -and + $ParameterList[1][0] -eq "ManagerPreference" -and + $ParameterList[1][1] -eq "Winget" + } + Should -Invoke -CommandName Show-WinUtilMessage -Times 0 -Exactly + } + It "prompts and exits when no packages are selected" { New-WinUtilInstallTestContext @@ -153,7 +168,7 @@ Describe "Invoke-WPFInstall entrypoint" { Should -Invoke -CommandName Show-WinUtilMessage -Times 1 -Exactly -ParameterFilter { $Message -eq "Please select the program(s) to install or upgrade." -and - $Title -eq "Winutil" -and + $Title -eq "WinUtil" -and $Button -eq "OK" -and $Icon -eq "Warning" } @@ -167,7 +182,7 @@ Describe "Invoke-WPFInstall entrypoint" { Should -Invoke -CommandName Show-WinUtilMessage -Times 1 -Exactly -ParameterFilter { $Message -eq "[Invoke-WPFInstall] An Install process is currently running." -and - $Title -eq "Winutil" -and + $Title -eq "WinUtil" -and $Button -eq "OK" -and $Icon -eq "Warning" } @@ -201,7 +216,6 @@ Describe "Invoke-WPFInstall runspace body" { AfterEach { Remove-Variable -Name sync -Scope Script -ErrorAction SilentlyContinue - Remove-Variable -Name AppTitle -Scope Script -ErrorAction SilentlyContinue Remove-Variable -Name capturedInstallScriptBlock -Scope Script -ErrorAction SilentlyContinue } @@ -289,7 +303,6 @@ Describe "Invoke-WPFUnInstall entrypoint" { AfterEach { Remove-Variable -Name sync -Scope Script -ErrorAction SilentlyContinue - Remove-Variable -Name AppTitle -Scope Script -ErrorAction SilentlyContinue Remove-Variable -Name capturedUninstallScriptBlock -Scope Script -ErrorAction SilentlyContinue Remove-Variable -Name capturedUninstallParameterList -Scope Script -ErrorAction SilentlyContinue } @@ -324,7 +337,7 @@ Describe "Invoke-WPFUnInstall entrypoint" { Should -Invoke -CommandName Show-WinUtilMessage -Times 1 -Exactly -ParameterFilter { $Message -eq "Please select the program(s) to uninstall" -and - $Title -eq "Winutil" -and + $Title -eq "WinUtil" -and $Button -eq "OK" -and $Icon -eq "Warning" } @@ -338,7 +351,7 @@ Describe "Invoke-WPFUnInstall entrypoint" { Should -Invoke -CommandName Show-WinUtilMessage -Times 1 -Exactly -ParameterFilter { $Message -eq "[Invoke-WPFUnInstall] Install process is currently running" -and - $Title -eq "Winutil" -and + $Title -eq "WinUtil" -and $Button -eq "OK" -and $Icon -eq "Warning" } @@ -379,7 +392,6 @@ Describe "Invoke-WPFUnInstall runspace body" { AfterEach { Remove-Variable -Name sync -Scope Script -ErrorAction SilentlyContinue - Remove-Variable -Name AppTitle -Scope Script -ErrorAction SilentlyContinue Remove-Variable -Name capturedUninstallScriptBlock -Scope Script -ErrorAction SilentlyContinue } diff --git a/pester/sanity.Tests.ps1 b/pester/sanity.Tests.ps1 index 89f0c131..ba1d5d4b 100644 --- a/pester/sanity.Tests.ps1 +++ b/pester/sanity.Tests.ps1 @@ -53,7 +53,8 @@ if ($failed.Count -gt 0) { } '@ - $output = & $windowsPowerShell.Source -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command $parseScript 2>&1 + $encodedCommand = [Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes($parseScript)) + $output = & $windowsPowerShell.Source -NoProfile -NonInteractive -ExecutionPolicy Bypass -EncodedCommand $encodedCommand 2>&1 if ($LASTEXITCODE -ne 0) { throw "Windows PowerShell parser failed:`n$($output | Out-String)" }