diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-11-23 12:45:20 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-11-23 12:45:20 +0100 |
| commit | 4f9e5819bbab1f93ad4f4b789038c60487a76368 (patch) | |
| tree | 488a4e0422db4531d9882cf08f0b5cc21ae55a23 /tests | |
| parent | d3f6040cedacad1b6c323be721c9086f6c5d9a44 (diff) | |
2d alignments with plus operator
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/typ/elements/circle.typ | 6 | ||||
| -rw-r--r-- | tests/typ/elements/ellipse.typ | 2 | ||||
| -rw-r--r-- | tests/typ/elements/image.typ | 2 | ||||
| -rw-r--r-- | tests/typ/layout/align.typ | 16 | ||||
| -rw-r--r-- | tests/typ/layout/background.typ | 2 | ||||
| -rw-r--r-- | tests/typ/layout/move.typ | 2 | ||||
| -rw-r--r-- | tests/typ/layout/page.typ | 4 | ||||
| -rw-r--r-- | tests/typ/layout/placed.typ | 2 | ||||
| -rw-r--r-- | tests/typ/text/par.typ | 4 |
9 files changed, 29 insertions, 11 deletions
diff --git a/tests/typ/elements/circle.typ b/tests/typ/elements/circle.typ index 9590ef7b..2e97e985 100644 --- a/tests/typ/elements/circle.typ +++ b/tests/typ/elements/circle.typ @@ -10,12 +10,12 @@ Auto-sized circle. \ #circle(fill: rgb("eb5278"), thickness: 2pt, - align(center, horizon)[But, soft!] + align(center + horizon)[But, soft!] ) Center-aligned rect in auto-sized circle. #circle(fill: forest, stroke: conifer, - align(center, horizon, + align(center + horizon, rect(fill: conifer, pad(5pt)[But, soft!]) ) ) @@ -37,7 +37,7 @@ Expanded by height. --- // Test relative sizing. -#let centered(body) = align(center, horizon, body) +#let centered(body) = align(center + horizon, body) #font(fill: white) #rect(width: 100pt, height: 50pt, fill: rgb("aaa"), centered[ #circle(radius: 10pt, fill: eastern, centered[A]) // D=20pt diff --git a/tests/typ/elements/ellipse.typ b/tests/typ/elements/ellipse.typ index 4f1d3187..47f6d0e1 100644 --- a/tests/typ/elements/ellipse.typ +++ b/tests/typ/elements/ellipse.typ @@ -9,7 +9,7 @@ Rect in ellipse in fixed rect. \ #rect(width: 3cm, height: 2cm, fill: rgb("2a631a"), ellipse(fill: forest, rect(fill: conifer, - align(center, horizon)[ + align(center + horizon)[ Stuff inside an ellipse! ] ) diff --git a/tests/typ/elements/image.typ b/tests/typ/elements/image.typ index 84260a28..9d192b40 100644 --- a/tests/typ/elements/image.typ +++ b/tests/typ/elements/image.typ @@ -21,7 +21,7 @@ #image("../../res/tiger.jpg", width: 100%, height: 20pt, fit: "stretch") // Make sure the bounding-box of the image is correct. -#align(bottom, right, image("../../res/tiger.jpg", width: 40pt)) +#align(bottom + right, image("../../res/tiger.jpg", width: 40pt)) --- // Test all three fit modes. diff --git a/tests/typ/layout/align.typ b/tests/typ/layout/align.typ index c41e0cb4..4a50d3dc 100644 --- a/tests/typ/layout/align.typ +++ b/tests/typ/layout/align.typ @@ -7,7 +7,7 @@ align(center, square(size: 20pt, fill: eastern)), align(right, square(size: 15pt, fill: eastern)), ) -#align(center, horizon, rect(fill: eastern, height: 10pt)) +#align(center + horizon, rect(fill: eastern, height: 10pt)) #align(bottom, stack( align(center, rect(fill: conifer, height: 10pt)), rect(fill: forest, height: 10pt), @@ -19,3 +19,17 @@ Dolor ] + +--- +// Ref: false +#test(type(center), "alignment") +#test(type(horizon), "alignment") +#test(type(center + horizon), "2d alignment") + +--- +// Error: 8-22 cannot add two horizontal alignments +#align(center + right, [A]) + +--- +// Error: 8-20 cannot add two vertical alignments +#align(top + bottom, [A]) diff --git a/tests/typ/layout/background.typ b/tests/typ/layout/background.typ index 81c8c99d..6303a83b 100644 --- a/tests/typ/layout/background.typ +++ b/tests/typ/layout/background.typ @@ -13,6 +13,6 @@ height: 100% + 20pt, ) ) -#align(bottom, right)[ +#align(bottom + right)[ _Welcome to_ #underline[*Tigerland*] ] diff --git a/tests/typ/layout/move.typ b/tests/typ/layout/move.typ index a7cdf368..c1f97e15 100644 --- a/tests/typ/layout/move.typ +++ b/tests/typ/layout/move.typ @@ -2,7 +2,7 @@ #let tex = [{ [T] h(-0.14 * size) - move(dy: 0.22 * size)[E] + move(y: 0.22 * size)[E] h(-0.12 * size) [X] }] diff --git a/tests/typ/layout/page.typ b/tests/typ/layout/page.typ index 1f707327..dc6c7c81 100644 --- a/tests/typ/layout/page.typ +++ b/tests/typ/layout/page.typ @@ -9,8 +9,8 @@ // Set all margins at once. [ #page(margins: 5pt) - #place(top, left)[TL] - #place(bottom, right)[BR] + #place(top + left)[TL] + #place(bottom + right)[BR] ] // Set individual margins. diff --git a/tests/typ/layout/placed.typ b/tests/typ/layout/placed.typ index 41431dee..da56ae2d 100644 --- a/tests/typ/layout/placed.typ +++ b/tests/typ/layout/placed.typ @@ -1,5 +1,5 @@ #page("a8") -#place(bottom, center)[© Typst] +#place(bottom + center)[© Typst] = Placement #place(right, image("../../res/tiger.jpg", width: 1.8cm)) diff --git a/tests/typ/text/par.typ b/tests/typ/text/par.typ index 9955b993..7b6bd289 100644 --- a/tests/typ/text/par.typ +++ b/tests/typ/text/par.typ @@ -15,3 +15,7 @@ It is the east, and Juliet is the sun. --- // Error: 13-16 must be horizontal #par(align: top) + +--- +// Error: 13-29 expected alignment, found 2d alignment +#par(align: horizon + center) |
