diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-02-17 21:30:20 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-02-17 21:30:20 +0100 |
| commit | 2f4dc99cec1c6fa33257dea91ab3bcd99b1cbdf5 (patch) | |
| tree | eb983e54bac5ae226474bd8c5d6a29006b00ff12 /tests/library/typ | |
| parent | db1659a987cd240b78e45666617248d3d0cc7d64 (diff) | |
Refresh tests 🌊
Diffstat (limited to 'tests/library/typ')
| -rw-r--r-- | tests/library/typ/box.typ | 16 | ||||
| -rw-r--r-- | tests/library/typ/font.typ | 46 | ||||
| -rw-r--r-- | tests/library/typ/hv.typ | 18 | ||||
| -rw-r--r-- | tests/library/typ/image.typ | 26 | ||||
| -rw-r--r-- | tests/library/typ/page.typ | 52 | ||||
| -rw-r--r-- | tests/library/typ/pagebreak.typ | 4 | ||||
| -rw-r--r-- | tests/library/typ/rgb.typ | 16 |
7 files changed, 87 insertions, 91 deletions
diff --git a/tests/library/typ/box.typ b/tests/library/typ/box.typ index 67abe350..57763f12 100644 --- a/tests/library/typ/box.typ +++ b/tests/library/typ/box.typ @@ -1,20 +1,20 @@ -#[page "a7", flip: true] +#page("a7", flip: true) // Box with fixed width, should have text height. -#[box width: 2cm, color: #9650D6][A] +#box(width: 2cm, color: #9650D6)[A] Sometimes there is no box. // Box with fixed height, should span line. -#[box height: 2cm, width: 100%, color: #734CED][B] +#box(height: 2cm, width: 100%, color: #734CED)[B] // Empty box with fixed width and height. -#[box width: 6cm, height: 12pt, color: #CB4CED] +#box(width: 6cm, height: 12pt, color: #CB4CED) // Not visiblem, but creates a gap between the boxes above and below. -#[box width: 2in, color: #ff0000] +#box(width: 2in, color: #ff0000) // These are in a row! -#[box width: 1in, height: 10pt, color: #D6CD67] -#[box width: 1in, height: 10pt, color: #EDD466] -#[box width: 1in, height: 10pt, color: #E3BE62] +#box(width: 1in, height: 10pt, color: #D6CD67) +#box(width: 1in, height: 10pt, color: #EDD466) +#box(width: 1in, height: 10pt, color: #E3BE62) diff --git a/tests/library/typ/font.typ b/tests/library/typ/font.typ index 1bfc1fa6..7f13e8a6 100644 --- a/tests/library/typ/font.typ +++ b/tests/library/typ/font.typ @@ -1,37 +1,37 @@ // Test configuring font properties. -#[font "PT Sans", 10pt] +#font("PT Sans", 10pt) // Set same font size in three different ways. -#[font 20pt][A] -#[font 200%][A] -#[font 15pt + 50%][A] +#font(20pt)[A] +#font(200%)[A] +#font(15pt + 50%)[A] // Do nothing. -#[font][Normal] +#font[Normal] // Set style (is available). -#[font style: italic][Italic] +#font(style: italic)[Italic] // Set weight (is available). -#[font weight: bold][Bold] +#font(weight: bold)[Bold] // Set stretch (not available, matching closest). -#[font stretch: ultra-condensed][Condensed] +#font(stretch: ultra-condensed)[Condensed] -// Error: 8-13 unexpected argument -#[font false] +// Error: 7-12 unexpected argument +#font(false) -// Error: 3:15-3:19 expected font style, found font weight -// Error: 2:29-2:35 expected font weight, found string -// Error: 1:44-1:45 expected font family or array of font families, found integer -#[font style: bold, weight: "thin", serif: 0] +// Error: 3:14-3:18 expected font style, found font weight +// Error: 2:28-2:34 expected font weight, found string +// Error: 1:43-1:44 expected font family or array of font families, found integer +#font(style: bold, weight: "thin", serif: 0) -// Warning: 16-20 should be between 100 and 900 -#[font weight: 2700] +// Warning: 15-19 should be between 100 and 900 +#font(weight: 2700) -// Error: 8-28 unexpected argument -#[font something: "invalid"] +// Error: 7-27 unexpected argument +#font(something: "invalid") --- // Test font fallback and class definitions. @@ -40,17 +40,17 @@ Emoji: 🏀 // CMU Serif + Noto Emoji. -#[font "CMU Serif", "Noto Emoji"][ +#font("CMU Serif", "Noto Emoji")[ Emoji: 🏀 ] // Class definitions. -#[font serif: ("CMU Serif", "Latin Modern Math", "Noto Emoji")] -#[font serif][ +#font(serif: ("CMU Serif", "Latin Modern Math", "Noto Emoji")) +#font(serif)[ Math: ∫ α + β ➗ 3 ] // Class definition reused. -#[font sans-serif: "Noto Emoji"] -#[font sans-serif: ("Archivo", sans-serif)] +#font(sans-serif: "Noto Emoji") +#font(sans-serif: ("Archivo", sans-serif)) New sans-serif. 🚀 diff --git a/tests/library/typ/hv.typ b/tests/library/typ/hv.typ index 15799c81..154445cf 100644 --- a/tests/library/typ/hv.typ +++ b/tests/library/typ/hv.typ @@ -1,22 +1,22 @@ // Ends paragraphs. -Tightly #[v -5pt] packed +Tightly #v(-5pt) packed // Eating up soft spacing. -Inv #[h 0pt] isible +Inv #h(0pt) isible // Multiple spacings in a row. -Add #[h 10pt] #[h 10pt] up +Add #h(10pt) #h(10pt) up // Relative to font size. -Relative #[h 100%] spacing +Relative #h(100%) spacing // Missing spacing. -// Error: 12-12 missing argument: spacing -Totally #[h] ignored +// Error: 12 missing argument: spacing +Totally #h() ignored // Swapped axes. -#[page main-dir: rtl, cross-dir: ttb, height: 80pt][ - 1 #[h 1cm] 2 +#page(main-dir: rtl, cross-dir: ttb, height: 80pt)[ + 1 #h(1cm) 2 - 3 #[v 1cm] 4 #[v -1cm] 5 + 3 #v(1cm) 4 #v(-1cm) 5 ] diff --git a/tests/library/typ/image.typ b/tests/library/typ/image.typ index ced364b3..8bf972b2 100644 --- a/tests/library/typ/image.typ +++ b/tests/library/typ/image.typ @@ -1,39 +1,35 @@ // Test loading different image formats. // Load an RGBA PNG image. -#[image "res/rhino.png"] -#[pagebreak] +#image("res/rhino.png") +#pagebreak() // Load an RGB JPEG image. -#[image "res/tiger.jpg"] +#image("res/tiger.jpg") // Error: 9-30 failed to load image -#[image "path/does/not/exist"] +#image("path/does/not/exist") // Error: 9-30 failed to load image -#[image "typ/image-error.typ"] +#image("typ/image-error.typ") --- // Test configuring the size and fitting behaviour of images. // Fit to width of page. -#[image "res/rhino.png"] +#image("res/rhino.png") // Fit to height of page. -#[page height: 40pt][ - #[image "res/rhino.png"] -] +#page(height: 40pt, image("res/rhino.png")) // Set width explicitly. -#[image "res/rhino.png", width: 50pt] +#image("res/rhino.png", width: 50pt) // Set height explicitly. -#[image "res/rhino.png", height: 50pt] +#image("res/rhino.png", height: 50pt) // Set width and height explicitly and force stretching. -#[image "res/rhino.png", width: 25pt, height: 50pt] +#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] -] +#align(bottom, right, image("res/tiger.jpg", width: 60pt)) diff --git a/tests/library/typ/page.typ b/tests/library/typ/page.typ index 8a9604ad..b7ac0348 100644 --- a/tests/library/typ/page.typ +++ b/tests/library/typ/page.typ @@ -1,53 +1,53 @@ // Test configuring page sizes and margins. // Set width and height. -#[page width: 120pt, height: 120pt] -#[page width: 40pt][High] -#[page height: 40pt][Wide] +#page(width: 120pt, height: 120pt) +#page(width: 40pt)[High] +#page(height: 40pt)[Wide] // Set all margins at once. -#[page margins: 30pt][ - #[align top, left][TL] - #[align bottom, right][BR] +#page(margins: 30pt)[ + #align(top, left)[TL] + #align(bottom, right)[BR] ] // Set individual margins. -#[page height: 40pt] -#[page left: 0pt | align left][Left] -#[page right: 0pt | align right][Right] -#[page top: 0pt | align top][Top] -#[page bottom: 0pt | align bottom][Bottom] +#page(height: 40pt) +#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: 20pt][Overriden] +#page(margins: 0pt, left: 20pt)[Overriden] -// Error: 8-19 unknown variable -#[page nonexistant] +// Error: 7-18 unknown variable +#page(nonexistant) -// Error: 18-21 aligned axis -#[page main-dir: ltr] +// Error: 17-20 aligned axis +#page(main-dir: ltr) // Flipped predefined paper. -#[page "a11", flip: true][Flipped A11] +#page("a11", flip: true)[Flipped A11] // Flipped custom page size. -#[page width: 40pt, height: 120pt] -#[page flip: true] +#page(width: 40pt, height: 120pt) +#page(flip: true) Wide // Test changing the layouting directions of pages. -#[page height: 50pt, main-dir: btt, cross-dir: rtl] +#page(height: 50pt, main-dir: btt, cross-dir: rtl) Right to left! --- // Test a combination of pages with bodies and normal content. -#[page height: 50pt] +#page(height: 50pt) -#[page][First] -#[page][Second] -#[pagebreak] +#page[First] +#page[Second] +#pagebreak() Fourth -#[page][] +#page[] Sixth -#[page][Seventh and last] +#page[Seventh and last] diff --git a/tests/library/typ/pagebreak.typ b/tests/library/typ/pagebreak.typ index 08dd9c7b..dc3e5682 100644 --- a/tests/library/typ/pagebreak.typ +++ b/tests/library/typ/pagebreak.typ @@ -1,3 +1,3 @@ First of two -#[pagebreak] -#[page height: 40pt] +#pagebreak() +#page(height: 40pt) diff --git a/tests/library/typ/rgb.typ b/tests/library/typ/rgb.typ index 06f7be52..b962bbc0 100644 --- a/tests/library/typ/rgb.typ +++ b/tests/library/typ/rgb.typ @@ -1,17 +1,17 @@ // Check the output. -#[rgb 0.0, 0.3, 0.7] +#rgb(0.0, 0.3, 0.7) // Alpha channel. -#[rgb 1.0, 0.0, 0.0, 0.5] +#rgb(1.0, 0.0, 0.0, 0.5) -// Warning: 2:7-2:10 should be between 0.0 and 1.0 -// Warning: 1:12-1:16 should be between 0.0 and 1.0 -#[rgb -30, 15.5, 0.5] +// Warning: 2:6-2:9 should be between 0.0 and 1.0 +// Warning: 1:11-1:15 should be between 0.0 and 1.0 +#rgb(-30, 15.5, 0.5) -// Error: 7-11 missing argument: blue component -#[rgb 0, 1] +// Error: 6-10 missing argument: blue component +#rgb(0, 1) // Error: 3:6-3:6 missing argument: red component // Error: 2:6-2:6 missing argument: green component // Error: 1:6-1:6 missing argument: blue component -#[rgb] +#rgb() |
