test(spellcheck): a page with a line that is only a ruled stroke checks without crashing #63

Merged
jfro merged 1 commit from test/ruled-only-page into main 2026-10-31 20:31:10 +00:00
Owner

Follow-up to #61: fixes InkAlign.prepare crash on ruled-only lines.

On main e1dfb68, checking spelling on a page where one line holds nothing but a ruled stroke (an underline on its own) crashed the check: InkAlign.prepare/3 dropped the :rule strokes, was left with an empty line and Enum.min([]) raised Enum.EmptyError (reached from DocumentLive → InkMarks.marks → WordBoxes → InkAlign.align). #61 removed InkAlign, WordBoxes and InkMarks, so the crash is gone on main; this adds a regression test so it stays covered.

  • New DocumentLive test, "checks a page with a line that's only a ruled stroke": a synthetic page (two lines of block-stroke "words" with a flat underline on its own line between them) and a transcription with one word more than the ink's gaps, with spellcheck on. It renders the hit list and the transcription underlines.
  • Shown failing on e1dfb68 with the same patch applied: Enum.EmptyError at ink_align.ex:295 in prepare/3, test 0/1. Passes on main 22e85cc.
  • Audit of what's left on the ruled-stroke path for min/max/hd on a possibly empty list: Lines.SVG (min_y/max_y/text_bottom use defaults, item/1 skips strokes with no points, simplify/1 always keeps a point), Lines.Scene, Spellcheck.Words/LanguageTool and assets/js/hooks/spelling.js (checks the text matches and skips empty ranges). Nothing unguarded, so no code changes.

mix precommit: 1021 passed, 1 excluded (live LanguageTool).

Tests only; no UI change.

Follow-up to #61: fixes InkAlign.prepare crash on ruled-only lines. On main e1dfb68, checking spelling on a page where one line holds nothing but a ruled stroke (an underline on its own) crashed the check: `InkAlign.prepare/3` dropped the `:rule` strokes, was left with an empty line and `Enum.min([])` raised `Enum.EmptyError` (reached from `DocumentLive` → `InkMarks.marks` → `WordBoxes` → `InkAlign.align`). #61 removed InkAlign, WordBoxes and InkMarks, so the crash is gone on main; this adds a regression test so it stays covered. - New `DocumentLive` test, "checks a page with a line that's only a ruled stroke": a synthetic page (two lines of block-stroke "words" with a flat underline on its own line between them) and a transcription with one word more than the ink's gaps, with spellcheck on. It renders the hit list and the transcription underlines. - Shown failing on e1dfb68 with the same patch applied: `Enum.EmptyError` at `ink_align.ex:295` in `prepare/3`, test 0/1. Passes on main 22e85cc. - Audit of what's left on the ruled-stroke path for min/max/hd on a possibly empty list: `Lines.SVG` (`min_y`/`max_y`/`text_bottom` use defaults, `item/1` skips strokes with no points, `simplify/1` always keeps a point), `Lines.Scene`, `Spellcheck.Words`/`LanguageTool` and `assets/js/hooks/spelling.js` (checks the text matches and skips empty ranges). Nothing unguarded, so no code changes. `mix precommit`: 1021 passed, 1 excluded (live LanguageTool). Tests only; no UI change.
test(spellcheck): a page with a line that's only a ruled stroke checks without crashing
All checks were successful
CI / test (pull_request) Successful in 1m3s
fe6578b919
Regression test for the InkAlign.prepare Enum.EmptyError on main e1dfb68,
where a line holding only an underline left the ink aligner nothing to take
the minimum of. #61 removed InkAlign; this keeps the case covered.
jfro merged commit c256901d1c into main 2026-10-31 20:31:10 +00:00
jfro deleted branch test/ruled-only-page 2026-10-31 20:31:10 +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
jfro/rm-analyzer!63
No description provided.