7 Commits

Author SHA1 Message Date
Calic
b8abc2895f chore: bump lib-core.panel dep to 0.4.0
Engine resolver does exact strcmp on dep versions, so consumer manifests
must pin the new lib-core.panel 0.4.0 to keep load-time resolution green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-15 03:04:59 +02:00
Calic
da1b37d47e chore: bump lib-core.panel dep to 0.3.0 2026-06-15 02:26:00 +02:00
Calic
2b0f70bc84 chore: bump lib-core.panel dep to 0.2.0
Track lib-core.panel v0.2.0 (multi-active panels with layout-slots).
No behavioral change in this consumer — the v0.1.1 call sites remain
compatible via the panel framework's bw-compat shim.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-15 01:46:42 +02:00
Calic
c590196b70 test: pcall-wrap panel-spy restoration in section 12
Wraps the section-12 test body in pcall so the panel-spy
restoration runs unconditionally. Prevents spy-state leaking into
subsequent tests if section-12 fails.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-14 19:53:05 +02:00
Calic
6f9ceebe66 test: v0.2.0 locale_factory + ctx_inner alias assertions
Three new TAP cases cover the locale_factory rollout:

- §10 Form-1 bw-compat: display.create(container) wraps the bare
  handle as a constant locale_factory; _test_get_locale returns the
  same handle, _test_get_rows still resolves single-source
  availability via the Form-1 shim.
- §11 Form-2 locale-factory: display.create(function() -> {sources,
  sink}) returns the locale table per frame; a recipe needing two
  templates split across two source-containers reports aggregate
  availability=true.
- §12 ctx_inner propagation: monkey-patching panel.show_context_menu
  captures the entries-table, then invokes the action callback with
  a dummy menu_ctx. Asserts ctx_inner.locale matches the resolved
  locale and ctx_inner.container points at locale.sink (Form-2) or
  the bare handle (Form-1).

Test count grows 9 -> 12. Added a fresh_container helper so the
multi-container fixtures in §11/§12 do not lose recipes via repeated
_test_clear_all calls.

Depends on lib-core.crafting-display v0.2.0 and lib-core.crafting
v0.2.0.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-14 19:43:59 +02:00
Calic
b88842161c test: add render-contract assertion
Adds a 9th assertion that drives widget.render(ctx) with a stub ctx
shaped per lib-core.panel's widget-lifecycle contract (bounds, theme
with packed-RGBA colours and font_size_body, is_focused) and verifies
the widget populates _render_rows correctly. Catches future drift
between this widget and the panel API.

engine.render.draw_text is registered but errors in test_mode (no
OpenGL context); the assertion stubs it for the duration of the
render call so the layout pass runs to completion without coupling
to the rendering backend.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-14 13:36:36 +02:00
Calic
0154f54fde feat: lib-core.crafting-display-test v0.1.0 — 8 TAP asserts
Test suite for lib-core.crafting-display v0.1.0. Covers:

  1. create returns widget_def with render, handle_input, title set
     from opts.
  2. register_action + unregister_action round-trip: action-count
     goes 0 -> 1 -> 0.
  3. Duplicate action label -> Loud-Error matching
     'crafting-display.register_action.*duplicate'.
  4. Non-function callback -> Loud-Error matching
     'crafting-display.register_action.*callback'.
  5. Default action-set is empty directly after create.
  6. Rows filtered via is_known: only known recipes appear in the
     per-frame row-list (one recipe is_known=false is hidden).
  7. Per-row availability flag matches can_craft.ok: container with
     1x rock makes a recipe needing rock available=true and a
     recipe needing missing stick available=false.
  8. Resolver overrides (set_icon_resolver / set_label_resolver /
     set_summary_resolver) actually take effect — backdoors return
     the overridden values.

Uses engine.test.assert with string.find for pattern matching
loud-error messages (engine.test has no assert_match helper).
Per-test isolation via crafting._test_clear_all; composition
templates are defined once at module-scope under namespace
craft_display_test.* (composition has no clear-all hook).

Depends on lib-core.crafting-display 0.1.0, lib-core.crafting
0.1.0, lib-core.panel 0.1.1, lib-core.inventory-list 0.1.0,
lib-core.composition 0.3.0 — all five declared directly per
engine's per-module non-transitive resolver.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-14 12:34:42 +02:00