feat: add portable Windows zone manager

This commit is contained in:
Steve Cliff
2026-08-20 08:57:41 +01:00
parent 318300ef79
commit 6ddecad74d
15 changed files with 1760 additions and 4 deletions
+45
View File
@@ -0,0 +1,45 @@
package config
import "testing"
func TestDefaultValid(t *testing.T) {
if err := Default().Validate(); err != nil {
t.Fatal(err)
}
}
func TestLayoutFallback(t *testing.T) {
c := Default()
if _, ok := c.LayoutFor(`\\.\DISPLAY99`); !ok {
t.Fatal("expected wildcard layout")
}
}
func TestExcluded(t *testing.T) {
c := Default()
c.Excluded = []string{"notepad", "exact.exe"}
if !c.IsExcluded(`C:\Windows\notepad.exe`) || !c.IsExcluded(`C:\x\exact.exe`) || c.IsExcluded(`C:\x\other.exe`) {
t.Fatal("bad exclusion matching")
}
}
func TestInvalidNumberedAction(t *testing.T) {
c := Default()
c.Hotkeys = []Hotkey{{Keys: "win+alt+1", Action: "zone_nope"}}
if err := c.Validate(); err == nil {
t.Fatal("expected invalid numbered action to fail")
}
}
func TestOverlayValidation(t *testing.T) {
c := Default()
c.Overlay.Color = "blue"
if err := c.Validate(); err == nil {
t.Fatal("expected invalid overlay color to fail")
}
c = Default()
c.Overlay.Opacity = 101
if err := c.Validate(); err == nil {
t.Fatal("expected invalid overlay opacity to fail")
}
}