diff options
Diffstat (limited to 'tests')
33 files changed, 118 insertions, 85 deletions
diff --git a/tests/ref/code/include.png b/tests/ref/code/include.png Binary files differindex f5a392e4..2d5d9ca7 100644 --- a/tests/ref/code/include.png +++ b/tests/ref/code/include.png diff --git a/tests/ref/coma.png b/tests/ref/coma.png Binary files differindex 34a6b30a..c3ea7ace 100644 --- a/tests/ref/coma.png +++ b/tests/ref/coma.png diff --git a/tests/ref/layout/pad.png b/tests/ref/layout/pad.png Binary files differindex 260b4586..c2906cef 100644 --- a/tests/ref/layout/pad.png +++ b/tests/ref/layout/pad.png diff --git a/tests/ref/layout/page-box.png b/tests/ref/layout/page-box.png Binary files differnew file mode 100644 index 00000000..c8d0320c --- /dev/null +++ b/tests/ref/layout/page-box.png diff --git a/tests/ref/layout/page-margin.png b/tests/ref/layout/page-margin.png Binary files differnew file mode 100644 index 00000000..211f881c --- /dev/null +++ b/tests/ref/layout/page-margin.png diff --git a/tests/ref/layout/page-style.png b/tests/ref/layout/page-style.png Binary files differnew file mode 100644 index 00000000..7132d20b --- /dev/null +++ b/tests/ref/layout/page-style.png diff --git a/tests/ref/layout/page.png b/tests/ref/layout/page.png Binary files differindex 20ac630f..35716e4d 100644 --- a/tests/ref/layout/page.png +++ b/tests/ref/layout/page.png diff --git a/tests/ref/layout/pagebreak.png b/tests/ref/layout/pagebreak.png Binary files differindex 454d106d..293e1b06 100644 --- a/tests/ref/layout/pagebreak.png +++ b/tests/ref/layout/pagebreak.png diff --git a/tests/ref/layout/place.png b/tests/ref/layout/place.png Binary files differindex fc97100f..7900f95f 100644 --- a/tests/ref/layout/place.png +++ b/tests/ref/layout/place.png diff --git a/tests/ref/layout/spacing.png b/tests/ref/layout/spacing.png Binary files differindex 193be6f5..7bb74ad9 100644 --- a/tests/ref/layout/spacing.png +++ b/tests/ref/layout/spacing.png diff --git a/tests/ref/markup/enums.png b/tests/ref/markup/enums.png Binary files differindex a257b0dd..3878f32c 100644 --- a/tests/ref/markup/enums.png +++ b/tests/ref/markup/enums.png diff --git a/tests/ref/markup/heading.png b/tests/ref/markup/heading.png Binary files differindex ac229180..09f3d7c7 100644 --- a/tests/ref/markup/heading.png +++ b/tests/ref/markup/heading.png diff --git a/tests/ref/markup/lists.png b/tests/ref/markup/lists.png Binary files differindex d39f3164..618e1191 100644 --- a/tests/ref/markup/lists.png +++ b/tests/ref/markup/lists.png diff --git a/tests/ref/markup/math.png b/tests/ref/markup/math.png Binary files differindex 448b2d12..77ec8d51 100644 --- a/tests/ref/markup/math.png +++ b/tests/ref/markup/math.png diff --git a/tests/ref/markup/raw.png b/tests/ref/markup/raw.png Binary files differindex ec39d3df..64402dae 100644 --- a/tests/ref/markup/raw.png +++ b/tests/ref/markup/raw.png diff --git a/tests/ref/markup/shorthands.png b/tests/ref/markup/shorthands.png Binary files differindex db27ef36..ad09967d 100644 --- a/tests/ref/markup/shorthands.png +++ b/tests/ref/markup/shorthands.png diff --git a/tests/ref/style/set-site.png b/tests/ref/style/set-site.png Binary files differindex 3188f7a7..408e44bf 100644 --- a/tests/ref/style/set-site.png +++ b/tests/ref/style/set-site.png diff --git a/tests/ref/text/bidi.png b/tests/ref/text/bidi.png Binary files differindex 7e0aab8f..68bd6b73 100644 --- a/tests/ref/text/bidi.png +++ b/tests/ref/text/bidi.png diff --git a/tests/ref/text/par.png b/tests/ref/text/par.png Binary files differindex 9ea42713..c080178e 100644 --- a/tests/ref/text/par.png +++ b/tests/ref/text/par.png diff --git a/tests/typ/coma.typ b/tests/typ/coma.typ index ef9e9f86..92d5695f 100644 --- a/tests/typ/coma.typ +++ b/tests/typ/coma.typ @@ -6,11 +6,10 @@ Sekretariat MA \ Dr. Max Mustermann \ Ola Nordmann, John Doe -#v(6mm) +#v(2mm) #align(center)[ - ==== 3. Übungsblatt Computerorientierte Mathematik II - #v(4mm) - *Abgabe: 03.05.2019* (bis 10:10 Uhr in MA 001) #v(4mm) + ==== 3. Übungsblatt Computerorientierte Mathematik II #v(1mm) + *Abgabe: 03.05.2019* (bis 10:10 Uhr in MA 001) #v(1mm) *Alle Antworten sind zu beweisen.* ] @@ -21,5 +20,4 @@ Die Tiefe eines Knotens _v_ ist die Länge des eindeutigen Weges von der Wurzel zu _v_, und die Höhe von _v_ ist die Länge eines längsten (absteigenden) Weges von _v_ zu einem Blatt. Die Höhe des Baumes ist die Höhe der Wurzel. -#v(6mm) #align(center, image("../res/graph.png", width: 75%)) diff --git a/tests/typ/layout/box-block.typ b/tests/typ/layout/box-block.typ index 14258c1e..c6928074 100644 --- a/tests/typ/layout/box-block.typ +++ b/tests/typ/layout/box-block.typ @@ -15,6 +15,7 @@ Apart #set page(height: 60pt) First! + #block[ But, soft! what light through yonder window breaks? It is the east, and Juliet is the sun. diff --git a/tests/typ/layout/page-box.typ b/tests/typ/layout/page-box.typ new file mode 100644 index 00000000..ed9d3e14 --- /dev/null +++ b/tests/typ/layout/page-box.typ @@ -0,0 +1,14 @@ +// Test that you can't do page related stuff in a container. + +--- +A +#box[ + B + #pagebreak() + #set page("a4") +] +C + +// No consequences from the page("A4") call here. +#pagebreak() +D diff --git a/tests/typ/layout/page-margin.typ b/tests/typ/layout/page-margin.typ new file mode 100644 index 00000000..44126d2d --- /dev/null +++ b/tests/typ/layout/page-margin.typ @@ -0,0 +1,20 @@ +// Test page margins. + +--- +// Set all margins at once. +[ + #set page(height: 20pt, margins: 5pt) + #place(top + left)[TL] + #place(bottom + right)[BR] +] + +--- +// Set individual margins. +#set page(height: 40pt) +[#set page(left: 0pt); #align(left)[Left]] +[#set page(right: 0pt); #align(right)[Right]] +[#set page(top: 0pt); #align(top)[Top]] +[#set page(bottom: 0pt); #align(bottom)[Bottom]] + +// Ensure that specific margins override general margins. +[#set page(margins: 0pt, left: 20pt); Overriden] diff --git a/tests/typ/layout/page-style.typ b/tests/typ/layout/page-style.typ new file mode 100644 index 00000000..f27551b2 --- /dev/null +++ b/tests/typ/layout/page-style.typ @@ -0,0 +1,28 @@ +// Test setting page styles. + +--- +// Empty with styles +// Should result in one conifer-colored A11 page. +#set page("a11", flipped: true, fill: conifer) + +--- +// Empty with styles and then pagebreak +// Should result in two forest-colored pages. +#set page(fill: forest) +#pagebreak() + +--- +// Empty with multiple page styles. +// Should result in a small white page. +#set page("a4") +#set page("a5") +#set page(width: 1cm, height: 1cm) + +--- +// Empty with multiple page styles. +// Should result in one eastern-colored A11 page. +#set page("a4") +#set page("a5") +#set page("a11", flipped: true, fill: eastern) +#set text("Roboto", white, smallcaps: true) +Typst diff --git a/tests/typ/layout/page.typ b/tests/typ/layout/page.typ index 35f338f4..89d0f2fb 100644 --- a/tests/typ/layout/page.typ +++ b/tests/typ/layout/page.typ @@ -1,34 +1,33 @@ -// Test configuring page sizes and margins. +// Test the page class. + +--- +// Just empty page. +// Should result in auto-sized page, just like nothing. +#page[] + +--- +// Just empty page with styles. +// Should result in one conifer-colored A11 page. +#page("a11", flipped: true, fill: conifer)[] --- // Set width and height. +// Should result in one high and one wide page. #set page(width: 80pt, height: 80pt) [#set page(width: 40pt);High] [#set page(height: 40pt);Wide] -// Set all margins at once. -[ - #set page(margins: 5pt) - #place(top + left)[TL] - #place(bottom + right)[BR] -] - -// Set individual margins. -#set page(height: 40pt) -[#set page(left: 0pt); #align(left)[Left]] -[#set page(right: 0pt); #align(right)[Right]] -[#set page(top: 0pt); #align(top)[Top]] -[#set page(bottom: 0pt); #align(bottom)[Bottom]] - -// Ensure that specific margins override general margins. -[#set page(margins: 0pt, left: 20pt); Overriden] - // Flipped predefined paper. [#set page(paper: "a11", flipped: true);Flipped A11] --- +// Test page fill. #set page(width: 80pt, height: 40pt, fill: eastern) #text(15pt, "Roboto", fill: white, smallcaps: true)[Typst] +#page(width: 40pt, fill: none, margins: auto, top: 10pt)[Hi] -#set page(width: 40pt, fill: none, margins: auto, top: 10pt) -Hi +--- +// Just page followed by pagebreak. +// Should result in one forest-colored A11 page and one auto-sized page. +#page("a11", flipped: true, fill: forest)[] +#pagebreak() diff --git a/tests/typ/layout/pagebreak.typ b/tests/typ/layout/pagebreak.typ index 81af710c..005ca244 100644 --- a/tests/typ/layout/pagebreak.typ +++ b/tests/typ/layout/pagebreak.typ @@ -1,35 +1,23 @@ // Test forced page breaks. --- -First of two +// Just a pagebreak. +// Should result in two auto-sized pages. #pagebreak() -#set page(height: 40pt) -Second of two --- -// Make sure that you can't do page related stuff in a container. -A -#box[ - B - #pagebreak() - #set page("a4") -] -C - -// No consequences from the page("A4") call here. +// Pagebreak, empty with styles and then pagebreak +// Should result in one auto-sized page and two conifer-colored A11 pages. +#pagebreak() +#set page(width: 2cm, fill: conifer) #pagebreak() -D --- -// Test a combination of pages with bodies and normal content. - +// Test a combination of pagebreaks, styled pages and pages with bodies. #set page(width: 80pt, height: 30pt) - -[#set page(width: 80pt); First] -#pagebreak() +[#set page(width: 60pt); First] #pagebreak() #pagebreak() -Fourth -#page(height: 20pt)[] -Sixth -[#set page(); Seventh] +Third +#page(height: 20pt, fill: forest)[] +Fif[#set page();th] diff --git a/tests/typ/layout/spacing.typ b/tests/typ/layout/spacing.typ index 37aa8eaa..82531efc 100644 --- a/tests/typ/layout/spacing.typ +++ b/tests/typ/layout/spacing.typ @@ -1,38 +1,27 @@ // Test the `h` and `v` functions. --- -// Ends paragraphs. -Tightly #v(0pt) packed +// Linebreak and v(0pt) are equivalent. +#box[A \ B] #box[A #v(0pt) B] // Eating up soft spacing. -Inv #h(0pt) isible +Inv#h(0pt)isible // Multiple spacings in a row. Add #h(10pt) #h(10pt) up // Relative to area. #let x = 25% - 4pt -| #h(x) | #h(x) | #h(x) | #h(x) | +|#h(x)|#h(x)|#h(x)|#h(x)| // Fractional. | #h(1fr) | #h(2fr) | #h(1fr) | --- -// Test spacing collapsing with parbreaks. -#v(0pt) -A -#v(0pt) -B -#v(0pt) - -C #parbreak() D - ---- -// Test that spacing can carry paragraph and page style properties. - -A[#set par(align: right);#h(1cm)]B -[#set page(height: 20pt);#v(1cm)] -B +// Test spacing collapsing before spacing. +#set par(align: right) +A #h(0pt) B #h(0pt) \ +A B --- // Missing spacing. diff --git a/tests/typ/layout/stack-1.typ b/tests/typ/layout/stack-1.typ index d8075e9d..eee1f4d1 100644 --- a/tests/typ/layout/stack-1.typ +++ b/tests/typ/layout/stack-1.typ @@ -31,7 +31,7 @@ --- // Test spacing. #set page(width: 50pt, margins: 0pt) -#set par(spacing: 5pt) +#set par(leading: 5pt) #let x = square(size: 10pt, fill: eastern) #stack(dir: rtl, spacing: 5pt, x, x, x) diff --git a/tests/typ/markup/enums.typ b/tests/typ/markup/enums.typ index c976deee..93a175d4 100644 --- a/tests/typ/markup/enums.typ +++ b/tests/typ/markup/enums.typ @@ -8,6 +8,7 @@ --- 1. First. 2. Second. + 1. Back to first. --- diff --git a/tests/typ/markup/lists.typ b/tests/typ/markup/lists.typ index 716fcd73..38fc2c63 100644 --- a/tests/typ/markup/lists.typ +++ b/tests/typ/markup/lists.typ @@ -14,13 +14,15 @@ paragraphs. --- - First level. + - Second level. There are multiple paragraphs. - Third level. - Still the same bullet point. + - Still level 2. + - At the top. --- diff --git a/tests/typ/style/construct.typ b/tests/typ/style/construct.typ index ab53d40f..65dcaf85 100644 --- a/tests/typ/style/construct.typ +++ b/tests/typ/style/construct.typ @@ -2,7 +2,7 @@ --- // Ensure that constructor styles aren't passed down the tree. -#set par(spacing: 2pt) +#set par(leading: 2pt) #list( body-indent: 20pt, [First], diff --git a/tests/typ/style/set-site.typ b/tests/typ/style/set-site.typ index b5464aeb..20d35f04 100644 --- a/tests/typ/style/set-site.typ +++ b/tests/typ/style/set-site.typ @@ -8,7 +8,6 @@ Hello *{x}* --- // Test that lists are affected by correct indents. -#set par(spacing: 4pt) #let fruit = [ - Apple - Orange @@ -23,7 +22,7 @@ Hello *{x}* --- // Test that that par spacing and text style are respected from // the outside, but the more specific fill is respected. -#set par(spacing: 4pt) +#set par(spacing: 0pt) #set text(style: "italic", fill: eastern) #let x = [And the forest #parbreak() lay silent!] #text(fill: forest, x) diff --git a/tests/typ/text/par.typ b/tests/typ/text/par.typ index 96a9eb6e..b0e60955 100644 --- a/tests/typ/text/par.typ +++ b/tests/typ/text/par.typ @@ -7,11 +7,11 @@ To the right! Where the sunlight peeks behind the mountain. --- // Test that explicit paragraph break respects active styles. -#set par(spacing: 7pt) +#set par(spacing: 0pt) [#set par(spacing: 100pt);First] [#set par(spacing: 100pt);Second] -#set par(spacing: 20pt) +#set par(spacing: 13.5pt) Third @@ -21,33 +21,27 @@ Hello #set par(spacing: 100pt) World -#set par(spacing: 0pt) +#set par(spacing: 0pt, leading: 0pt) You --- // Test that paragraphs break due to incompatibility has correct spacing. -A #set par(spacing: 0pt); B #parbreak() C +A #set par(spacing: 0pt, leading: 0pt); B #parbreak() C --- // Test that paragraph breaks due to block nodes have the correct spacing. +#set par(spacing: 10pt) - A -#set par(spacing: 0pt) +#set par(leading: 0pt) - B - C -#set par(spacing: 5pt) +#set par(leading: 5pt) - D - E --- -// Test that paragraph break due to incompatibility respects -// spacing defined by the two adjacent paragraphs. -#let a = [#set par(spacing: 40pt);Hello] -#let b = [#set par(spacing: 10pt);World] -{a}{b} - ---- // Test weird metrics. #set par(spacing: 100%, leading: 0pt) But, soft! what light through yonder window breaks? |
