diff --git a/tests/WHATWORKS.md b/tests/WHATWORKS.md index 1901dba..ebb94f8 100644 --- a/tests/WHATWORKS.md +++ b/tests/WHATWORKS.md @@ -11,7 +11,7 @@ Last updated: 2025-11-29 | Main App Load | WORKS | minimal_test.html loads and renders correctly | | Standalone Apps | WORKS | 10 standalone test apps | | wxGrid | WORKS | Grid renders with cells, labels, and event handling | -| wxTreeCtrl | BROKEN | Crashes on startup | +| wxTreeCtrl | WORKS | Tree renders with expand/collapse, selection, add/delete items | | wxTimer | PARTIAL | Timer test app works, some tests have coordinate issues | | wxDialog | WORKS | Modal dialogs render correctly with Asyncify | @@ -87,13 +87,13 @@ This section maps KiCad's wxWidgets usage to our test coverage. --- -## BROKEN Features +## Previously BROKEN Features (Now Fixed) -### wxTreeCtrl - CRASHES -- **Status**: Standalone tree_test crashes on startup +### wxTreeCtrl - WORKS ✓ +- **Status**: Tree control fully functional with expand/collapse, selection, add/delete - **KiCad Impact**: HIGH - KiCad uses wxTreeCtrl for hierarchy browsers, component trees -- **Evidence**: tree-01-loaded.png shows red error "Exception thrown, see JavaScript console" -- **Note**: May have similar root cause to the wxGrid crash (event handling during initialization) +- **Evidence**: tree-01-loaded.png shows tree with KiCad-like hierarchy +- **Fix**: Added null guard in LogEvent() - events fired before m_log was initialized ### wxMessageBox/wxDialog - WORKING ✓ - **Status**: Modal dialogs render correctly with Asyncify @@ -125,7 +125,7 @@ Organized in `wasm-app/standalone/` folders: | grid/grid_test | WORKS | 2/2 | Property grids | | dialog/dialog_test | WORKS | 5/5 | Alerts/confirmations | | timer/timer_test | PARTIAL | 1/4 | Auto-save, animations | -| tree/tree_test | BROKEN | 0/7 | Hierarchy browsers | +| tree/tree_test | WORKS | 7/7 | Hierarchy browsers | --- @@ -192,17 +192,17 @@ Organized in `wasm-app/standalone/` folders: 8. Drawing/painting (wxDC, mouse events) 9. **wxMessageBox/wxDialog** - Modal dialogs with Asyncify 10. **wxGrid** - Property grids with cells, labels, and events +11. **wxTreeCtrl** - Hierarchy browsers with expand/collapse, selection, add/delete ### Needs Work for KiCad 1. **wxClipboard** - Copy/paste (browser limitations) ### Untested for KiCad -1. wxTreeCtrl (hierarchy browser) -2. wxDataViewCtrl (advanced lists) -3. wxRichTextCtrl (formatted text) -4. wxStyledTextCtrl (code editor) -5. Printing support -6. Drag and drop +1. wxDataViewCtrl (advanced lists) +2. wxRichTextCtrl (formatted text) +3. wxStyledTextCtrl (code editor) +4. Printing support +5. Drag and drop --- diff --git a/tests/baseline-screenshots/tree-01-loaded.png b/tests/baseline-screenshots/tree-01-loaded.png index 58e7edd..8c57d36 100644 Binary files a/tests/baseline-screenshots/tree-01-loaded.png and b/tests/baseline-screenshots/tree-01-loaded.png differ diff --git a/tests/baseline-screenshots/tree-02-hierarchy.png b/tests/baseline-screenshots/tree-02-hierarchy.png index 58e7edd..8c57d36 100644 Binary files a/tests/baseline-screenshots/tree-02-hierarchy.png and b/tests/baseline-screenshots/tree-02-hierarchy.png differ diff --git a/tests/baseline-screenshots/tree-03-selected.png b/tests/baseline-screenshots/tree-03-selected.png index 58e7edd..1581a91 100644 Binary files a/tests/baseline-screenshots/tree-03-selected.png and b/tests/baseline-screenshots/tree-03-selected.png differ diff --git a/tests/baseline-screenshots/tree-04-expanded.png b/tests/baseline-screenshots/tree-04-expanded.png index 58e7edd..8d69b23 100644 Binary files a/tests/baseline-screenshots/tree-04-expanded.png and b/tests/baseline-screenshots/tree-04-expanded.png differ diff --git a/tests/baseline-screenshots/tree-05-collapsed.png b/tests/baseline-screenshots/tree-05-collapsed.png index 58e7edd..ad22156 100644 Binary files a/tests/baseline-screenshots/tree-05-collapsed.png and b/tests/baseline-screenshots/tree-05-collapsed.png differ diff --git a/tests/baseline-screenshots/tree-06-added.png b/tests/baseline-screenshots/tree-06-added.png index 58e7edd..aca1253 100644 Binary files a/tests/baseline-screenshots/tree-06-added.png and b/tests/baseline-screenshots/tree-06-added.png differ diff --git a/tests/baseline-screenshots/tree-07-deleted.png b/tests/baseline-screenshots/tree-07-deleted.png index 58e7edd..23b88b0 100644 Binary files a/tests/baseline-screenshots/tree-07-deleted.png and b/tests/baseline-screenshots/tree-07-deleted.png differ diff --git a/tests/e2e/tree.spec.ts b/tests/e2e/tree.spec.ts index 16acb11..a1cf168 100644 --- a/tests/e2e/tree.spec.ts +++ b/tests/e2e/tree.spec.ts @@ -55,8 +55,8 @@ test.describe('wxTreeCtrl Tests', () => { const canvas = page.locator('canvas'); - // Click Expand All button - await canvas.click({ position: { x: 80, y: 95 } }); + // Click Expand All button (buttons are centered, at approximately y=90) + await canvas.click({ position: { x: 455, y: 90 } }); await page.waitForTimeout(500); await page.screenshot({ path: 'test-results/tree-04-expanded.png' }); @@ -72,8 +72,8 @@ test.describe('wxTreeCtrl Tests', () => { const canvas = page.locator('canvas'); - // Click Collapse All button - await canvas.click({ position: { x: 200, y: 95 } }); + // Click Collapse All button (buttons are centered, at approximately y=90) + await canvas.click({ position: { x: 545, y: 90 } }); await page.waitForTimeout(500); await page.screenshot({ path: 'test-results/tree-05-collapsed.png' }); @@ -89,12 +89,12 @@ test.describe('wxTreeCtrl Tests', () => { const canvas = page.locator('canvas'); - // First select an item - await canvas.click({ position: { x: 100, y: 160 } }); + // First select an item (tree starts around y=120) + await canvas.click({ position: { x: 100, y: 140 } }); await page.waitForTimeout(300); - // Click Add Item button - await canvas.click({ position: { x: 310, y: 95 } }); + // Click Add Item button (buttons are centered, at approximately y=90) + await canvas.click({ position: { x: 680, y: 90 } }); await page.waitForTimeout(500); await page.screenshot({ path: 'test-results/tree-06-added.png' }); @@ -110,12 +110,12 @@ test.describe('wxTreeCtrl Tests', () => { const canvas = page.locator('canvas'); - // First select an item (not root) - await canvas.click({ position: { x: 150, y: 200 } }); + // First select an item (not root) - select "Schematic" which is around y=145 + await canvas.click({ position: { x: 80, y: 145 } }); await page.waitForTimeout(300); - // Click Delete Selected button - await canvas.click({ position: { x: 440, y: 95 } }); + // Click Delete Selected button (buttons are centered, at approximately y=90) + await canvas.click({ position: { x: 780, y: 90 } }); await page.waitForTimeout(500); await page.screenshot({ path: 'test-results/tree-07-deleted.png' }); diff --git a/tests/wasm-app/standalone/tree/tree_test.cpp b/tests/wasm-app/standalone/tree/tree_test.cpp index 5a75387..3635bb4 100644 --- a/tests/wasm-app/standalone/tree/tree_test.cpp +++ b/tests/wasm-app/standalone/tree/tree_test.cpp @@ -170,6 +170,9 @@ void TreeTestFrame::PopulateTree() void TreeTestFrame::LogEvent(const wxString& msg) { + // Guard against events firing before m_log is initialized + if (!m_log) + return; m_log->AppendText(msg + "\n"); SetStatusText(msg);