summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMartin Haug <mhaug@live.de>2021-12-18 18:04:26 +0100
committerMartin Haug <mhaug@live.de>2021-12-26 15:59:24 +0100
commitb22ce6f8b84e0a75d162feb6f3699e26f86f2453 (patch)
tree76c564484d2d020d23ffbb75b133fc8bacae9454 /tests
parentf6c7a8292dc1ab0560408fca9d74505e9d7cf13a (diff)
Introduce equal-width columns
Diffstat (limited to 'tests')
-rw-r--r--tests/ref/layout/columns.pngbin0 -> 42011 bytes
-rw-r--r--tests/typ/layout/columns.typ97
2 files changed, 97 insertions, 0 deletions
diff --git a/tests/ref/layout/columns.png b/tests/ref/layout/columns.png
new file mode 100644
index 00000000..a1aee61c
--- /dev/null
+++ b/tests/ref/layout/columns.png
Binary files differ
diff --git a/tests/typ/layout/columns.typ b/tests/typ/layout/columns.typ
new file mode 100644
index 00000000..b6019a8a
--- /dev/null
+++ b/tests/typ/layout/columns.typ
@@ -0,0 +1,97 @@
+// Test the column layouter.
+
+---
+// Test columns for a sized page.
+#set page(height: 4.3cm, width: 7.05cm, columns: 2)
+
+Lorem ipsum dolor sit amet is a common blind text
+and I again am in need of filling up this page so I'm
+returning to this trusty tool of tangible terror.
+Sure, it is not the most creative way of filling up
+a page for a test but it does get the job done.
+
+---
+// Test the `columns` function.
+#set page(width: auto)
+
+#rect(width: 180pt, height: 100pt, padding: 8pt, columns(2, [
+ A special plight has befallen our document.
+ Columns in text boxes reigned down unto the soil
+ to waste a year's crop of rich layouts.
+ The columns at least were graciously balanced.
+]))
+
+---
+// Test more than two columns.
+#set page(height: 2cm, width: 7.05cm, columns: 3)
+#set par(align: center)
+
+#circle(fill: eastern)
+#circle(fill: conifer)
+#circle(fill: eastern)
+
+---
+// Test setting a column gutter.
+#set page(height: 3.25cm, width: 7.05cm, columns: 2, column-gutter: 30pt)
+
+#rect(width: 100%, height: 2.5cm, fill: conifer)
+#rect(width: 100%, height: 2cm, fill: eastern)
+
+---
+// Test RTL columns.
+#set page(height: 3.25cm, width: 7.05cm, columns: 2, column-gutter: 30pt)
+#set text("Noto Sans Arabic", serif)
+#set par(lang: "ar")
+
+#rect(fill: conifer, height: 8pt, width: 6pt) وتحفيز
+العديد من التفاعلات الكيميائية. (DNA) من أهم الأحماض النووية التي تُشكِّل
+إلى جانب كل من البروتينات والليبيدات والسكريات المتعددة
+#rect(fill: eastern, height: 8pt, width: 6pt)
+الجزيئات الضخمة الأربعة الضرورية للحياة.
+---
+// Test the `colbreak` function.
+#set page(height: 1cm, width: 7.05cm, columns: 2)
+
+A
+#colbreak()
+#colbreak()
+B
+#colbreak()
+C
+
+---
+// Test an empty second column.
+#set page(width: 7.05cm, columns: 2)
+
+#rect(width: 100%, padding: 3pt)[So there isn't anything in the second column?]
+
+---
+// Test columns when one of them is empty.
+#set page(width: auto, columns: 3)
+
+The page can grow as much as it wants horizontally.
+
+---
+// Test columns in an infinitely wide frame.
+#set page(width: 7.05cm, columns: 2)
+
+There can be as much content as you want in the left column
+and the document will grow with it.
+
+#rect(fill: conifer, width: 100%, height: 30pt)
+
+Only an explicit #colbreak() `#colbreak()` can put content in the
+second column.
+
+---
+// Test a page with a single column.
+#set page(height: auto, width: 7.05cm, columns: 1)
+
+This is a normal page. Very normal.
+
+---
+// Test a page with zero columns.
+#set page(height: auto, width: 7.05cm, columns: 0)
+
+This makes less sense but will still
+produce a normal page.