Graphics Testing Skill
Specialized testing strategies for graphics.library and intuition.library.
1. Core Principles
- •Headless Testing: No SDL2 display required.
- •Verify BitMap: Read pixels programmatically (
ReadPixel). - •Deterministic: Same input = same output.
2. Graphics Library (tests/graphics/)
- •Init:
InitRastPort,InitBitMap. - •Memory:
AllocRaster,FreeRaster. - •Drawing:
WritePixel,Draw(lines),RectFill. - •Verification: Loop through BitMap area and assert colors via
ReadPixel.
Setup Example
c
struct BitMap bm; struct RastPort rp; InitBitMap(&bm, 2, 64, 64); bm.Planes[0] = AllocRaster(64, 64); bm.Planes[1] = AllocRaster(64, 64); InitRastPort(&rp); rp.BitMap = &bm; // ... Test ... FreeRaster(bm.Planes[0], 64, 64); FreeRaster(bm.Planes[1], 64, 64);
3. Intuition Library (tests/intuition/)
- •Headless UI: Test structures without opening host windows.
- •Screen:
OpenScreen(check width/height/depth/bitmap). - •Window:
OpenWindow(check flags, IDCMP port). - •IDCMP: Verify
UserPortand flags usingModifyIDCMP.
4. Notes
- •Tests must run in < 5 seconds.
- •Always clean up resources (close screens/windows).