Add headless regression tests for Prop Editor functionality

- Implement tests for PropFile, including preset conversion, file dictionary conversion, round-trip serialization, version rejection, default values for missing keys, flattening, sanitization, and save/load functionality.
- Create tests for PropEditor, covering window title formatting, mode button text, safe saving, and recent file list management.
- Add tests for PropTheme, validating fallback behavior, invalid input handling, and default values for primitives and UI tokens.
- Introduce tests for ThumbnailCache, ensuring proper key formatting, PNG handling, and behavior with missing files.
This commit is contained in:
2026-09-19 21:26:03 -04:00
parent db4ff8d939
commit b66ded5f60
34 changed files with 7021 additions and 2 deletions
+52
View File
@@ -0,0 +1,52 @@
# Phase 9 Prop Editor — Round 4 (Selection Feedback, Bigger Defaults, Status/Menus, New Flow)
Status: **implemented** (2026-09-19; direct UI round — no open design choices; all nine
feedback points applied).
Source: nine user feedback points against the shipped Round 3 Prop Editor.
## Feedback summary (verbatim intent)
1. The Arrange/Reshape selected state was invisible right after clicking until the cursor
moved away; make the selected button clearly outlined.
2. Mode buttons, File/View menu bar, and menu items need bigger defaults — theme-adjustable.
3. Inspector fonts and the Prop Name input need bigger defaults — theme-adjustable.
4. Swap the status bar: title left, (X, Y) coordinates right; bigger default text.
5. Remove the "Ball" shape — circle covers it.
6. RMB context menus need a bigger default font — theme-adjustable.
7. When the cursor leaves the canvas frame, coordinates read "X: -, Y: -" instead of blank.
8. Replace Edit → Configure Grid / Snap with a grid-size spinbox + snap toggle on the right
side of the menu bar row (sandbox-stage pattern).
9. Replace File → Clear with File → New at the top of the File menu, prompting to save edited
props first.
## Diagnoses
- **Point 1 (selection invisibility):** the Button `focus` stylebox draws after `pressed`, and
the theme set `focus` = same style as `normal`, masking the pressed look until focus left
(cursor moved away). Fix: mode buttons use `focus_mode = FOCUS_NONE`, and the theme's Button
`pressed` stylebox now has an accent-colored 2 px border (`panel_pressed`) so the selected
mode reads as an outlined box.
## Changes
| Target | Change |
| --- | --- |
| `prop_theme.json` + `scripts/prop_theme.gd` | Defaults bumped: body 18, header 24, menu 22, menu_bar 22, mode 26, status 18; new tokens `ui.fonts.prop_name` (20) and `ui.fonts.context_menu` (22); `mode_button_min_height` 44 → 56. All remain theme-adjustable. |
| `scripts/prop_canvas.gd` | Removed the "Add Ball" context-menu item (the `"ball"` primitive stays programmatically available); new `set_context_menu_font_size(size)` applies a font-size override to the RMB menu. |
| `scripts/prop_editor.gd` | `panel_pressed` accent-border stylebox; mode buttons `FOCUS_NONE`; `LineEdit` theme font + `font_prop_name` override on the name edit; status bar text swapped (title left via `%SaveStatus`, coords right via `%CursorCoords`) with "X: - Y: -" fallback; `PRIMITIVE_IDS/LABELS` drop "ball"; context-menu font wired from `font_context_menu`; top-right `Grid:` label + SpinBox + `Snap` CheckBox built in `%TopRightControls` (grid dialog + Edit menu removed); File menu is now 🆕 New / 💾 Save / 📄 Save As… / 📂 Load…; `_request_new()` reuses the unsaved-changes dialog (`_pending_new` flag; Save → save-then-new, Discard → new, Cancel → stay); `_do_new()` replaces the old clear flow. |
| `scenes/prop_editor.tscn` | New `%TopRow` HBox (y 0..32) containing `%MenuBar` (expand) + `%TopRightControls`; status bar children swapped (`%SaveStatus` left, `%CursorCoords` right); `%ClearConfirmDialog` removed. |
| `tests/test_prop_editor_theme.gd` | Updated to the new font/height defaults + new tokens. |
## Verification
- `--check-only` clean on all four scripts; all five headless suites green
(file 64, theme 53, canvas 87, thumb 10, round3 17); scene smoke (instantiate + title) passes.
- Manual F6: selected-mode outline; font sizes; swapped status bar with dashes; grid/snap
controls on the menu row; File → New save prompt; no Ball in any Add menu.
## Notes / tech debt
- Recorded in `docs/tech_debt_and_optimizations.md` (row 32): mode buttons drop keyboard focus
(`FOCUS_NONE`) so the focus stylebox can't mask the pressed state — revisit if keyboard
accessibility for the mode toggle is ever required.