fix: UI for filtering config options

Also added vim-like movement (hjkl, g, shift+g)
  h -> left
  j -> down
  k -> up
  l -> right
  g -> Go to first config
  shift+g -> Go to last config
This commit is contained in:
2024-12-19 12:49:49 +02:00
parent 7b03fa0d86
commit 96389610ed
3 changed files with 90 additions and 37 deletions
+23
View File
@@ -0,0 +1,23 @@
package main
import "testing"
func TestFilterConfigs(t *testing.T) {
cfgs := filter(Configs, "Preset", "Constant Rate Factor (CRF)")
for _, cfg := range cfgs {
if cfg.Name == "Preset" {
t.Fatalf("Failed to filter out config \"Preset\"")
} else if cfg.Name == "Constant Rate Factor (CRF)" {
t.Fatalf("Failed to filter out config \"Constant Rate Factor (CRF)\"")
}
}
}
func TestGetVisibleConfigs(t *testing.T) {
cfgs := getVisibleConfigs(Configs)
if len(cfgs) == len(Configs) {
t.Fatalf("Failed to get the correct visible configs. Expected VisibleConfigs len: %v. Got %v", 4, len(cfgs))
}
}