Build tests/harness.c and collapse the seven hand-rolled headless setups #66

Closed
opened 2026-08-02 18:35:11 -04:00 by tachikoma · 1 comment
Collaborator

Source: TODO.md, "Remaining work" (at bbb7b8f)

Build tests/harness.c / tests/harness.h with akgl_test_init_headless() and
akgl_test_shutdown_headless(): set the dummy video and audio drivers,
SDL_Init(), akgl_heap_init(), akgl_registry_init(), create a software
SDL_CreateWindowAndRenderer, and point the global akgl_renderer at it.

Seven existing tests hand-roll this today -- tests/sprite.c:194,
tests/character.c:200, tests/tilemap.c:421, tests/charviewer.c:42, plus
tests/draw.c, tests/renderer.c and tests/text.c. Collapse them onto the
shared harness in the same change.

Scope correction worth keeping. The harness used to be the blocker for
everything that needed a renderer. It is not any more: tests/text.c builds a
software renderer and binds a backend to it with akgl_render_2d_bind in nine
lines, and tests/renderer.c and tests/draw.c do the same. For what is left it
is a convenience -- one setup to maintain instead of seven -- rather than the
thing standing in the way.

What still genuinely wants a live akgl_renderer global, a window, or the world
globals: akgl_render_init2d and akgl_render_2d_draw_world (src/renderer.c,
33 lines), src/assets.c (21), akgl_actor_render/actor_visible
(src/actor.c, 53), and the drawing half of src/tilemap.c.

Files: tests/harness.c, tests/harness.h (new); tests/sprite.c:194, tests/character.c:200, tests/tilemap.c:421, tests/charviewer.c:42, tests/draw.c, tests/renderer.c, tests/text.c


Filed by Tachikoma (Claude Code, Opus 5, 1M context)

**Source:** TODO.md, "Remaining work" (at bbb7b8f) Build `tests/harness.c` / `tests/harness.h` with `akgl_test_init_headless()` and `akgl_test_shutdown_headless()`: set the dummy video and audio drivers, `SDL_Init()`, `akgl_heap_init()`, `akgl_registry_init()`, create a software `SDL_CreateWindowAndRenderer`, and point the global `akgl_renderer` at it. Seven existing tests hand-roll this today -- `tests/sprite.c:194`, `tests/character.c:200`, `tests/tilemap.c:421`, `tests/charviewer.c:42`, plus `tests/draw.c`, `tests/renderer.c` and `tests/text.c`. Collapse them onto the shared harness in the same change. **Scope correction worth keeping.** The harness used to be the blocker for everything that needed a renderer. It is not any more: `tests/text.c` builds a software renderer and binds a backend to it with `akgl_render_2d_bind` in nine lines, and `tests/renderer.c` and `tests/draw.c` do the same. For what is left it is a convenience -- one setup to maintain instead of seven -- rather than the thing standing in the way. What still genuinely wants a live `akgl_renderer` global, a window, or the world globals: `akgl_render_init2d` and `akgl_render_2d_draw_world` (`src/renderer.c`, 33 lines), `src/assets.c` (21), `akgl_actor_render`/`actor_visible` (`src/actor.c`, 53), and the drawing half of `src/tilemap.c`. **Files:** `tests/harness.c`, `tests/harness.h` (new); `tests/sprite.c:194`, `tests/character.c:200`, `tests/tilemap.c:421`, `tests/charviewer.c:42`, `tests/draw.c`, `tests/renderer.c`, `tests/text.c` --- Filed by Tachikoma (Claude Code, Opus 5, 1M context)
tachikoma added this to the 0.9.x milestone 2026-08-02 18:35:11 -04:00
tachikoma added the test-coverageblast-radius:medium labels 2026-08-02 18:35:11 -04:00
Author
Collaborator

Duplicate of #6, filed twice by a paging bug in the script that created these -- the forge caps an issue listing at 50 per page and the de-duplication check read only the first page. Closing; #6 is the live one.

Duplicate of #6, filed twice by a paging bug in the script that created these -- the forge caps an issue listing at 50 per page and the de-duplication check read only the first page. Closing; #6 is the live one.
Sign in to join this conversation.