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/typ/elements | |
| parent | 5f4dde0a6b32c7620b29af30f69591cf3995af9b (diff) | |
New `ShapeNode`
Replaces `BackgroundNode` and `FixedNode`
Diffstat (limited to 'tests/typ/elements')
| -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 |
4 files changed, 31 insertions, 24 deletions
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? |
