Add standalone test apps and Playwright specs for wxWidgets WASM

- Add 10 standalone test apps for isolated component testing:
  - menu, toolbar, layout, aui, clipboard, filedialog, grid
  - dialog, timer, tree (3 new)
- Add 12 Playwright e2e test specs for automated testing
- Update Makefile with GL/non-GL build configurations
- Update build script to list all standalone tests
- Add WHATWORKS.md documenting KiCad wxWidgets coverage
- Update .gitignore for build artifacts

Test results:
- 79 Playwright tests pass
- wxGrid crashes (memory access out of bounds)
- wxTreeCtrl crashes (similar issue)
- wxDialog/wxMessageBox events fire but no visual popup

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Viktor Vaczi 2025-11-29 16:19:13 +01:00
commit 53e4603a41
26 changed files with 5070 additions and 30 deletions

View file

@ -1,45 +1,143 @@
# Makefile for wxWidgets WASM test app with OpenGL support
# Uses the local wxWidgets build with legacy GL emulation
# Makefile for wxWidgets WASM test apps
# Uses the local wxWidgets build
WXCONFIG = ../../build-wasm/wxwidgets-universal/wx-config
TOOLS_ROOT = ../../wxwidgets/build/wasm
CXX = em++
WX_CXXFLAGS := $(shell $(WXCONFIG) --cxxflags)
# Include GL library for OpenGL tests
WX_LDFLAGS := $(shell $(WXCONFIG) --libs base,core,gl)
TARGET = minimal_test
SOURCES = minimal_test.cpp
# Libraries for GL apps (minimal_test uses OpenGL)
WX_LDFLAGS_GL := $(shell $(WXCONFIG) --libs base,core,gl,aui)
# Libraries for non-GL apps (standalone tests don't need GL)
WX_LDFLAGS_NOGL := $(shell $(WXCONFIG) --libs base,core,aui)
CXXFLAGS = -O2 $(WX_CXXFLAGS)
# Emscripten flags:
# -sLEGACY_GL_EMULATION: Enable legacy OpenGL (glBegin/glEnd, etc.) emulation on WebGL
# -sMAX_WEBGL_VERSION=2: Enable WebGL 2.0 support (required since wxGLCanvas requests WebGL 2)
# Note: Cannot combine LEGACY_GL_EMULATION with FULL_ES2 - they are mutually exclusive
EM_GL_FLAGS = -sLEGACY_GL_EMULATION -sMAX_WEBGL_VERSION=2
# Base Emscripten flags (for all apps)
BASE_LDFLAGS = -sALLOW_MEMORY_GROWTH -sERROR_ON_UNDEFINED_SYMBOLS=0 \
-s "EXPORTED_RUNTIME_METHODS=['HEAPU8','HEAP8','HEAP32']"
# GL immediate mode shim - fixes Emscripten's color-per-vertex requirement
# and provides missing glVertex2d/glColor4d implementations
# GL-specific flags
EM_GL_FLAGS = -sLEGACY_GL_EMULATION -sMAX_WEBGL_VERSION=2
GL_SHIM = ../../lib/gl_immediate_shim.js
LDFLAGS = -sALLOW_MEMORY_GROWTH -sERROR_ON_UNDEFINED_SYMBOLS=0 \
-s "EXPORTED_RUNTIME_METHODS=['HEAPU8','HEAP8','HEAP32']" \
$(EM_GL_FLAGS) --js-library=$(GL_SHIM) $(WX_LDFLAGS)
# LDFLAGS for GL apps (minimal_test)
LDFLAGS_GL = $(BASE_LDFLAGS) $(EM_GL_FLAGS) --js-library=$(GL_SHIM) $(WX_LDFLAGS_GL)
# LDFLAGS for non-GL apps (standalone tests)
LDFLAGS_NOGL = $(BASE_LDFLAGS) $(WX_LDFLAGS_NOGL)
JS = $(TOOLS_ROOT)/wx.js
HTML = $(TOOLS_ROOT)/template.html
all: $(TARGET).html
# Standalone directories
S = standalone
$(TARGET).o: $(SOURCES)
all: minimal_test.html \
$(S)/menu/menu_test.html \
$(S)/clipboard/clipboard_test.html \
$(S)/filedialog/filedialog_test.html \
$(S)/layout/layout_test.html \
$(S)/aui/aui_test.html \
$(S)/toolbar/toolbar_test.html \
$(S)/grid/grid_test.html \
$(S)/dialog/dialog_test.html \
$(S)/timer/timer_test.html \
$(S)/tree/tree_test.html
# Main test app (uses GL)
minimal_test.o: minimal_test.cpp
$(CXX) -c $(CXXFLAGS) $< -o $@
$(TARGET).html: $(TARGET).o
$(CXX) $(TARGET).o $(LDFLAGS) --pre-js $(JS) --shell-file $(HTML) -o $@
minimal_test.html: minimal_test.o
$(CXX) $< $(LDFLAGS_GL) --pre-js $(JS) --shell-file $(HTML) -o $@
# Menu test (no GL)
$(S)/menu/menu_test.o: $(S)/menu/menu_test.cpp
$(CXX) -c $(CXXFLAGS) $< -o $@
$(S)/menu/menu_test.html: $(S)/menu/menu_test.o
$(CXX) $< $(LDFLAGS_NOGL) --pre-js $(JS) --shell-file $(HTML) -o $@
# Clipboard test (no GL)
$(S)/clipboard/clipboard_test.o: $(S)/clipboard/clipboard_test.cpp
$(CXX) -c $(CXXFLAGS) $< -o $@
$(S)/clipboard/clipboard_test.html: $(S)/clipboard/clipboard_test.o
$(CXX) $< $(LDFLAGS_NOGL) --pre-js $(JS) --shell-file $(HTML) -o $@
# FileDialog test (no GL)
$(S)/filedialog/filedialog_test.o: $(S)/filedialog/filedialog_test.cpp
$(CXX) -c $(CXXFLAGS) $< -o $@
$(S)/filedialog/filedialog_test.html: $(S)/filedialog/filedialog_test.o
$(CXX) $< $(LDFLAGS_NOGL) --pre-js $(JS) --shell-file $(HTML) -o $@
# Layout test (no GL)
$(S)/layout/layout_test.o: $(S)/layout/layout_test.cpp
$(CXX) -c $(CXXFLAGS) $< -o $@
$(S)/layout/layout_test.html: $(S)/layout/layout_test.o
$(CXX) $< $(LDFLAGS_NOGL) --pre-js $(JS) --shell-file $(HTML) -o $@
# AUI test (no GL)
$(S)/aui/aui_test.o: $(S)/aui/aui_test.cpp
$(CXX) -c $(CXXFLAGS) $< -o $@
$(S)/aui/aui_test.html: $(S)/aui/aui_test.o
$(CXX) $< $(LDFLAGS_NOGL) --pre-js $(JS) --shell-file $(HTML) -o $@
# Toolbar test (no GL)
$(S)/toolbar/toolbar_test.o: $(S)/toolbar/toolbar_test.cpp
$(CXX) -c $(CXXFLAGS) $< -o $@
$(S)/toolbar/toolbar_test.html: $(S)/toolbar/toolbar_test.o
$(CXX) $< $(LDFLAGS_NOGL) --pre-js $(JS) --shell-file $(HTML) -o $@
# Grid test (no GL)
$(S)/grid/grid_test.o: $(S)/grid/grid_test.cpp
$(CXX) -c $(CXXFLAGS) $< -o $@
$(S)/grid/grid_test.html: $(S)/grid/grid_test.o
$(CXX) $< $(LDFLAGS_NOGL) --pre-js $(JS) --shell-file $(HTML) -o $@
# Dialog test (no GL)
$(S)/dialog/dialog_test.o: $(S)/dialog/dialog_test.cpp
$(CXX) -c $(CXXFLAGS) $< -o $@
$(S)/dialog/dialog_test.html: $(S)/dialog/dialog_test.o
$(CXX) $< $(LDFLAGS_NOGL) --pre-js $(JS) --shell-file $(HTML) -o $@
# Timer test (no GL)
$(S)/timer/timer_test.o: $(S)/timer/timer_test.cpp
$(CXX) -c $(CXXFLAGS) $< -o $@
$(S)/timer/timer_test.html: $(S)/timer/timer_test.o
$(CXX) $< $(LDFLAGS_NOGL) --pre-js $(JS) --shell-file $(HTML) -o $@
# Tree test (no GL)
$(S)/tree/tree_test.o: $(S)/tree/tree_test.cpp
$(CXX) -c $(CXXFLAGS) $< -o $@
$(S)/tree/tree_test.html: $(S)/tree/tree_test.o
$(CXX) $< $(LDFLAGS_NOGL) --pre-js $(JS) --shell-file $(HTML) -o $@
# Convenience targets
menu: $(S)/menu/menu_test.html
clipboard: $(S)/clipboard/clipboard_test.html
filedialog: $(S)/filedialog/filedialog_test.html
layout: $(S)/layout/layout_test.html
aui: $(S)/aui/aui_test.html
toolbar: $(S)/toolbar/toolbar_test.html
grid: $(S)/grid/grid_test.html
dialog: $(S)/dialog/dialog_test.html
timer: $(S)/timer/timer_test.html
tree: $(S)/tree/tree_test.html
clean:
rm -f $(TARGET).o $(TARGET).html $(TARGET).js $(TARGET).wasm
rm -f minimal_test.o minimal_test.html minimal_test.js minimal_test.wasm
rm -f $(S)/*/*.o $(S)/*/*.html $(S)/*/*.js $(S)/*/*.wasm
.PHONY: all clean
.PHONY: all clean menu clipboard filedialog layout aui toolbar grid dialog timer tree