Skip to content

test: add H1-H3 kitty PNG extraction integration test#10

Merged
rrbe merged 3 commits into
masterfrom
test/heading-png-extraction
May 22, 2026
Merged

test: add H1-H3 kitty PNG extraction integration test#10
rrbe merged 3 commits into
masterfrom
test/heading-png-extraction

Conversation

@rrbe
Copy link
Copy Markdown
Owner

@rrbe rrbe commented May 22, 2026

Summary

  • Adds fixtures/headings.md (one H1 + one H2 + one H3) and tests/headings.rs
  • Test walks the binary's stdout for Kitty graphics APC frames (ESC _ G … ; <chunk> ESC \), concatenates m=1 chunks, base64-decodes, and decodes the resulting PNG with the image crate
  • Asserts: exactly 3 PNGs extracted; each has non-zero dimensions; each has at least one non-fully-transparent pixel; pixel heights strictly descend (H1 > H2 > H3), matching the 96/72/56 font-size config in style.rs

Covers TEST_PLAN.md Phase 2 (protocol detection + payload extraction + PNG decode + basic image-property asserts + level-size ordering). Phase 3 (pixel-level golden hashes) is intentionally still deferred until the heading font environment is stabilized.

Test plan

  • make check passes locally (73 unit + 9 cli + 5 snapshot + 1 new headings)

rrbe and others added 3 commits May 22, 2026 15:00
Covers TEST_PLAN.md Phase 2: extracts base64 PNG payloads from Kitty
graphics APC frames in the binary's stdout, decodes them with the image
crate, and asserts each heading level produces a non-empty, non-fully-
transparent PNG whose pixel height matches the H1 > H2 > H3 font-size
ordering.
- Extract tests/common/mod.rs with binary_path + run_termdown helper,
  used by both headings.rs and snapshots.rs.
- Panic with a clear message when an APC frame is missing its ESC \
  terminator, instead of silently feeding truncated bytes to base64.
- Assert the display-form kitty header (\x1b_Gf=100,a=T) appears in
  stdout, guarding against regression to the a=t TUI-cache form.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@rrbe rrbe merged commit 4c590ac into master May 22, 2026
5 checks passed
@rrbe rrbe deleted the test/heading-png-extraction branch May 22, 2026 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant