diff options
| author | frozolotl <44589151+frozolotl@users.noreply.github.com> | 2025-01-31 10:56:25 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-31 09:56:25 +0000 |
| commit | 3eb6e87af1d8870a38cc5914e345d07373e1e8c1 (patch) | |
| tree | 800de2bc1ed9a5c7f8efc21e2741c0cd5c4728f6 /tests | |
| parent | be1fa91a00a9bff6c5eb9744266f252b8cc23fe4 (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')
21 files changed, 128 insertions, 0 deletions
diff --git a/tests/ref/baseline-box.png b/tests/ref/baseline-box.png Binary files differindex 2a9e5175..e07e22ea 100644 --- a/tests/ref/baseline-box.png +++ b/tests/ref/baseline-box.png diff --git a/tests/ref/box-clip-outset.png b/tests/ref/box-clip-outset.png Binary files differindex 21538e85..8ea40e96 100644 --- a/tests/ref/box-clip-outset.png +++ b/tests/ref/box-clip-outset.png diff --git a/tests/ref/box-clip-radius-without-stroke.png b/tests/ref/box-clip-radius-without-stroke.png Binary files differindex 12137358..2be772cc 100644 --- a/tests/ref/box-clip-radius-without-stroke.png +++ b/tests/ref/box-clip-radius-without-stroke.png diff --git a/tests/ref/box-clip-radius.png b/tests/ref/box-clip-radius.png Binary files differindex da20fa5b..530d5330 100644 --- a/tests/ref/box-clip-radius.png +++ b/tests/ref/box-clip-radius.png diff --git a/tests/ref/closure-path-resolve-in-layout-phase.png b/tests/ref/closure-path-resolve-in-layout-phase.png Binary files differindex baaed356..a3d69998 100644 --- a/tests/ref/closure-path-resolve-in-layout-phase.png +++ b/tests/ref/closure-path-resolve-in-layout-phase.png diff --git a/tests/ref/coma.png b/tests/ref/coma.png Binary files differindex 2c59ae87..a1d743a4 100644 --- a/tests/ref/coma.png +++ b/tests/ref/coma.png diff --git a/tests/ref/footnote-in-caption.png b/tests/ref/footnote-in-caption.png Binary files differindex 12a5fde5..79b2b5d0 100644 --- a/tests/ref/footnote-in-caption.png +++ b/tests/ref/footnote-in-caption.png diff --git a/tests/ref/footnote-in-table.png b/tests/ref/footnote-in-table.png Binary files differindex 062a6fc7..e110eac6 100644 --- a/tests/ref/footnote-in-table.png +++ b/tests/ref/footnote-in-table.png diff --git a/tests/ref/image-baseline-with-box.png b/tests/ref/image-baseline-with-box.png Binary files differindex dc8e8bc5..ade90e2f 100644 --- a/tests/ref/image-baseline-with-box.png +++ b/tests/ref/image-baseline-with-box.png diff --git a/tests/ref/image-decode-detect-format.png b/tests/ref/image-decode-detect-format.png Binary files differindex 6ecb7dcd..cee71bb9 100644 --- a/tests/ref/image-decode-detect-format.png +++ b/tests/ref/image-decode-detect-format.png diff --git a/tests/ref/image-decode-specify-format.png b/tests/ref/image-decode-specify-format.png Binary files differindex 6ecb7dcd..cee71bb9 100644 --- a/tests/ref/image-decode-specify-format.png +++ b/tests/ref/image-decode-specify-format.png diff --git a/tests/ref/image-fit.png b/tests/ref/image-fit.png Binary files differindex 24946fdb..432daf74 100644 --- a/tests/ref/image-fit.png +++ b/tests/ref/image-fit.png diff --git a/tests/ref/image-pixmap-luma8.png b/tests/ref/image-pixmap-luma8.png Binary files differnew file mode 100644 index 00000000..cf5790cb --- /dev/null +++ b/tests/ref/image-pixmap-luma8.png diff --git a/tests/ref/image-pixmap-lumaa8.png b/tests/ref/image-pixmap-lumaa8.png Binary files differnew file mode 100644 index 00000000..b8eea6fd --- /dev/null +++ b/tests/ref/image-pixmap-lumaa8.png diff --git a/tests/ref/image-pixmap-rgb8.png b/tests/ref/image-pixmap-rgb8.png Binary files differnew file mode 100644 index 00000000..d905c1ee --- /dev/null +++ b/tests/ref/image-pixmap-rgb8.png diff --git a/tests/ref/image-pixmap-rgba8.png b/tests/ref/image-pixmap-rgba8.png Binary files differnew file mode 100644 index 00000000..b87a6e41 --- /dev/null +++ b/tests/ref/image-pixmap-rgba8.png diff --git a/tests/ref/image-scaling-methods.png b/tests/ref/image-scaling-methods.png Binary files differnew file mode 100644 index 00000000..9d543e11 --- /dev/null +++ b/tests/ref/image-scaling-methods.png diff --git a/tests/ref/image-sizing.png b/tests/ref/image-sizing.png Binary files differindex e1201cf2..7cb59fc7 100644 --- a/tests/ref/image-sizing.png +++ b/tests/ref/image-sizing.png diff --git a/tests/ref/issue-4361-transparency-leak.png b/tests/ref/issue-4361-transparency-leak.png Binary files differindex 4060d43a..66079816 100644 --- a/tests/ref/issue-4361-transparency-leak.png +++ b/tests/ref/issue-4361-transparency-leak.png diff --git a/tests/ref/pad-followed-by-content.png b/tests/ref/pad-followed-by-content.png Binary files differindex 90b48232..534a9787 100644 --- a/tests/ref/pad-followed-by-content.png +++ b/tests/ref/pad-followed-by-content.png 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 |
