From dcdcf53831aa477b575c9e6ab37eb64f14317c74 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Tue, 5 Oct 2021 18:51:21 +0200 Subject: Rename insert/ to elements/ --- tests/ref/elements/circle.png | Bin 0 -> 12600 bytes tests/ref/elements/ellipse.png | Bin 0 -> 7359 bytes tests/ref/elements/image.png | Bin 0 -> 219541 bytes tests/ref/elements/rect.png | Bin 0 -> 2542 bytes tests/ref/elements/square.png | Bin 0 -> 6124 bytes tests/ref/insert/circle.png | Bin 12600 -> 0 bytes tests/ref/insert/ellipse.png | Bin 7359 -> 0 bytes tests/ref/insert/image.png | Bin 219541 -> 0 bytes tests/ref/insert/rect.png | Bin 2542 -> 0 bytes tests/ref/insert/square.png | Bin 6124 -> 0 bytes tests/typ/elements/circle.typ | 48 +++++++++++++++++++++++++++++++++++++++++ tests/typ/elements/ellipse.typ | 17 +++++++++++++++ tests/typ/elements/image.typ | 44 +++++++++++++++++++++++++++++++++++++ tests/typ/elements/rect.typ | 27 +++++++++++++++++++++++ tests/typ/elements/square.typ | 34 +++++++++++++++++++++++++++++ tests/typ/insert/circle.typ | 48 ----------------------------------------- tests/typ/insert/ellipse.typ | 17 --------------- tests/typ/insert/image.typ | 44 ------------------------------------- tests/typ/insert/rect.typ | 27 ----------------------- tests/typ/insert/square.typ | 34 ----------------------------- 20 files changed, 170 insertions(+), 170 deletions(-) create mode 100644 tests/ref/elements/circle.png create mode 100644 tests/ref/elements/ellipse.png create mode 100644 tests/ref/elements/image.png create mode 100644 tests/ref/elements/rect.png create mode 100644 tests/ref/elements/square.png delete mode 100644 tests/ref/insert/circle.png delete mode 100644 tests/ref/insert/ellipse.png delete mode 100644 tests/ref/insert/image.png delete mode 100644 tests/ref/insert/rect.png delete mode 100644 tests/ref/insert/square.png create mode 100644 tests/typ/elements/circle.typ create mode 100644 tests/typ/elements/ellipse.typ create mode 100644 tests/typ/elements/image.typ create mode 100644 tests/typ/elements/rect.typ create mode 100644 tests/typ/elements/square.typ delete mode 100644 tests/typ/insert/circle.typ delete mode 100644 tests/typ/insert/ellipse.typ delete mode 100644 tests/typ/insert/image.typ delete mode 100644 tests/typ/insert/rect.typ delete mode 100644 tests/typ/insert/square.typ (limited to 'tests') diff --git a/tests/ref/elements/circle.png b/tests/ref/elements/circle.png new file mode 100644 index 00000000..65b087ed Binary files /dev/null and b/tests/ref/elements/circle.png differ diff --git a/tests/ref/elements/ellipse.png b/tests/ref/elements/ellipse.png new file mode 100644 index 00000000..d429f66e Binary files /dev/null and b/tests/ref/elements/ellipse.png differ diff --git a/tests/ref/elements/image.png b/tests/ref/elements/image.png new file mode 100644 index 00000000..6848726f Binary files /dev/null and b/tests/ref/elements/image.png differ diff --git a/tests/ref/elements/rect.png b/tests/ref/elements/rect.png new file mode 100644 index 00000000..ad4c48e6 Binary files /dev/null and b/tests/ref/elements/rect.png differ diff --git a/tests/ref/elements/square.png b/tests/ref/elements/square.png new file mode 100644 index 00000000..a7343a10 Binary files /dev/null and b/tests/ref/elements/square.png differ diff --git a/tests/ref/insert/circle.png b/tests/ref/insert/circle.png deleted file mode 100644 index 65b087ed..00000000 Binary files a/tests/ref/insert/circle.png and /dev/null differ diff --git a/tests/ref/insert/ellipse.png b/tests/ref/insert/ellipse.png deleted file mode 100644 index d429f66e..00000000 Binary files a/tests/ref/insert/ellipse.png and /dev/null differ diff --git a/tests/ref/insert/image.png b/tests/ref/insert/image.png deleted file mode 100644 index 6848726f..00000000 Binary files a/tests/ref/insert/image.png and /dev/null differ diff --git a/tests/ref/insert/rect.png b/tests/ref/insert/rect.png deleted file mode 100644 index ad4c48e6..00000000 Binary files a/tests/ref/insert/rect.png and /dev/null differ diff --git a/tests/ref/insert/square.png b/tests/ref/insert/square.png deleted file mode 100644 index a7343a10..00000000 Binary files a/tests/ref/insert/square.png and /dev/null differ diff --git a/tests/typ/elements/circle.typ b/tests/typ/elements/circle.typ new file mode 100644 index 00000000..c46d37e4 --- /dev/null +++ b/tests/typ/elements/circle.typ @@ -0,0 +1,48 @@ +// Test the `circle` function. + +--- +// Test auto sizing. + +Auto-sized circle. \ +#circle(fill: rgb("eb5278"))[ + #align(center, center) + But, soft! +] + +Center-aligned rect in auto-sized circle. +#circle(fill: forest)[ + #align(center, center) + #rect(fill: conifer, pad(5pt)[ + But, soft! + ]) +] + +100%-width rect in auto-sized circle. \ +#circle(fill: forest, + rect(width: 100%, fill: conifer)[ + But, soft! what light through yonder window breaks? + ] +) + +Expanded by height. +#circle(fill: conifer)[A \ B \ C] + +--- +// Test relative sizing. +#rect(width: 100%, 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] +] + +--- +// 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 new file mode 100644 index 00000000..33ba727f --- /dev/null +++ b/tests/typ/elements/ellipse.typ @@ -0,0 +1,17 @@ +// Test the `ellipse` function. + +--- +100% rect in 100% ellipse in fixed rect. \ +#rect(width: 3cm, height: 2cm, fill: rgb("2a631a"), + ellipse(width: 100%, height: 100%, fill: forest, + rect(width: 100%, height: 100%, fill: conifer)[ + #align(center, center) + Stuff inside an ellipse! + ] + ) +) + +Auto-sized ellipse. \ +#ellipse(fill: conifer)[ + But, soft! what light through yonder window breaks? +] diff --git a/tests/typ/elements/image.typ b/tests/typ/elements/image.typ new file mode 100644 index 00000000..6359c4bb --- /dev/null +++ b/tests/typ/elements/image.typ @@ -0,0 +1,44 @@ +// Test the `image` function. + +--- +// Test loading different image formats. + +// Load an RGBA PNG image. +#image("../../res/rhino.png") +#pagebreak() + +// Load an RGB JPEG image. +#image("../../res/tiger.jpg") + +--- +// Test configuring the size and fitting behaviour of images. + +// Fit to width of page. +#image("../../res/rhino.png") + +// Fit to height of page. +[ + #page(height: 40pt) + #image("../../res/rhino.png") +] + +// Set width explicitly. +#image("../../res/rhino.png", width: 50pt) + +// Set height explicitly. +#image("../../res/rhino.png", height: 50pt) + +// Set width and height explicitly and force stretching. +#image("../../res/rhino.png", width: 25pt, height: 50pt) + +// Make sure the bounding-box of the image is correct. +#align(bottom, right) +#image("../../res/tiger.jpg", width: 60pt) + +--- +// Error: 8-29 file not found +#image("path/does/not/exist") + +--- +// Error: 8-21 failed to load image (unknown image format) +#image("./image.typ") diff --git a/tests/typ/elements/rect.typ b/tests/typ/elements/rect.typ new file mode 100644 index 00000000..4824095a --- /dev/null +++ b/tests/typ/elements/rect.typ @@ -0,0 +1,27 @@ +// Test shapes. + +--- +// Test the `rect` function. + +#page(width: 150pt) + +// Fit to text. +#rect(fill: conifer)[Textbox] + +// Empty with fixed width and height. +#rect(width: 3cm, height: 12pt, fill: rgb("CB4CED")) + +// Fixed width, text height. +#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")) + +// 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")) diff --git a/tests/typ/elements/square.typ b/tests/typ/elements/square.typ new file mode 100644 index 00000000..07dce4be --- /dev/null +++ b/tests/typ/elements/square.typ @@ -0,0 +1,34 @@ +// Test the `square` function. + +--- +// Test auto-sized square. +#square(fill: eastern)[ + #font(fill: white, weight: bold) + #align(center) + #pad(5pt)[Typst] +] +--- +// Test relative-sized child. +#square(fill: eastern)[ + #rect(width: 10pt, height: 5pt, fill: conifer) \ + #rect(width: 40%, height: 5pt, fill: conifer) +] + +--- +// Test height overflow. +#page(width: 75pt, height: 100pt) +#square(fill: conifer)[ + But, soft! what light through yonder window breaks? +] + +--- +// Test width overflow. +#page(width: 100pt, height: 75pt) +#square(fill: conifer)[ + But, soft! what light through yonder window breaks? +] + +--- +// Length wins over width and height. +// Error: 09-20 unexpected argument +#square(width: 10cm, height: 20cm, length: 1cm, fill: rgb("eb5278")) diff --git a/tests/typ/insert/circle.typ b/tests/typ/insert/circle.typ deleted file mode 100644 index c46d37e4..00000000 --- a/tests/typ/insert/circle.typ +++ /dev/null @@ -1,48 +0,0 @@ -// Test the `circle` function. - ---- -// Test auto sizing. - -Auto-sized circle. \ -#circle(fill: rgb("eb5278"))[ - #align(center, center) - But, soft! -] - -Center-aligned rect in auto-sized circle. -#circle(fill: forest)[ - #align(center, center) - #rect(fill: conifer, pad(5pt)[ - But, soft! - ]) -] - -100%-width rect in auto-sized circle. \ -#circle(fill: forest, - rect(width: 100%, fill: conifer)[ - But, soft! what light through yonder window breaks? - ] -) - -Expanded by height. -#circle(fill: conifer)[A \ B \ C] - ---- -// Test relative sizing. -#rect(width: 100%, 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] -] - ---- -// 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/insert/ellipse.typ b/tests/typ/insert/ellipse.typ deleted file mode 100644 index 33ba727f..00000000 --- a/tests/typ/insert/ellipse.typ +++ /dev/null @@ -1,17 +0,0 @@ -// Test the `ellipse` function. - ---- -100% rect in 100% ellipse in fixed rect. \ -#rect(width: 3cm, height: 2cm, fill: rgb("2a631a"), - ellipse(width: 100%, height: 100%, fill: forest, - rect(width: 100%, height: 100%, fill: conifer)[ - #align(center, center) - Stuff inside an ellipse! - ] - ) -) - -Auto-sized ellipse. \ -#ellipse(fill: conifer)[ - But, soft! what light through yonder window breaks? -] diff --git a/tests/typ/insert/image.typ b/tests/typ/insert/image.typ deleted file mode 100644 index 6359c4bb..00000000 --- a/tests/typ/insert/image.typ +++ /dev/null @@ -1,44 +0,0 @@ -// Test the `image` function. - ---- -// Test loading different image formats. - -// Load an RGBA PNG image. -#image("../../res/rhino.png") -#pagebreak() - -// Load an RGB JPEG image. -#image("../../res/tiger.jpg") - ---- -// Test configuring the size and fitting behaviour of images. - -// Fit to width of page. -#image("../../res/rhino.png") - -// Fit to height of page. -[ - #page(height: 40pt) - #image("../../res/rhino.png") -] - -// Set width explicitly. -#image("../../res/rhino.png", width: 50pt) - -// Set height explicitly. -#image("../../res/rhino.png", height: 50pt) - -// Set width and height explicitly and force stretching. -#image("../../res/rhino.png", width: 25pt, height: 50pt) - -// Make sure the bounding-box of the image is correct. -#align(bottom, right) -#image("../../res/tiger.jpg", width: 60pt) - ---- -// Error: 8-29 file not found -#image("path/does/not/exist") - ---- -// Error: 8-21 failed to load image (unknown image format) -#image("./image.typ") diff --git a/tests/typ/insert/rect.typ b/tests/typ/insert/rect.typ deleted file mode 100644 index 4824095a..00000000 --- a/tests/typ/insert/rect.typ +++ /dev/null @@ -1,27 +0,0 @@ -// Test shapes. - ---- -// Test the `rect` function. - -#page(width: 150pt) - -// Fit to text. -#rect(fill: conifer)[Textbox] - -// Empty with fixed width and height. -#rect(width: 3cm, height: 12pt, fill: rgb("CB4CED")) - -// Fixed width, text height. -#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")) - -// 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")) diff --git a/tests/typ/insert/square.typ b/tests/typ/insert/square.typ deleted file mode 100644 index 07dce4be..00000000 --- a/tests/typ/insert/square.typ +++ /dev/null @@ -1,34 +0,0 @@ -// Test the `square` function. - ---- -// Test auto-sized square. -#square(fill: eastern)[ - #font(fill: white, weight: bold) - #align(center) - #pad(5pt)[Typst] -] ---- -// Test relative-sized child. -#square(fill: eastern)[ - #rect(width: 10pt, height: 5pt, fill: conifer) \ - #rect(width: 40%, height: 5pt, fill: conifer) -] - ---- -// Test height overflow. -#page(width: 75pt, height: 100pt) -#square(fill: conifer)[ - But, soft! what light through yonder window breaks? -] - ---- -// Test width overflow. -#page(width: 100pt, height: 75pt) -#square(fill: conifer)[ - But, soft! what light through yonder window breaks? -] - ---- -// Length wins over width and height. -// Error: 09-20 unexpected argument -#square(width: 10cm, height: 20cm, length: 1cm, fill: rgb("eb5278")) -- cgit v1.2.3