feat: split kiosk into fallback canvas and OSD overlay layers (#8)
Build Ground Station / build (push) Successful in 37s
Build Ground Station / build (push) Successful in 37s
Drive two independent visual layers per display target from one shared video presence signal: the fullscreen fallback/menu canvas below video and a transparent, input-transparent OSD overlay above video, reserved as the future flight OSD rendering surface. WFB and video decode stay out of the UI process; pilot video keeps rendering priority.
This commit was merged in pull request #12.
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package display
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestOSDTemplateStaysTransparentWhileVideoAbsent(t *testing.T) {
|
||||
canvas := &fakeCanvas{width: 800, height: 600}
|
||||
|
||||
NewOSDTemplate(NewVideoPresence()).Draw(canvas)
|
||||
|
||||
clears, flushes := canvas.drawCounts()
|
||||
if clears != 1 || flushes != 1 {
|
||||
t.Fatalf("clears=%d flushes=%d want 1 and 1", clears, flushes)
|
||||
}
|
||||
if lines := canvas.lines(); len(lines) != 0 {
|
||||
t.Fatalf("OSD lines=%q want none: the OSD is a telemetry surface, not a fallback", lines)
|
||||
}
|
||||
}
|
||||
|
||||
func TestOSDTemplateStaysTransparentWhileVideoPresent(t *testing.T) {
|
||||
canvas := &fakeCanvas{width: 800, height: 600}
|
||||
presence := NewVideoPresence()
|
||||
presence.SetActive(true)
|
||||
|
||||
NewOSDTemplate(presence).Draw(canvas)
|
||||
|
||||
if lines := canvas.lines(); len(lines) != 0 {
|
||||
t.Fatalf("OSD lines=%q want none while video is present", lines)
|
||||
}
|
||||
}
|
||||
|
||||
func TestOSDTemplateNeverDrawsTheFallbackText(t *testing.T) {
|
||||
canvas := &fakeCanvas{width: 800, height: 600}
|
||||
presence := NewVideoPresence()
|
||||
template := NewOSDTemplate(presence)
|
||||
|
||||
for _, active := range []bool{false, true, false} {
|
||||
presence.SetActive(active)
|
||||
template.Draw(canvas)
|
||||
if lines := canvas.lines(); len(lines) != 0 {
|
||||
t.Fatalf("lines=%q after presence=%v want none", lines, active)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user