//nolint:testpackage // white-box tests reach unexported state (approved 2026-07-07) package game import "testing" // TestRedrawCommandForcesFullRepaint pins CTRL-R to a forced repaint // rather than an ordinary refresh. C's arm is "after = FALSE; // clearok(curscr, TRUE); wrefresh(curscr);" (command.c), and the // clearok is the command: a diffing refresh compares the new frame // against the device's record of the old one and sends nothing when they // agree, which is exactly the situation after some other program has // scribbled on the terminal. Only the terminal can tell the difference, // so the test watches the terminal rather than the window contents. func TestRedrawCommandForcesFullRepaint(t *testing.T) { t.Parallel() g := mkGameInput(t) term, ok := g.scr.term.(*testTerm) if !ok { t.Fatal("game terminal is not a testTerm") } before := term.repaints g.After = true g.dispatch(CTRL('R')) if term.repaints != before+1 { t.Errorf("terminal repainted %d times, want %d: CTRL-R did not force "+ "a full redraw", term.repaints-before, 1) } if g.After { t.Error("CTRL-R consumed a turn; C sets after = FALSE") } }