review fixes: word-wrap hard-break, title-align, ASDF fix, edge cases
Fixes from subagent review: - Word-wrap now hard-breaks words exceeding max-width (was returning un-truncated overflow strings) - Box zero-size guard now catches any zero/single dimension (was only catching both zero together) - Title-align now respected (:left/:center/:right) with proper positioning - render-text declares (ignore spans) to suppress unused warning - ASDF test-op fixed: run! → run-tests (symbol didn't exist) - New test: box-single-column (width=1 renders nothing) - Tightened word-wrap test: verifies hard-break produces both chunks - Simplified word-wrap with cond instead of nested if/progn (avoided recurring paren-balance issue)
This commit is contained in:
@@ -66,7 +66,7 @@
|
||||
(is-false (search "┌" out) "no top-left corner")))))
|
||||
|
||||
(test box-zero-size
|
||||
"A zero-size box renders nothing"
|
||||
"A box with any zero dimension renders nothing"
|
||||
(multiple-value-bind (b s) (make-capturing-backend)
|
||||
(let ((bx (make-box :border-style :single :width 0 :height 0)))
|
||||
(compute-layout (box-layout-node bx) 0 0)
|
||||
@@ -74,6 +74,15 @@
|
||||
(is (string= (get-output-stream-string s) "")
|
||||
"zero-size box produces no output"))))
|
||||
|
||||
(test box-single-column
|
||||
"A box with width 1 renders nothing (needs min 2 for border)"
|
||||
(multiple-value-bind (b s) (make-capturing-backend)
|
||||
(let ((bx (make-box :border-style :single :width 1 :height 5)))
|
||||
(compute-layout (box-layout-node bx) 1 5)
|
||||
(render-box bx b)
|
||||
(is (string= (get-output-stream-string s) "")
|
||||
"width=1 box renders nothing"))))
|
||||
|
||||
(test box-minimum-size
|
||||
"A box with minimum non-zero size still renders"
|
||||
(multiple-value-bind (b s) (make-capturing-backend)
|
||||
@@ -131,13 +140,14 @@
|
||||
(is (search "new" out) "third line")))))
|
||||
|
||||
(test text-word-wrap-single-word
|
||||
"Text wraps even a single word if it exceeds width"
|
||||
"A word longer than width is hard-broken at max-width"
|
||||
(multiple-value-bind (b s) (make-capturing-backend)
|
||||
(let ((tx (make-text "Hello" :width 3 :height 3)))
|
||||
(compute-layout (text-layout-node tx) 3 3)
|
||||
(render-text tx b)
|
||||
(let ((out (get-output-stream-string s)))
|
||||
(is (search "Hel" out) "word truncated to width")))))
|
||||
(is (search "Hel" out) "first chunk is Hel")
|
||||
(is (search "lo" out) "second chunk is lo")))))
|
||||
|
||||
(test span-creates-with-attributes
|
||||
"A span has text and optional style attributes"
|
||||
|
||||
Reference in New Issue
Block a user