feat: independent fullscreen kiosk display foundation (#1)
Kiosk process owns its display lifecycle: waits for X11, keeps the fullscreen black canvas below video, stops deterministically on signal. Supervisor starts it before video, restarts only on process death, and shuts the whole process group down; X11 downtime never restarts the supervisor. Per-target opener/template abstractions for future MIPI.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDefaultConfigStartsKioskDisplay(t *testing.T) {
|
||||
cfg := Default()
|
||||
|
||||
if !cfg.Display.Enabled {
|
||||
t.Fatal("kiosk display must be enabled by default")
|
||||
}
|
||||
if cfg.Display.Command != "/usr/local/bin/groundstation-display" {
|
||||
t.Fatalf("command=%q", cfg.Display.Command)
|
||||
}
|
||||
if cfg.Display.User != "orangepi" {
|
||||
t.Fatalf("user=%q", cfg.Display.User)
|
||||
}
|
||||
if cfg.Display.Display != ":0" {
|
||||
t.Fatalf("display=%q want :0", cfg.Display.Display)
|
||||
}
|
||||
if cfg.Display.Xauthority != "/home/orangepi/.Xauthority" {
|
||||
t.Fatalf("xauthority=%q", cfg.Display.Xauthority)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadOverridesDisplaySettings(t *testing.T) {
|
||||
path := filepath.Join(t.TempDir(), "config.yml")
|
||||
body := "display:\n enabled: false\n command: /bin/kiosk\n"
|
||||
if err := os.WriteFile(path, []byte(body), 0644); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
cfg, err := Load(path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if cfg.Display.Enabled {
|
||||
t.Fatal("display override must disable the kiosk")
|
||||
}
|
||||
if cfg.Display.Command != "/bin/kiosk" {
|
||||
t.Fatalf("command=%q want /bin/kiosk", cfg.Display.Command)
|
||||
}
|
||||
if cfg.Display.Display != ":0" {
|
||||
t.Fatalf("display=%q want default :0", cfg.Display.Display)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user