package display import ( "errors" "strings" "testing" "github.com/BurntSushi/xgb/xproto" ) func TestX11FullscreenArgsKeepCanvasBelowVideo(t *testing.T) { args := x11FullscreenArgs(0x1a2b) joined := strings.Join(args, " ") if !strings.Contains(joined, "add,fullscreen,below") { t.Fatalf("args %v must request fullscreen with below stacking", args) } if !strings.Contains(joined, "0x00001a2b") { t.Fatalf("args %v must reference the kiosk window id", args) } } func TestX11SessionRedrawsOnlyOnExpose(t *testing.T) { if !x11WantsRedraw(xproto.ExposeEvent{}) { t.Fatal("expose events must trigger a redraw") } if x11WantsRedraw(xproto.MapNotifyEvent{}) { t.Fatal("map notify events must not trigger a redraw") } } func TestX11OpenerAppliesFullscreenArgsThroughHook(t *testing.T) { var got [][]string opener := X11Opener{Fullscreen: func(args []string) error { got = append(got, args) return errors.New("wmctrl missing") }} if err := opener.applyFullscreen(x11FullscreenArgs(0x42)); err == nil { t.Fatal("hook error must propagate for logging") } if len(got) != 1 || !strings.Contains(strings.Join(got[0], " "), "add,fullscreen,below") { t.Fatalf("hook args %v must request fullscreen with below stacking", got) } }