Incomplete checkpoint, preserved after the implementing session hit a capacity limit partway through mutation verification. NOT reviewed and NOT gate-clean: make fmt has not been run, so fmt-check currently fails on ARCHITECTURE.md and TODO.md. Work still outstanding before this is fit for review: - run make fmt and fold the result in - finish mutation-proving each of the three behaviors - verify every message string byte-for-byte against the C sources - confirm TestSeedCompatItemTables passes with its golden untouched Refs #13.
38 lines
1.1 KiB
Go
38 lines
1.1 KiB
Go
//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")
|
|
}
|
|
}
|