27 lines
627 B
Go
27 lines
627 B
Go
package display
|
|
|
|
import "testing"
|
|
|
|
func TestVideoPresenceTransitionsReportChange(t *testing.T) {
|
|
presence := NewVideoPresence()
|
|
|
|
if presence.Active() {
|
|
t.Fatal("video must be absent before any signal")
|
|
}
|
|
if !presence.SetActive(true) {
|
|
t.Fatal("first video appearance must report a change")
|
|
}
|
|
if !presence.Active() {
|
|
t.Fatal("video must be active after appearance")
|
|
}
|
|
if presence.SetActive(true) {
|
|
t.Fatal("repeated appearance must not report a change")
|
|
}
|
|
if !presence.SetActive(false) {
|
|
t.Fatal("video end must report a change")
|
|
}
|
|
if presence.Active() {
|
|
t.Fatal("video must be inactive after end")
|
|
}
|
|
}
|