feat: add portable Windows zone manager
This commit is contained in:
@@ -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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user