mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-29 16:02:51 -05:00
niri: fix test
This commit is contained in:
@@ -6,6 +6,13 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const testHeader = `// ! DO NOT EDIT !
|
||||||
|
// ! AUTO-GENERATED BY DMS !
|
||||||
|
// ! CHANGES WILL BE OVERWRITTEN !
|
||||||
|
// ! PLACE YOUR CUSTOM CONFIGURATION ELSEWHERE !
|
||||||
|
|
||||||
|
`
|
||||||
|
|
||||||
func TestNiriProviderName(t *testing.T) {
|
func TestNiriProviderName(t *testing.T) {
|
||||||
provider := NewNiriProvider("")
|
provider := NewNiriProvider("")
|
||||||
if provider.Name() != "niri" {
|
if provider.Name() != "niri" {
|
||||||
@@ -197,7 +204,7 @@ func TestNiriGenerateBindsContent(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "empty binds",
|
name: "empty binds",
|
||||||
binds: map[string]*overrideBind{},
|
binds: map[string]*overrideBind{},
|
||||||
expected: "binds {}\n",
|
expected: testHeader + "binds {}\n",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "simple spawn bind",
|
name: "simple spawn bind",
|
||||||
@@ -208,7 +215,7 @@ func TestNiriGenerateBindsContent(t *testing.T) {
|
|||||||
Description: "Open Terminal",
|
Description: "Open Terminal",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
expected: `binds {
|
expected: testHeader + `binds {
|
||||||
Mod+T hotkey-overlay-title="Open Terminal" { spawn "kitty"; }
|
Mod+T hotkey-overlay-title="Open Terminal" { spawn "kitty"; }
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
@@ -222,7 +229,7 @@ func TestNiriGenerateBindsContent(t *testing.T) {
|
|||||||
Description: "Application Launcher",
|
Description: "Application Launcher",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
expected: `binds {
|
expected: testHeader + `binds {
|
||||||
Mod+Space hotkey-overlay-title="Application Launcher" { spawn "dms" "ipc" "call" "spotlight" "toggle"; }
|
Mod+Space hotkey-overlay-title="Application Launcher" { spawn "dms" "ipc" "call" "spotlight" "toggle"; }
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
@@ -236,7 +243,7 @@ func TestNiriGenerateBindsContent(t *testing.T) {
|
|||||||
Options: map[string]any{"allow-when-locked": true},
|
Options: map[string]any{"allow-when-locked": true},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
expected: `binds {
|
expected: testHeader + `binds {
|
||||||
XF86AudioMute allow-when-locked=true { spawn "dms" "ipc" "call" "audio" "mute"; }
|
XF86AudioMute allow-when-locked=true { spawn "dms" "ipc" "call" "audio" "mute"; }
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
@@ -250,7 +257,7 @@ func TestNiriGenerateBindsContent(t *testing.T) {
|
|||||||
Description: "Close Window",
|
Description: "Close Window",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
expected: `binds {
|
expected: testHeader + `binds {
|
||||||
Mod+Q hotkey-overlay-title="Close Window" { close-window; }
|
Mod+Q hotkey-overlay-title="Close Window" { close-window; }
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
@@ -263,7 +270,7 @@ func TestNiriGenerateBindsContent(t *testing.T) {
|
|||||||
Action: "next-window",
|
Action: "next-window",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
expected: `binds {
|
expected: testHeader + `binds {
|
||||||
}
|
}
|
||||||
|
|
||||||
recent-windows {
|
recent-windows {
|
||||||
@@ -415,7 +422,7 @@ func TestNiriGenerateBindsContentNumericArgs(t *testing.T) {
|
|||||||
Description: "Focus Workspace 1",
|
Description: "Focus Workspace 1",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
expected: `binds {
|
expected: testHeader + `binds {
|
||||||
Mod+1 hotkey-overlay-title="Focus Workspace 1" { focus-workspace 1; }
|
Mod+1 hotkey-overlay-title="Focus Workspace 1" { focus-workspace 1; }
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
@@ -429,7 +436,7 @@ func TestNiriGenerateBindsContentNumericArgs(t *testing.T) {
|
|||||||
Description: "Focus Workspace 10",
|
Description: "Focus Workspace 10",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
expected: `binds {
|
expected: testHeader + `binds {
|
||||||
Mod+0 hotkey-overlay-title="Focus Workspace 10" { focus-workspace 10; }
|
Mod+0 hotkey-overlay-title="Focus Workspace 10" { focus-workspace 10; }
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
@@ -443,7 +450,7 @@ func TestNiriGenerateBindsContentNumericArgs(t *testing.T) {
|
|||||||
Description: "Adjust Column Width -10%",
|
Description: "Adjust Column Width -10%",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
expected: `binds {
|
expected: testHeader + `binds {
|
||||||
Super+Minus hotkey-overlay-title="Adjust Column Width -10%" { set-column-width "-10%"; }
|
Super+Minus hotkey-overlay-title="Adjust Column Width -10%" { set-column-width "-10%"; }
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
@@ -457,7 +464,7 @@ func TestNiriGenerateBindsContentNumericArgs(t *testing.T) {
|
|||||||
Description: "Adjust Column Width +10%",
|
Description: "Adjust Column Width +10%",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
expected: `binds {
|
expected: testHeader + `binds {
|
||||||
Super+Equal hotkey-overlay-title="Adjust Column Width +10%" { set-column-width "+10%"; }
|
Super+Equal hotkey-overlay-title="Adjust Column Width +10%" { set-column-width "+10%"; }
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
@@ -486,7 +493,7 @@ func TestNiriGenerateActionWithUnquotedPercentArg(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
content := provider.generateBindsContent(binds)
|
content := provider.generateBindsContent(binds)
|
||||||
expected := `binds {
|
expected := testHeader + `binds {
|
||||||
Super+Equal hotkey-overlay-title="Adjust Window Height +10%" { set-window-height "+10%"; }
|
Super+Equal hotkey-overlay-title="Adjust Window Height +10%" { set-window-height "+10%"; }
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
@@ -507,7 +514,7 @@ func TestNiriGenerateSpawnWithNumericArgs(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
content := provider.generateBindsContent(binds)
|
content := provider.generateBindsContent(binds)
|
||||||
expected := `binds {
|
expected := testHeader + `binds {
|
||||||
XF86AudioLowerVolume allow-when-locked=true { spawn "dms" "ipc" "call" "audio" "decrement" "3"; }
|
XF86AudioLowerVolume allow-when-locked=true { spawn "dms" "ipc" "call" "audio" "decrement" "3"; }
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
@@ -528,7 +535,7 @@ func TestNiriGenerateSpawnNumericArgFromCLI(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
content := provider.generateBindsContent(binds)
|
content := provider.generateBindsContent(binds)
|
||||||
expected := `binds {
|
expected := testHeader + `binds {
|
||||||
XF86AudioLowerVolume allow-when-locked=true { spawn "dms" "ipc" "call" "audio" "decrement" "3"; }
|
XF86AudioLowerVolume allow-when-locked=true { spawn "dms" "ipc" "call" "audio" "decrement" "3"; }
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|||||||
Reference in New Issue
Block a user