aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-10-18 12:36:39 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2023-10-18 12:36:39 +0200
commit8b3a59bcd4b4b359cac2aa9b48b184d056c03dda (patch)
tree6138466ba8e706df0eb6d3950427159435b1335a
parentAdd final xdg basedir test. (diff)
downloadcalp-8b3a59bcd4b4b359cac2aa9b48b184d056c03dda.tar.gz
calp-8b3a59bcd4b4b359cac2aa9b48b184d056c03dda.tar.xz
Add tests for (text flow).
-rw-r--r--tests/unit/text/text-flow.scm28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/unit/text/text-flow.scm b/tests/unit/text/text-flow.scm
new file mode 100644
index 00000000..3304c387
--- /dev/null
+++ b/tests/unit/text/text-flow.scm
@@ -0,0 +1,28 @@
+(define-module (test text-flow)
+ :use-module (srfi srfi-1)
+ :use-module (srfi srfi-64)
+ :use-module (srfi srfi-71)
+ :use-module (text flow))
+
+
+(define str "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.")
+
+(test-group "String lengths"
+ (let ((final init (car+cdr (reverse (flow-text str)))))
+ (test-assert (>= 70 (string-length final)))
+ (test-assert (every (lambda (s) (= 70 (string-length s)))
+ init))))
+
+;;; This could be fixed by actually supporting hyphenation
+(test-equal "Justification with words longer than the line width"
+ ;; This also shows bad spacing
+ '("A sentance containing the word"
+ ;; This line is longer that the expected line width.
+ "pneumonoultramicroscopicsilicovolcanoconiosis"
+ "is rather hard to justify properly")
+ (flow-text "A sentance containing the word pneumonoultramicroscopicsilicovolcanoconiosis is rather hard to justify properly"
+ width: 40)
+ )
+
+
+'((text flow))