mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-08-10 18:11:16 +10:00
Make MPO tweak a three-state control (#4897)
* refactor: make MPO tweak a three-state control * docs: explain MPO tweak states * docs: address code review comments * refactor: make Multiplane Overlay config-driven
This commit is contained in:
@@ -189,6 +189,14 @@ Describe "Tweaks config" {
|
||||
foreach ($registryEntry in @($tweak.Value.registry)) {
|
||||
if ($null -eq $registryEntry) { continue }
|
||||
|
||||
if ($registryEntry.Values) {
|
||||
if ($registryEntry.PSObject.Properties.Name -notcontains "DefaultValue" -or
|
||||
[string]::IsNullOrWhiteSpace([string]$registryEntry.DefaultValue)) {
|
||||
$invalidTweaks.Add("$($tweak.Name),registry")
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
if ($registryEntry.PSObject.Properties.Name -notcontains "OriginalValue" -or
|
||||
[string]::IsNullOrWhiteSpace([string]$registryEntry.OriginalValue)) {
|
||||
$invalidTweaks.Add("$($tweak.Name),registry")
|
||||
@@ -429,6 +437,19 @@ Describe "UI-rendered config entries" {
|
||||
if (-not (Test-WinUtilHasNonEmptyProperty -Object $entry.Value -Name "ComboItems")) {
|
||||
$invalidEntries.Add("$($entry.Name) combobox missing ComboItems")
|
||||
}
|
||||
$statefulRegistry = @($entry.Value.registry | Where-Object Values)
|
||||
if ($statefulRegistry.Count -gt 0) {
|
||||
$comboItems = @($entry.Value.ComboItems)
|
||||
if ($statefulRegistry.Count -ne @($entry.Value.registry).Count) {
|
||||
$invalidEntries.Add("$($entry.Name) registry states must all use Values")
|
||||
} else {
|
||||
foreach ($setting in $statefulRegistry) {
|
||||
if (Compare-Object $comboItems @($setting.Values.PSObject.Properties.Name)) {
|
||||
$invalidEntries.Add("$($entry.Name) ComboItems and registry states do not match")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (-not (Test-WinUtilHasNonEmptyProperty -Object $entry.Value -Name "Description")) {
|
||||
$invalidEntries.Add("$($entry.Name) missing Description")
|
||||
@@ -442,7 +463,12 @@ Describe "UI-rendered config entries" {
|
||||
foreach ($registryEntry in @($entry.Value.registry)) {
|
||||
if ($null -eq $registryEntry) { continue }
|
||||
|
||||
foreach ($missingField in (Get-WinUtilMissingRequiredFields -EntryName "$($entry.Name),registry" -Entry $registryEntry -RequiredFields @("Path", "Name", "Type", "Value", "OriginalValue"))) {
|
||||
$requiredRegistryFields = if ($entry.Value.Type -eq "Combobox" -and $statefulRegistry.Count -gt 0) {
|
||||
@("Path", "Name", "Type", "DefaultValue", "Values")
|
||||
} else {
|
||||
@("Path", "Name", "Type", "Value", "OriginalValue")
|
||||
}
|
||||
foreach ($missingField in (Get-WinUtilMissingRequiredFields -EntryName "$($entry.Name),registry" -Entry $registryEntry -RequiredFields $requiredRegistryFields)) {
|
||||
$invalidEntries.Add($missingField)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user