summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorfrozolotl <44589151+frozolotl@users.noreply.github.com>2025-01-31 10:56:25 +0100
committerGitHub <noreply@github.com>2025-01-31 09:56:25 +0000
commit3eb6e87af1d8870a38cc5914e345d07373e1e8c1 (patch)
tree800de2bc1ed9a5c7f8efc21e2741c0cd5c4728f6 /tests
parentbe1fa91a00a9bff6c5eb9744266f252b8cc23fe4 (diff)
Include images from raw pixmaps and more (#5632)
Co-authored-by: PgBiel <9021226+PgBiel@users.noreply.github.com> Co-authored-by: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/ref/baseline-box.pngbin3896 -> 4021 bytes
-rw-r--r--tests/ref/box-clip-outset.pngbin1442 -> 1492 bytes
-rw-r--r--tests/ref/box-clip-radius-without-stroke.pngbin1225 -> 1255 bytes
-rw-r--r--tests/ref/box-clip-radius.pngbin1245 -> 1250 bytes
-rw-r--r--tests/ref/closure-path-resolve-in-layout-phase.pngbin2193 -> 2256 bytes
-rw-r--r--tests/ref/coma.pngbin28740 -> 28615 bytes
-rw-r--r--tests/ref/footnote-in-caption.pngbin6111 -> 6154 bytes
-rw-r--r--tests/ref/footnote-in-table.pngbin12380 -> 12727 bytes
-rw-r--r--tests/ref/image-baseline-with-box.pngbin6375 -> 6375 bytes
-rw-r--r--tests/ref/image-decode-detect-format.pngbin10648 -> 11032 bytes
-rw-r--r--tests/ref/image-decode-specify-format.pngbin10648 -> 11032 bytes
-rw-r--r--tests/ref/image-fit.pngbin10302 -> 10390 bytes
-rw-r--r--tests/ref/image-pixmap-luma8.pngbin0 -> 321 bytes
-rw-r--r--tests/ref/image-pixmap-lumaa8.pngbin0 -> 299 bytes
-rw-r--r--tests/ref/image-pixmap-rgb8.pngbin0 -> 1220 bytes
-rw-r--r--tests/ref/image-pixmap-rgba8.pngbin0 -> 854 bytes
-rw-r--r--tests/ref/image-scaling-methods.pngbin0 -> 1539 bytes
-rw-r--r--tests/ref/image-sizing.pngbin8662 -> 8925 bytes
-rw-r--r--tests/ref/issue-4361-transparency-leak.pngbin3515 -> 3738 bytes
-rw-r--r--tests/ref/pad-followed-by-content.pngbin11897 -> 12071 bytes
-rw-r--r--tests/suite/visualize/image.typ128
21 files changed, 128 insertions, 0 deletions
diff --git a/tests/ref/baseline-box.png b/tests/ref/baseline-box.png
index 2a9e5175..e07e22ea 100644
--- a/tests/ref/baseline-box.png
+++ b/tests/ref/baseline-box.png
Binary files differ
diff --git a/tests/ref/box-clip-outset.png b/tests/ref/box-clip-outset.png
index 21538e85..8ea40e96 100644
--- a/tests/ref/box-clip-outset.png
+++ b/tests/ref/box-clip-outset.png
Binary files differ
diff --git a/tests/ref/box-clip-radius-without-stroke.png b/tests/ref/box-clip-radius-without-stroke.png
index 12137358..2be772cc 100644
--- a/tests/ref/box-clip-radius-without-stroke.png
+++ b/tests/ref/box-clip-radius-without-stroke.png
Binary files differ
diff --git a/tests/ref/box-clip-radius.png b/tests/ref/box-clip-radius.png
index da20fa5b..530d5330 100644
--- a/tests/ref/box-clip-radius.png
+++ b/tests/ref/box-clip-radius.png
Binary files differ
diff --git a/tests/ref/closure-path-resolve-in-layout-phase.png b/tests/ref/closure-path-resolve-in-layout-phase.png
index baaed356..a3d69998 100644
--- a/tests/ref/closure-path-resolve-in-layout-phase.png
+++ b/tests/ref/closure-path-resolve-in-layout-phase.png
Binary files differ
diff --git a/tests/ref/coma.png b/tests/ref/coma.png
index 2c59ae87..a1d743a4 100644
--- a/tests/ref/coma.png
+++ b/tests/ref/coma.png
Binary files differ
diff --git a/tests/ref/footnote-in-caption.png b/tests/ref/footnote-in-caption.png
index 12a5fde5..79b2b5d0 100644
--- a/tests/ref/footnote-in-caption.png
+++ b/tests/ref/footnote-in-caption.png
Binary files differ
diff --git a/tests/ref/footnote-in-table.png b/tests/ref/footnote-in-table.png
index 062a6fc7..e110eac6 100644
--- a/tests/ref/footnote-in-table.png
+++ b/tests/ref/footnote-in-table.png
Binary files differ
diff --git a/tests/ref/image-baseline-with-box.png b/tests/ref/image-baseline-with-box.png
index dc8e8bc5..ade90e2f 100644
--- a/tests/ref/image-baseline-with-box.png
+++ b/tests/ref/image-baseline-with-box.png
Binary files differ
diff --git a/tests/ref/image-decode-detect-format.png b/tests/ref/image-decode-detect-format.png
index 6ecb7dcd..cee71bb9 100644
--- a/tests/ref/image-decode-detect-format.png
+++ b/tests/ref/image-decode-detect-format.png
Binary files differ
diff --git a/tests/ref/image-decode-specify-format.png b/tests/ref/image-decode-specify-format.png
index 6ecb7dcd..cee71bb9 100644
--- a/tests/ref/image-decode-specify-format.png
+++ b/tests/ref/image-decode-specify-format.png
Binary files differ
diff --git a/tests/ref/image-fit.png b/tests/ref/image-fit.png
index 24946fdb..432daf74 100644
--- a/tests/ref/image-fit.png
+++ b/tests/ref/image-fit.png
Binary files differ
diff --git a/tests/ref/image-pixmap-luma8.png b/tests/ref/image-pixmap-luma8.png
new file mode 100644
index 00000000..cf5790cb
--- /dev/null
+++ b/tests/ref/image-pixmap-luma8.png
Binary files differ
diff --git a/tests/ref/image-pixmap-lumaa8.png b/tests/ref/image-pixmap-lumaa8.png
new file mode 100644
index 00000000..b8eea6fd
--- /dev/null
+++ b/tests/ref/image-pixmap-lumaa8.png
Binary files differ
diff --git a/tests/ref/image-pixmap-rgb8.png b/tests/ref/image-pixmap-rgb8.png
new file mode 100644
index 00000000..d905c1ee
--- /dev/null
+++ b/tests/ref/image-pixmap-rgb8.png
Binary files differ
diff --git a/tests/ref/image-pixmap-rgba8.png b/tests/ref/image-pixmap-rgba8.png
new file mode 100644
index 00000000..b87a6e41
--- /dev/null
+++ b/tests/ref/image-pixmap-rgba8.png
Binary files differ
diff --git a/tests/ref/image-scaling-methods.png b/tests/ref/image-scaling-methods.png
new file mode 100644
index 00000000..9d543e11
--- /dev/null
+++ b/tests/ref/image-scaling-methods.png
Binary files differ
diff --git a/tests/ref/image-sizing.png b/tests/ref/image-sizing.png
index e1201cf2..7cb59fc7 100644
--- a/tests/ref/image-sizing.png
+++ b/tests/ref/image-sizing.png
Binary files differ
diff --git a/tests/ref/issue-4361-transparency-leak.png b/tests/ref/issue-4361-transparency-leak.png
index 4060d43a..66079816 100644
--- a/tests/ref/issue-4361-transparency-leak.png
+++ b/tests/ref/issue-4361-transparency-leak.png
Binary files differ
diff --git a/tests/ref/pad-followed-by-content.png b/tests/ref/pad-followed-by-content.png
index 90b48232..534a9787 100644
--- a/tests/ref/pad-followed-by-content.png
+++ b/tests/ref/pad-followed-by-content.png
Binary files differ
diff --git a/tests/suite/visualize/image.typ b/tests/suite/visualize/image.typ
index 846650c6..6f6e1a15 100644
--- a/tests/suite/visualize/image.typ
+++ b/tests/suite/visualize/image.typ
@@ -65,6 +65,82 @@ A #box(image("/assets/images/tiger.jpg", height: 1cm, width: 80%)) B
caption: [Bilingual text]
)
+--- image-pixmap-rgb8 ---
+#image(
+ bytes((
+ 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80,
+ 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0x80,
+ )),
+ format: (
+ encoding: "rgb8",
+ width: 3,
+ height: 3,
+ ),
+ width: 1cm,
+)
+
+--- image-pixmap-rgba8 ---
+#image(
+ bytes((
+ 0xFF, 0x00, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0xFF,
+ 0xFF, 0x00, 0x00, 0x80, 0x00, 0xFF, 0x00, 0x80, 0x00, 0x00, 0xFF, 0x80,
+ 0xFF, 0x00, 0x00, 0x10, 0x00, 0xFF, 0x00, 0x10, 0x00, 0x00, 0xFF, 0x10,
+ )),
+ format: (
+ encoding: "rgba8",
+ width: 3,
+ height: 3,
+ ),
+ width: 1cm,
+)
+
+--- image-pixmap-luma8 ---
+#image(
+ bytes(range(16).map(x => x * 16)),
+ format: (
+ encoding: "luma8",
+ width: 4,
+ height: 4,
+ ),
+ width: 1cm,
+)
+
+--- image-pixmap-lumaa8 ---
+#image(
+ bytes(range(16).map(x => (0x80, x * 16)).flatten()),
+ format: (
+ encoding: "lumaa8",
+ width: 4,
+ height: 4,
+ ),
+ width: 1cm,
+)
+
+--- image-scaling-methods ---
+#let img(scaling) = image(
+ bytes((
+ 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF,
+ 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80,
+ 0x80, 0x80, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0x80,
+ )),
+ format: (
+ encoding: "rgb8",
+ width: 3,
+ height: 3,
+ ),
+ width: 1cm,
+ scaling: scaling,
+)
+
+#stack(
+ dir: ltr,
+ spacing: 4pt,
+ img(auto),
+ img("smooth"),
+ img("pixelated"),
+)
+
--- image-natural-dpi-sizing ---
// Test that images aren't upscaled.
// Image is just 48x80 at 220dpi. It should not be scaled to fit the page
@@ -103,6 +179,58 @@ A #box(image("/assets/images/tiger.jpg", height: 1cm, width: 80%)) B
// Error: 2-91 failed to decode image (Format error decoding Png: Invalid PNG signature.)
#image.decode(read("/assets/images/tiger.jpg", encoding: none), format: "png", width: 80%)
+--- image-pixmap-empty ---
+// Error: 1:2-8:2 zero-sized images are not allowed
+#image(
+ bytes(()),
+ format: (
+ encoding: "rgb8",
+ width: 0,
+ height: 0,
+ ),
+)
+
+--- image-pixmap-invalid-size ---
+// Error: 1:2-8:2 pixel dimensions and pixel data do not match
+#image(
+ bytes((0x00, 0x00, 0x00)),
+ format: (
+ encoding: "rgb8",
+ width: 16,
+ height: 16,
+ ),
+)
+
+--- image-pixmap-unknown-attribute ---
+#image(
+ bytes((0x00, 0x00, 0x00)),
+ // Error: 1:11-6:4 unexpected key "stowaway", valid keys are "encoding", "width", and "height"
+ format: (
+ encoding: "rgb8",
+ width: 1,
+ height: 1,
+ stowaway: "I do work here, promise",
+ ),
+)
+
+--- image-pixmap-but-png-format ---
+#image(
+ bytes((0x00, 0x00, 0x00)),
+ // Error: 1:11-5:4 expected "rgb8", "rgba8", "luma8", or "lumaa8"
+ format: (
+ encoding: "png",
+ width: 1,
+ height: 1,
+ ),
+)
+
+--- image-png-but-pixmap-format ---
+#image(
+ read("/assets/images/tiger.jpg", encoding: none),
+ // Error: 11-18 expected "png", "jpg", "gif", dictionary, "svg", or auto
+ format: "rgba8",
+)
+
--- issue-870-image-rotation ---
// Ensure that EXIF rotation is applied.
// https://github.com/image-rs/image/issues/1045