refactor(tui): add lib.rs, test harness, and image rendering fixes #113

Merged
claude-desktop merged 1 commit from tui/test-harness-fixes into main 2026-04-12 18:40:10 +00:00
Collaborator

Summary

  • Add lib.rs library target for integration test support
  • Shared testing.rs module: test_ctx(), MockRenderer, key helpers
  • Fix Kitty renderer: deferred output buffer prevents stdout race with ratatui
  • Fix gallery detail: last_rendered cache guard prevents infinite render spam
  • 9 integration tests covering navigation, render guard, and Kitty buffering

Prerequisite for #110, #111, #112.

Test plan

  • cargo test -p loom-tui — 173 tests pass (164 unit + 9 integration)
  • cargo clippy -p loom-tui -- -D warnings — clean
  • Manual: verify gallery detail image renders in Kitty without flicker

🤖 Generated with Claude Code

## Summary - Add `lib.rs` library target for integration test support - Shared `testing.rs` module: `test_ctx()`, `MockRenderer`, key helpers - Fix Kitty renderer: deferred output buffer prevents stdout race with ratatui - Fix gallery detail: `last_rendered` cache guard prevents infinite render spam - 9 integration tests covering navigation, render guard, and Kitty buffering Prerequisite for #110, #111, #112. ## Test plan - [x] `cargo test -p loom-tui` — 173 tests pass (164 unit + 9 integration) - [x] `cargo clippy -p loom-tui -- -D warnings` — clean - [ ] Manual: verify gallery detail image renders in Kitty without flicker 🤖 Generated with [Claude Code](https://claude.com/claude-code)
refactor(tui): add lib.rs, test harness, and image rendering fixes
Some checks failed
QA / qa (pull_request) Has been cancelled
76bb36a09d
- Add lib.rs library target alongside the binary for integration test
  support. Move mod declarations from main.rs to lib.rs.
- Add testing.rs with shared test_ctx(), MockRenderer, key helpers.
  Deduplicate test_ctx() from 3 screen files.
- Add public accessors to App: process_event(), drain_actions(),
  current_screen(), screen_mut(), overlay_count().
- Fix Kitty renderer: buffer escape sequences in pending_output instead
  of writing directly to stdout. Flush after terminal.draw() completes
  to prevent interleaving with ratatui's buffered output.
- Fix gallery detail infinite render: add last_rendered cache guard to
  DetailState, skip redundant render_image() calls. Invalidate on
  zoom, pan, and selection change.
- Add flush_pending() to ImageRenderer trait (default no-op).
- Add 9 integration tests covering arrow navigation, render guard,
  mock renderer, and Kitty buffering.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
claude-desktop deleted branch tui/test-harness-fixes 2026-04-12 18:40:11 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/loom!113
No description provided.