pcbjam/tests/gal-regression/scenarios/gal_test_scenarios.h
Viktor Vaczi 490f531521 feat(webgl): Add GAL native test harness for visual regression testing
Add a standalone test application that compiles KiCad's actual OPENGL_GAL
against system wxWidgets to generate baseline screenshots for comparing
native OpenGL rendering against WebGL rendering in the browser.

Architecture:
- Compiles 18 KiCad GAL source files from the kicad submodule
- Uses template-based private member accessor (safer than #define private public)
- Generates shader C++ files from GLSL (10 shader pairs for SMAA AA)
- Minimal stubs for KiCad dependencies (PGM_BASE, ADVANCED_CFG, etc.)

Test coverage:
- 11 scenarios testing ~19% of GAL API
- basic-lines, line-widths, circles, arcs, rectangles, polygons
- alpha-blending, transforms, grid-cursor, segments, complex-scene

Key insights documented:
- GAL uses world-to-screen transformation requiring 1:1 pixel mapping
- FBO reading required for clean screenshots on macOS
- Layer depth needed for proper z-ordering in complex scenes

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 09:42:31 +01:00

40 lines
844 B
C++

/**
* GAL Test Scenarios
*
* Defines test scenarios for visual regression testing of GAL rendering.
* These scenarios use KiCad's GAL API to test the rendering pipeline.
*/
#ifndef GAL_TEST_SCENARIOS_H
#define GAL_TEST_SCENARIOS_H
// Forward declaration
namespace KIGFX {
class GAL;
}
namespace GALTest {
/**
* Get the number of test scenarios
*/
int GetScenarioCount();
/**
* Get the name of a scenario
*/
const char* GetScenarioName(int index);
/**
* Render a scenario using KiCad's GAL API
*
* @param gal Pointer to the GAL instance (OPENGL_GAL or WEBGL_GAL)
* @param index Scenario index
* @param width Canvas width in logical pixels
* @param height Canvas height in logical pixels
*/
void RenderScenario(KIGFX::GAL* gal, int index, int width, int height);
} // namespace GALTest
#endif // GAL_TEST_SCENARIOS_H