tingerrr / typst-test

A visual regression test runner for typst packages.
MIT License
18 stars 1 forks source link

Diff images are not being generated for page size differences #8

Open fenjalien opened 5 months ago

fenjalien commented 5 months ago

Built from commit version: ce06d7e Rust: 1.75.0 Platform: Windows 11 Home 22H2 Repository: https://github.com/fenjalien/metro/

Running typst-test run works as expected apart from the diff images are not being generated in the diff folders. I've linked the repository I'm having the issue with.

fenjalien commented 5 months ago

Okay diffs are created in https://github.com/johannes-wolf/cetz/pull/470 with the same machine so I really don't know whats going on.

tingerrr commented 5 months ago

Well, good news first, I can reproduce it. Bad news, I have no idea how this could happen, the save_diff_image must be executed successfully before a page difference is even reported.

EDIT: when running with maximum verbosity, it seems the function is not called as its span doesn't show up.

tingerrr commented 5 months ago

The culprit was actually the reporting incorrectly hinting that diff images were created when the images differed in dimensions, this is not the case it should've reported that the ref and output didn't match dimensions.

tingerrr commented 5 months ago

Fixed in 3d2f1bc.

fenjalien commented 5 months ago

Thanks for fixing this so quickly! This does introduce another issue though when using auto width and height for the page. You can't see whats caused the dimension change only that it has changed. For most use cases this would be a non-issue as you can just use a defined size, but for testing CeTZ we use auto width and height.

Let me know if you want this in a new issue but could the diff be generated even if the sizes do not match?

tingerrr commented 5 months ago

I don't think anything is inherently stopping us from creating diff images for mismatched sizes. I'll reopen this as it's technically correct.

EDIT: Since better diff images have been on my agenda anyway, I'll just lump this in with them as it comes with the "complexity" of creating a good visual aids for what's new/old/changed especially if dimensions and images wildly differ.