diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-10-05 18:51:21 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-10-05 18:51:21 +0200 |
| commit | dcdcf53831aa477b575c9e6ab37eb64f14317c74 (patch) | |
| tree | 43b742ddbcb623254d8d6e6e65d2c432cb7509e8 /tests/typ/elements/image.typ | |
| parent | 5e06941c63425ab10e08e4d533939c7309cfe6ce (diff) | |
Rename insert/ to elements/
Diffstat (limited to 'tests/typ/elements/image.typ')
| -rw-r--r-- | tests/typ/elements/image.typ | 44 |
1 files changed, 44 insertions, 0 deletions
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") |
