diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-10-13 18:33:10 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-10-23 20:22:47 +0200 |
| commit | 1e74f7c407e42174b631cb7477f3c88252da7e25 (patch) | |
| tree | 53c0510b6503c434c9ba470b188d9e737ce1c3cf /tests | |
| parent | 5f4dde0a6b32c7620b29af30f69591cf3995af9b (diff) | |
New `ShapeNode`
Replaces `BackgroundNode` and `FixedNode`
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ref/elements/circle.png | bin | 12600 -> 12965 bytes | |||
| -rw-r--r-- | tests/ref/elements/ellipse.png | bin | 7359 -> 7717 bytes | |||
| -rw-r--r-- | tests/ref/elements/rect.png | bin | 2542 -> 2866 bytes | |||
| -rw-r--r-- | tests/ref/elements/square.png | bin | 6124 -> 6983 bytes | |||
| -rw-r--r-- | tests/typ/coma.typ | 18 | ||||
| -rw-r--r-- | tests/typ/elements/circle.typ | 17 | ||||
| -rw-r--r-- | tests/typ/elements/ellipse.typ | 4 | ||||
| -rw-r--r-- | tests/typ/elements/rect.typ | 24 | ||||
| -rw-r--r-- | tests/typ/elements/square.typ | 10 | ||||
| -rw-r--r-- | tests/typ/layout/grid-1.typ | 31 |
10 files changed, 53 insertions, 51 deletions
diff --git a/tests/ref/elements/circle.png b/tests/ref/elements/circle.png Binary files differindex 65b087ed..41079fda 100644 --- a/tests/ref/elements/circle.png +++ b/tests/ref/elements/circle.png diff --git a/tests/ref/elements/ellipse.png b/tests/ref/elements/ellipse.png Binary files differindex d429f66e..98e66902 100644 --- a/tests/ref/elements/ellipse.png +++ b/tests/ref/elements/ellipse.png diff --git a/tests/ref/elements/rect.png b/tests/ref/elements/rect.png Binary files differindex ad4c48e6..b6d40545 100644 --- a/tests/ref/elements/rect.png +++ b/tests/ref/elements/rect.png diff --git a/tests/ref/elements/square.png b/tests/ref/elements/square.png Binary files differindex a7343a10..a12e1a12 100644 --- a/tests/ref/elements/square.png +++ b/tests/ref/elements/square.png diff --git a/tests/typ/coma.typ b/tests/typ/coma.typ index 8f47a749..54f80cf6 100644 --- a/tests/typ/coma.typ +++ b/tests/typ/coma.typ @@ -10,18 +10,12 @@ #let university = [*Technische Universität {city}*] #let faculty = [*Fakultät II, Institut for Mathematik*] -// The `box` function just places content into a rectangular container. When -// the only argument to a function is a template, the parentheses can be omitted -// (i.e. `f[a]` is the same as `f([a])`). -#box[ - // Backslash adds a forced line break. - #university \ - #faculty \ - Sekretariat MA \ - Dr. Max Mustermann \ - Ola Nordmann, John Doe -] -#align(right, box[*WiSe 2019/2020* \ Woche 3]) +// Backslashs add forced line breaks. +#university #align(right)[*WiSe 2019/2020*] \ +#faculty #align(right)[Woche 3] \ +Sekretariat MA \ +Dr. Max Mustermann \ +Ola Nordmann, John Doe // Adds vertical spacing. #v(6mm) diff --git a/tests/typ/elements/circle.typ b/tests/typ/elements/circle.typ index c46d37e4..c36f9f94 100644 --- a/tests/typ/elements/circle.typ +++ b/tests/typ/elements/circle.typ @@ -1,6 +1,10 @@ // Test the `circle` function. --- +// Default circle. +#circle() + +--- // Test auto sizing. Auto-sized circle. \ @@ -29,20 +33,15 @@ Expanded by height. --- // Test relative sizing. -#rect(width: 100%, height: 50pt, fill: rgb("aaa"))[ +#rect(width: 100pt, height: 50pt, fill: rgb("aaa"))[ #align(center, center) #font(fill: white) - #circle(radius: 10pt, fill: eastern)[A] - #circle(height: 60%, fill: eastern)[B] - #circle(width: 20% + 20pt, fill: eastern)[C] + #circle(radius: 10pt, fill: eastern)[A] // D=20pt + #circle(height: 60%, fill: eastern)[B] // D=30pt + #circle(width: 20% + 20pt, fill: eastern)[C] // D=40pt ] --- // Radius wins over width and height. // Error: 23-34 unexpected argument #circle(radius: 10pt, width: 50pt, height: 100pt, fill: eastern) - ---- -// Width wins over height. -// Error: 9-21 unexpected argument -#circle(height: 50pt, width: 20pt, fill: eastern) diff --git a/tests/typ/elements/ellipse.typ b/tests/typ/elements/ellipse.typ index 33ba727f..106a8172 100644 --- a/tests/typ/elements/ellipse.typ +++ b/tests/typ/elements/ellipse.typ @@ -1,6 +1,10 @@ // Test the `ellipse` function. --- +// Default ellipse. +#ellipse() + +--- 100% rect in 100% ellipse in fixed rect. \ #rect(width: 3cm, height: 2cm, fill: rgb("2a631a"), ellipse(width: 100%, height: 100%, fill: forest, diff --git a/tests/typ/elements/rect.typ b/tests/typ/elements/rect.typ index 4824095a..59dd4ee0 100644 --- a/tests/typ/elements/rect.typ +++ b/tests/typ/elements/rect.typ @@ -1,27 +1,25 @@ -// Test shapes. +// Test the `rect` function. --- -// Test the `rect` function. +// Default rectangle. +#rect() +--- #page(width: 150pt) // Fit to text. #rect(fill: conifer)[Textbox] // Empty with fixed width and height. -#rect(width: 3cm, height: 12pt, fill: rgb("CB4CED")) +#rect(width: 3cm, height: 12pt, fill: rgb("ed8a4c")) // Fixed width, text height. -#rect(width: 2cm, fill: rgb("9650D6"), pad(5pt)[Fixed and padded]) +#rect(width: 2cm, fill: rgb("9650d6"), pad(5pt)[Fixed and padded]) // Page width, fixed height. -#rect(height: 1cm, width: 100%, fill: rgb("734CED"))[Topleft] - -// Not visible, but creates a gap between the boxes above and below -// due to line spacing. -#rect(width: 1in, fill: rgb("ff0000")) +#rect(height: 1cm, width: 100%, fill: rgb("734ced"))[Topleft] -// These are in a row! -#rect(width: 0.5in, height: 10pt, fill: rgb("D6CD67")) -#rect(width: 0.5in, height: 10pt, fill: rgb("EDD466")) -#rect(width: 0.5in, height: 10pt, fill: rgb("E3BE62")) +// These are inline with text. +\{#rect(width: 0.5in, height: 7pt, fill: rgb("d6cd67")) + #rect(width: 0.5in, height: 7pt, fill: rgb("edd466")) + #rect(width: 0.5in, height: 7pt, fill: rgb("e3be62"))\} diff --git a/tests/typ/elements/square.typ b/tests/typ/elements/square.typ index 7597cb22..0e9c3c55 100644 --- a/tests/typ/elements/square.typ +++ b/tests/typ/elements/square.typ @@ -1,12 +1,18 @@ // Test the `square` function. --- +// Default square. +#square() +#square[hey!] + +--- // Test auto-sized square. #square(fill: eastern)[ #font(fill: white, weight: bold) #align(center) #pad(5pt)[Typst] ] + --- // Test relative-sized child. #square(fill: eastern)[ @@ -15,14 +21,14 @@ ] --- -// Test height overflow. +// Test text overflowing height. #page(width: 75pt, height: 100pt) #square(fill: conifer)[ But, soft! what light through yonder window breaks? ] --- -// Test width overflow. +// Test required height overflowing page. #page(width: 100pt, height: 75pt) #square(fill: conifer)[ But, soft! what light through yonder window breaks? diff --git a/tests/typ/layout/grid-1.typ b/tests/typ/layout/grid-1.typ index 3d0412c2..43a3883d 100644 --- a/tests/typ/layout/grid-1.typ +++ b/tests/typ/layout/grid-1.typ @@ -1,23 +1,23 @@ // Test grid layouts. --- -#let rect(width, fill) = rect(width: width, height: 2cm, fill: fill) +#let cell(width, color) = rect(width: width, height: 2cm, fill: color) #page(width: 100pt, height: 140pt) #grid( columns: (auto, 1fr, 3fr, 0.25cm, 3%, 2mm + 10%), - rect(0.5cm, rgb("2a631a")), - rect(100%, forest), - rect(100%, conifer), - rect(100%, rgb("ff0000")), - rect(100%, rgb("00ff00")), - rect(80%, rgb("00faf0")), - rect(1cm, rgb("00ff00")), - rect(0.5cm, rgb("2a631a")), - rect(100%, forest), - rect(100%, conifer), - rect(100%, rgb("ff0000")), - rect(100%, rgb("00ff00")), + cell(0.5cm, rgb("2a631a")), + cell(100%, forest), + cell(100%, conifer), + cell(100%, rgb("ff0000")), + cell(100%, rgb("00ff00")), + cell(80%, rgb("00faf0")), + cell(1cm, rgb("00ff00")), + cell(0.5cm, rgb("2a631a")), + cell(100%, forest), + cell(100%, conifer), + cell(100%, rgb("ff0000")), + cell(100%, rgb("00ff00")), ) #grid() @@ -51,6 +51,7 @@ #grid( columns: (1fr,), rows: (1fr, auto, 2fr), - [], rect(width: 100%)[A bit more to the top], [], + [], + box(width: 100%)[A bit more to the top], + [], ) - |
