Let benchmarks use WithSimulationScreen

The next commit adds a benchmark that draws a view.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Stefan Haller
2026-11-12 11:27:59 +01:00
co-authored by Claude Opus 5.5
parent f07cc9e6f6
commit e2418047df
+7 -7
View File
@@ -16,16 +16,16 @@ import (
)
// WithSimulationScreen swaps the package-level Screen for a tcell
// terminfo-backed mock terminal so tests can call view.draw() and
// inspect rendered cells via Screen.Get(). The previous Screen is
// restored on test cleanup.
func WithSimulationScreen(t *testing.T, width, height int) {
t.Helper()
// terminfo-backed mock terminal so tests and benchmarks can call
// view.draw() and inspect rendered cells via Screen.Get(). The previous
// Screen is restored on test cleanup.
func WithSimulationScreen(tb testing.TB, width, height int) {
tb.Helper()
saved := Screen
if err := (&Gui{}).tcellInitSimulation(width, height); err != nil {
t.Fatal(err)
tb.Fatal(err)
}
t.Cleanup(func() {
tb.Cleanup(func() {
Screen.Fini()
Screen = saved
})