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.
30 lines
805 B
Go
30 lines
805 B
Go
package display
|
|
|
|
import "testing"
|
|
|
|
func TestStatusTemplateDrawsBlackCanvasWithLine(t *testing.T) {
|
|
canvas := &fakeCanvas{width: 800, height: 600}
|
|
|
|
NewStatusTemplate("Brak polaczenia WFB").Draw(canvas)
|
|
|
|
clears, flushes := canvas.drawCounts()
|
|
if clears != 1 || flushes != 1 {
|
|
t.Fatalf("clears=%d flushes=%d want 1 and 1", clears, flushes)
|
|
}
|
|
lines := canvas.lines()
|
|
if len(lines) != 1 || lines[0] != "Brak polaczenia WFB" {
|
|
t.Fatalf("lines=%v want [Brak polaczenia WFB]", lines)
|
|
}
|
|
}
|
|
|
|
func TestStatusTemplateDrawsEveryProvidedLine(t *testing.T) {
|
|
canvas := &fakeCanvas{width: 800, height: 600}
|
|
|
|
NewStatusTemplate("first", "second").Draw(canvas)
|
|
|
|
lines := canvas.lines()
|
|
if len(lines) != 2 || lines[0] != "first" || lines[1] != "second" {
|
|
t.Fatalf("lines=%v want [first second]", lines)
|
|
}
|
|
}
|