From 7e91c8dc87e345ee38b934375d113e824a423a2b Mon Sep 17 00:00:00 2001 From: Laurenz Date: Thu, 17 Dec 2020 13:31:34 +0100 Subject: =?UTF-8?q?Add=20func-prefix=20to=20library=20function=20tests=20?= =?UTF-8?q?=E2=9C=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/ref/func-h-and-v.png | Bin 0 -> 4099 bytes tests/ref/func-image-fit.png | Bin 0 -> 190100 bytes tests/ref/func-image-formats.png | Bin 0 -> 107778 bytes tests/ref/func-page-body.png | Bin 0 -> 2812 bytes tests/ref/func-page-dirs.png | Bin 0 -> 1030 bytes tests/ref/func-page-metrics.png | Bin 0 -> 5092 bytes tests/ref/func-pagebreak.png | Bin 0 -> 1039 bytes tests/ref/func-rgb.png | Bin 0 -> 4142 bytes tests/ref/h-and-v.png | Bin 4099 -> 0 bytes tests/ref/image-fit.png | Bin 190100 -> 0 bytes tests/ref/image-formats.png | Bin 107778 -> 0 bytes tests/ref/page-body.png | Bin 2812 -> 0 bytes tests/ref/page-dirs.png | Bin 1030 -> 0 bytes tests/ref/page-metrics.png | Bin 5092 -> 0 bytes tests/ref/pagebreak.png | Bin 1039 -> 0 bytes tests/ref/rgb.png | Bin 4142 -> 0 bytes tests/typ/func-h-and-v.typ | 25 +++++++++++++++++++++++++ tests/typ/func-image-error.typ | 11 +++++++++++ tests/typ/func-image-fit.typ | 23 +++++++++++++++++++++++ tests/typ/func-image-formats.typ | 8 ++++++++ tests/typ/func-page-body.typ | 11 +++++++++++ tests/typ/func-page-dirs.typ | 5 +++++ tests/typ/func-page-error.typ | 11 +++++++++++ tests/typ/func-page-metrics.typ | 25 +++++++++++++++++++++++++ tests/typ/func-pagebreak.typ | 5 +++++ tests/typ/func-rgb.typ | 24 ++++++++++++++++++++++++ tests/typ/h-and-v.typ | 25 ------------------------- tests/typ/image-error.typ | 11 ----------- tests/typ/image-fit.typ | 23 ----------------------- tests/typ/image-formats.typ | 8 -------- tests/typ/page-body.typ | 11 ----------- tests/typ/page-dirs.typ | 5 ----- tests/typ/page-error.typ | 11 ----------- tests/typ/page-metrics.typ | 25 ------------------------- tests/typ/pagebreak.typ | 5 ----- tests/typ/rgb.typ | 24 ------------------------ 36 files changed, 148 insertions(+), 148 deletions(-) create mode 100644 tests/ref/func-h-and-v.png create mode 100644 tests/ref/func-image-fit.png create mode 100644 tests/ref/func-image-formats.png create mode 100644 tests/ref/func-page-body.png create mode 100644 tests/ref/func-page-dirs.png create mode 100644 tests/ref/func-page-metrics.png create mode 100644 tests/ref/func-pagebreak.png create mode 100644 tests/ref/func-rgb.png delete mode 100644 tests/ref/h-and-v.png delete mode 100644 tests/ref/image-fit.png delete mode 100644 tests/ref/image-formats.png delete mode 100644 tests/ref/page-body.png delete mode 100644 tests/ref/page-dirs.png delete mode 100644 tests/ref/page-metrics.png delete mode 100644 tests/ref/pagebreak.png delete mode 100644 tests/ref/rgb.png create mode 100644 tests/typ/func-h-and-v.typ create mode 100644 tests/typ/func-image-error.typ create mode 100644 tests/typ/func-image-fit.typ create mode 100644 tests/typ/func-image-formats.typ create mode 100644 tests/typ/func-page-body.typ create mode 100644 tests/typ/func-page-dirs.typ create mode 100644 tests/typ/func-page-error.typ create mode 100644 tests/typ/func-page-metrics.typ create mode 100644 tests/typ/func-pagebreak.typ create mode 100644 tests/typ/func-rgb.typ delete mode 100644 tests/typ/h-and-v.typ delete mode 100644 tests/typ/image-error.typ delete mode 100644 tests/typ/image-fit.typ delete mode 100644 tests/typ/image-formats.typ delete mode 100644 tests/typ/page-body.typ delete mode 100644 tests/typ/page-dirs.typ delete mode 100644 tests/typ/page-error.typ delete mode 100644 tests/typ/page-metrics.typ delete mode 100644 tests/typ/pagebreak.typ delete mode 100644 tests/typ/rgb.typ diff --git a/tests/ref/func-h-and-v.png b/tests/ref/func-h-and-v.png new file mode 100644 index 00000000..e977046f Binary files /dev/null and b/tests/ref/func-h-and-v.png differ diff --git a/tests/ref/func-image-fit.png b/tests/ref/func-image-fit.png new file mode 100644 index 00000000..b89e78fd Binary files /dev/null and b/tests/ref/func-image-fit.png differ diff --git a/tests/ref/func-image-formats.png b/tests/ref/func-image-formats.png new file mode 100644 index 00000000..45b23276 Binary files /dev/null and b/tests/ref/func-image-formats.png differ diff --git a/tests/ref/func-page-body.png b/tests/ref/func-page-body.png new file mode 100644 index 00000000..09f685c3 Binary files /dev/null and b/tests/ref/func-page-body.png differ diff --git a/tests/ref/func-page-dirs.png b/tests/ref/func-page-dirs.png new file mode 100644 index 00000000..2bf23ebc Binary files /dev/null and b/tests/ref/func-page-dirs.png differ diff --git a/tests/ref/func-page-metrics.png b/tests/ref/func-page-metrics.png new file mode 100644 index 00000000..2e8d626d Binary files /dev/null and b/tests/ref/func-page-metrics.png differ diff --git a/tests/ref/func-pagebreak.png b/tests/ref/func-pagebreak.png new file mode 100644 index 00000000..50686ff9 Binary files /dev/null and b/tests/ref/func-pagebreak.png differ diff --git a/tests/ref/func-rgb.png b/tests/ref/func-rgb.png new file mode 100644 index 00000000..e394ccf1 Binary files /dev/null and b/tests/ref/func-rgb.png differ diff --git a/tests/ref/h-and-v.png b/tests/ref/h-and-v.png deleted file mode 100644 index e977046f..00000000 Binary files a/tests/ref/h-and-v.png and /dev/null differ diff --git a/tests/ref/image-fit.png b/tests/ref/image-fit.png deleted file mode 100644 index b89e78fd..00000000 Binary files a/tests/ref/image-fit.png and /dev/null differ diff --git a/tests/ref/image-formats.png b/tests/ref/image-formats.png deleted file mode 100644 index 45b23276..00000000 Binary files a/tests/ref/image-formats.png and /dev/null differ diff --git a/tests/ref/page-body.png b/tests/ref/page-body.png deleted file mode 100644 index 09f685c3..00000000 Binary files a/tests/ref/page-body.png and /dev/null differ diff --git a/tests/ref/page-dirs.png b/tests/ref/page-dirs.png deleted file mode 100644 index 2bf23ebc..00000000 Binary files a/tests/ref/page-dirs.png and /dev/null differ diff --git a/tests/ref/page-metrics.png b/tests/ref/page-metrics.png deleted file mode 100644 index 2e8d626d..00000000 Binary files a/tests/ref/page-metrics.png and /dev/null differ diff --git a/tests/ref/pagebreak.png b/tests/ref/pagebreak.png deleted file mode 100644 index 50686ff9..00000000 Binary files a/tests/ref/pagebreak.png and /dev/null differ diff --git a/tests/ref/rgb.png b/tests/ref/rgb.png deleted file mode 100644 index e394ccf1..00000000 Binary files a/tests/ref/rgb.png and /dev/null differ diff --git a/tests/typ/func-h-and-v.typ b/tests/typ/func-h-and-v.typ new file mode 100644 index 00000000..9c6d5730 --- /dev/null +++ b/tests/typ/func-h-and-v.typ @@ -0,0 +1,25 @@ +// Test the `h` and `v` functions. + +// Ends paragraphs. +Tightly [v: -5pt] packed + +// Eating up soft spacing. +Inv [h: 0pt] isible + +// Multiple spacings in a row. +Add [h: 10pt] [h: 10pt] up + +// Relative to font size. +Relative [h: 100%] spacing + +// Missing spacing. +Totally [h] ignored + +// Swapped axes. +[page: main-dir=rtl, cross-dir=ttb][ + 1 [h: 1cm] 2 + + 3 [v: 1cm] 4 [v: -1cm] 5 +] + +// error: 16:11-16:11 missing argument: spacing diff --git a/tests/typ/func-image-error.typ b/tests/typ/func-image-error.typ new file mode 100644 index 00000000..e6a989ca --- /dev/null +++ b/tests/typ/func-image-error.typ @@ -0,0 +1,11 @@ +// Test error cases of the `image` function. + +// File does not exist. +[image: "path/does/not/exist"] + +// File exists, but is no image. +[image: "typ/image-error.typ"] + +// compare-ref: false +// error: 4:9-4:30 failed to load image +// error: 7:9-7:30 failed to load image diff --git a/tests/typ/func-image-fit.typ b/tests/typ/func-image-fit.typ new file mode 100644 index 00000000..eca7c1e4 --- /dev/null +++ b/tests/typ/func-image-fit.typ @@ -0,0 +1,23 @@ +// Test configuring the size and fitting behaviour of images. + +// Fit to width of page. +[image: "res/rhino.png"] + +// Fit to height of page. +[page: width=270pt][ + [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"] +] diff --git a/tests/typ/func-image-formats.typ b/tests/typ/func-image-formats.typ new file mode 100644 index 00000000..36b991d0 --- /dev/null +++ b/tests/typ/func-image-formats.typ @@ -0,0 +1,8 @@ +// Test loading different image formats. + +// Load an RGBA PNG image. +[image: "res/rhino.png"] +[pagebreak] + +// Load an RGB JPEG image. +[image: "res/tiger.jpg"] diff --git a/tests/typ/func-page-body.typ b/tests/typ/func-page-body.typ new file mode 100644 index 00000000..78e72d12 --- /dev/null +++ b/tests/typ/func-page-body.typ @@ -0,0 +1,11 @@ +// Test a combination of pages with bodies and normal content. + +[page: height=50pt] + +[page][First] +[page][Second] +[pagebreak] +Fourth +[page][] +Sixth +[page][Seventh and last] diff --git a/tests/typ/func-page-dirs.typ b/tests/typ/func-page-dirs.typ new file mode 100644 index 00000000..09ba4e9e --- /dev/null +++ b/tests/typ/func-page-dirs.typ @@ -0,0 +1,5 @@ +// Test changing the layouting directions of pages. + +[page: main-dir=btt, cross-dir=rtl] + +Right to left! diff --git a/tests/typ/func-page-error.typ b/tests/typ/func-page-error.typ new file mode 100644 index 00000000..e259a04e --- /dev/null +++ b/tests/typ/func-page-error.typ @@ -0,0 +1,11 @@ +// Test error cases of the `page` function. + +// Invalid paper. +[page: nonexistant] + +// Aligned axes. +[page: main-dir=ltr] + +// compare-ref: false +// error: 4:8-4:19 invalid paper +// error: 7:17-7:20 aligned axis diff --git a/tests/typ/func-page-metrics.typ b/tests/typ/func-page-metrics.typ new file mode 100644 index 00000000..6c7bd461 --- /dev/null +++ b/tests/typ/func-page-metrics.typ @@ -0,0 +1,25 @@ +// Test configuring page sizes and margins. + +// Set width. +[page: width=50pt][High] + +// Set height. +[page: height=50pt][Wide] + +// Set all margins at once. +[page: margins=40pt][ + [align: top, left][TL] + [align: bottom, right][BR] +] + +// Set individual margins. +[page: left=0pt >> align: left][Left] +[page: right=0pt >> align: right][Right] +[page: top=0pt >> align: top][Top] +[page: bottom=0pt >> align: bottom][Bottom] + +// Ensure that specific margins override general margins. +[page: margins=0pt, left=40pt][Overriden] + +// Flip the page. +[page: a10, flip=true][Flipped] diff --git a/tests/typ/func-pagebreak.typ b/tests/typ/func-pagebreak.typ new file mode 100644 index 00000000..7fd9aae2 --- /dev/null +++ b/tests/typ/func-pagebreak.typ @@ -0,0 +1,5 @@ +// Test trailing pagebreak. + +First of two +[pagebreak] +[page: height=40pt] diff --git a/tests/typ/func-rgb.typ b/tests/typ/func-rgb.typ new file mode 100644 index 00000000..44d87819 --- /dev/null +++ b/tests/typ/func-rgb.typ @@ -0,0 +1,24 @@ +// Test the `rgb` function. + +// Check the output. +[rgb: 0.0, 0.3, 0.7] [val: #004db3] + +// Alpha channel. +[rgb: 1.0, 0.0, 0.0, 0.5] + +// Value smaller than 0.0 and larger than 1.0 +[rgb: -30, 15.5, 0.5] + +// Missing blue component. +[rgb: 0, 1] + +// Missing all components. +[rgb] + +// error: 4:23-4:26 unknown function +// error: 10:7-10:10 should be between 0.0 and 1.0 +// error: 10:12-10:16 should be between 0.0 and 1.0 +// error: 13:7-13:11 missing argument: blue component +// error: 16:5-16:5 missing argument: red component +// error: 16:5-16:5 missing argument: green component +// error: 16:5-16:5 missing argument: blue component diff --git a/tests/typ/h-and-v.typ b/tests/typ/h-and-v.typ deleted file mode 100644 index 9c6d5730..00000000 --- a/tests/typ/h-and-v.typ +++ /dev/null @@ -1,25 +0,0 @@ -// Test the `h` and `v` functions. - -// Ends paragraphs. -Tightly [v: -5pt] packed - -// Eating up soft spacing. -Inv [h: 0pt] isible - -// Multiple spacings in a row. -Add [h: 10pt] [h: 10pt] up - -// Relative to font size. -Relative [h: 100%] spacing - -// Missing spacing. -Totally [h] ignored - -// Swapped axes. -[page: main-dir=rtl, cross-dir=ttb][ - 1 [h: 1cm] 2 - - 3 [v: 1cm] 4 [v: -1cm] 5 -] - -// error: 16:11-16:11 missing argument: spacing diff --git a/tests/typ/image-error.typ b/tests/typ/image-error.typ deleted file mode 100644 index e6a989ca..00000000 --- a/tests/typ/image-error.typ +++ /dev/null @@ -1,11 +0,0 @@ -// Test error cases of the `image` function. - -// File does not exist. -[image: "path/does/not/exist"] - -// File exists, but is no image. -[image: "typ/image-error.typ"] - -// compare-ref: false -// error: 4:9-4:30 failed to load image -// error: 7:9-7:30 failed to load image diff --git a/tests/typ/image-fit.typ b/tests/typ/image-fit.typ deleted file mode 100644 index eca7c1e4..00000000 --- a/tests/typ/image-fit.typ +++ /dev/null @@ -1,23 +0,0 @@ -// Test configuring the size and fitting behaviour of images. - -// Fit to width of page. -[image: "res/rhino.png"] - -// Fit to height of page. -[page: width=270pt][ - [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"] -] diff --git a/tests/typ/image-formats.typ b/tests/typ/image-formats.typ deleted file mode 100644 index 36b991d0..00000000 --- a/tests/typ/image-formats.typ +++ /dev/null @@ -1,8 +0,0 @@ -// Test loading different image formats. - -// Load an RGBA PNG image. -[image: "res/rhino.png"] -[pagebreak] - -// Load an RGB JPEG image. -[image: "res/tiger.jpg"] diff --git a/tests/typ/page-body.typ b/tests/typ/page-body.typ deleted file mode 100644 index 78e72d12..00000000 --- a/tests/typ/page-body.typ +++ /dev/null @@ -1,11 +0,0 @@ -// Test a combination of pages with bodies and normal content. - -[page: height=50pt] - -[page][First] -[page][Second] -[pagebreak] -Fourth -[page][] -Sixth -[page][Seventh and last] diff --git a/tests/typ/page-dirs.typ b/tests/typ/page-dirs.typ deleted file mode 100644 index 09ba4e9e..00000000 --- a/tests/typ/page-dirs.typ +++ /dev/null @@ -1,5 +0,0 @@ -// Test changing the layouting directions of pages. - -[page: main-dir=btt, cross-dir=rtl] - -Right to left! diff --git a/tests/typ/page-error.typ b/tests/typ/page-error.typ deleted file mode 100644 index e259a04e..00000000 --- a/tests/typ/page-error.typ +++ /dev/null @@ -1,11 +0,0 @@ -// Test error cases of the `page` function. - -// Invalid paper. -[page: nonexistant] - -// Aligned axes. -[page: main-dir=ltr] - -// compare-ref: false -// error: 4:8-4:19 invalid paper -// error: 7:17-7:20 aligned axis diff --git a/tests/typ/page-metrics.typ b/tests/typ/page-metrics.typ deleted file mode 100644 index 6c7bd461..00000000 --- a/tests/typ/page-metrics.typ +++ /dev/null @@ -1,25 +0,0 @@ -// Test configuring page sizes and margins. - -// Set width. -[page: width=50pt][High] - -// Set height. -[page: height=50pt][Wide] - -// Set all margins at once. -[page: margins=40pt][ - [align: top, left][TL] - [align: bottom, right][BR] -] - -// Set individual margins. -[page: left=0pt >> align: left][Left] -[page: right=0pt >> align: right][Right] -[page: top=0pt >> align: top][Top] -[page: bottom=0pt >> align: bottom][Bottom] - -// Ensure that specific margins override general margins. -[page: margins=0pt, left=40pt][Overriden] - -// Flip the page. -[page: a10, flip=true][Flipped] diff --git a/tests/typ/pagebreak.typ b/tests/typ/pagebreak.typ deleted file mode 100644 index 7fd9aae2..00000000 --- a/tests/typ/pagebreak.typ +++ /dev/null @@ -1,5 +0,0 @@ -// Test trailing pagebreak. - -First of two -[pagebreak] -[page: height=40pt] diff --git a/tests/typ/rgb.typ b/tests/typ/rgb.typ deleted file mode 100644 index 44d87819..00000000 --- a/tests/typ/rgb.typ +++ /dev/null @@ -1,24 +0,0 @@ -// Test the `rgb` function. - -// Check the output. -[rgb: 0.0, 0.3, 0.7] [val: #004db3] - -// Alpha channel. -[rgb: 1.0, 0.0, 0.0, 0.5] - -// Value smaller than 0.0 and larger than 1.0 -[rgb: -30, 15.5, 0.5] - -// Missing blue component. -[rgb: 0, 1] - -// Missing all components. -[rgb] - -// error: 4:23-4:26 unknown function -// error: 10:7-10:10 should be between 0.0 and 1.0 -// error: 10:12-10:16 should be between 0.0 and 1.0 -// error: 13:7-13:11 missing argument: blue component -// error: 16:5-16:5 missing argument: red component -// error: 16:5-16:5 missing argument: green component -// error: 16:5-16:5 missing argument: blue component -- cgit v1.2.3