feat(gal-test): Add 100% GAL API test coverage (28 scenarios)

Expand GAL native test harness from 24 to 28 scenarios covering all 70
GAL methods. New scenarios:

- scenario_text_attrs.cpp (24): Text attribute APIs (SetGlyphSize,
  SetFontBold/Italic/Underlined, SetTextMirrored, justification)
- scenario_glyphs.cpp (25): DrawGlyph/DrawGlyphs with stroke glyphs
- scenario_bitmap.cpp (26): DrawBitmap with test patterns
- scenario_transform.cpp (27): Transform() API documentation

Additional API coverage in existing scenarios:
- Flush() in test harness
- SetFlip(), SetRotation() in screen-transform
- SetDepthRange() in depth-testing
- GetGridPoint() in grid-native

New stub files:
- kifont_stub.h: STROKE_GLYPH factory functions for letter glyphs
- bitmap_base_stub.h: Test pattern generators (checkerboard, gradient)

Note: Bitmap scenario shows empty panels - DrawBitmap uses legacy OpenGL
immediate mode (glBegin/glEnd) which doesn't work while shader is active.
This is a known limitation when testing outside KiCad's VIEW rendering flow.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Viktor Vaczi 2026-01-07 12:27:06 +01:00
commit 051fb87cab
36 changed files with 3952 additions and 10 deletions

View file

@ -186,6 +186,59 @@ void RenderGroupCaching(GAL* gal, int width, int height) {
for (int y = 0; y < height; y += 50) {
gal->DrawLine(VECTOR2D(0, y), VECTOR2D(width, y));
}
// Test DeleteGroup - create a group, draw it, delete it, create another
gal->SetIsFill(true);
gal->SetIsStroke(false);
gal->SetFillColor(COLOR4D(0.9, 0.2, 0.9, 1.0));
int tempGroup = gal->BeginGroup();
{
gal->DrawCircle(VECTOR2D(0, 0), 20);
}
gal->EndGroup();
// Draw the temporary group
gal->Save();
gal->Translate(VECTOR2D(600, 400));
gal->DrawGroup(tempGroup);
gal->Restore();
// Delete the temporary group
gal->DeleteGroup(tempGroup);
// Create a new group after deletion (reuses ID potentially)
gal->SetFillColor(COLOR4D(0.2, 0.9, 0.9, 1.0));
int newGroup = gal->BeginGroup();
{
// Draw a diamond shape
std::deque<VECTOR2D> diamond = {
VECTOR2D(0, -20),
VECTOR2D(15, 0),
VECTOR2D(0, 20),
VECTOR2D(-15, 0)
};
gal->DrawPolygon(diamond);
}
gal->EndGroup();
// Draw the new group
gal->Save();
gal->Translate(VECTOR2D(680, 400));
gal->DrawGroup(newGroup);
gal->Restore();
// Test ClearCache - clears all cached groups
// We'll draw markers showing the groups existed before clear
gal->SetIsFill(false);
gal->SetIsStroke(true);
gal->SetLineWidth(1.0);
gal->SetStrokeColor(COLOR4D(1.0, 1.0, 1.0, 0.5));
gal->DrawRectangle(VECTOR2D(580, 380), VECTOR2D(720, 420));
// Note: ClearCache() invalidates all groups, so we call it at the end
// In production code, you'd recreate groups after ClearCache
gal->ClearCache();
}
} // namespace GALTest