feat: keep OSD always visible with pre-map fullscreen states (#3)

This commit is contained in:
2026-11-03 13:11:15 +01:00
parent 79ea5d62b7
commit 3d6d146007
9 changed files with 328 additions and 157 deletions
+13 -6
View File
@@ -66,19 +66,26 @@ func TestBuildTargetBuildsIndependentVitureLayers(t *testing.T) {
}
// The canvas layer keeps the target-specific fallback template with the
// exact fallback text.
// exact fallback text; the OSD layer shows explicit state without a
// snapshot. Both layers are fullscreen at startup with no video — the
// canvas below (RoleBelow) and the OSD above (RoleAbove), per the
// display package's fullscreen-args contract.
canvasSurface := &recordingCanvas{width: 800, height: 600}
canvas.Template.Draw(canvasSurface)
if len(canvasSurface.lines) != 1 || canvasSurface.lines[0] != "Brak połączenia WFB" {
t.Fatalf("canvas lines=%q want the exact fallback text", canvasSurface.lines)
}
// The OSD layer is the OSD surface, never the fallback: without a
// published snapshot it presents nothing.
osdSurface := &recordingCanvas{width: 800, height: 600}
osdLayer.Template.Draw(osdSurface)
if len(osdSurface.lines) != 0 {
t.Fatalf("OSD lines=%q want none: the overlay must not duplicate the fallback", osdSurface.lines)
wantStartup := []string{"NO DATA", "VTX tbl:-- ceil:-- req:-- ack:--", "VIDEO OFF"}
if len(osdSurface.lines) != len(wantStartup) {
t.Fatalf("OSD lines=%q want the explicit startup state %q", osdSurface.lines, wantStartup)
}
for i := range wantStartup {
if osdSurface.lines[i] != wantStartup[i] {
t.Fatalf("line %d=%q want %q", i, osdSurface.lines[i], wantStartup[i])
}
}
// Video presence hides the fallback on the canvas layer only.
@@ -124,7 +131,7 @@ func TestBuildTargetOSDLayerRendersPublishedSnapshots(t *testing.T) {
surface := &recordingCanvas{width: 800, height: 600}
osdLayer.Template.Draw(surface)
want := []string{"ARM ARMED", "VTX tbl:-- ceil:95 req:-- ack:--"}
want := []string{"ARM ARMED", "VTX tbl:-- ceil:95 req:-- ack:--", "VIDEO ON"}
if len(surface.lines) != len(want) {
t.Fatalf("OSD lines=%q want %q from the supervisor-published snapshot", surface.lines, want)
}