Skip to content

Add APNG dispose and blend reference tests#3054

Merged
RunDevelopment merged 1 commit into
image-rs:mainfrom
kesmeey:apng-dispose-blend-reference-tests
Jun 26, 2026
Merged

Add APNG dispose and blend reference tests#3054
RunDevelopment merged 1 commit into
image-rs:mainfrom
kesmeey:apng-dispose-blend-reference-tests

Conversation

@kesmeey

@kesmeey kesmeey commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Closes #3052.

This adds reference tests for all APNG dispose/blend operation combinations using the existing reference image infrastructure. No test harness or decoder code is changed.

Four APNG inputs are copied byte-for-byte from Web Platform Tests and renamed after the behavior they exercise:

  • support/013.png -> fcTL-dispose-in-region-none.png
  • support/015.png -> fcTL-dispose-in-region-background.png
  • support/016.png -> fcTL-dispose-in-region-previous.png
  • support/018.png -> fcTL-blend-source-transparent.png

WPT does not currently include APNG files for the background+source and previous+source combinations, so this also adds two minimal derived APNGs for those missing cases:

  • dispose-background-blend-source.png
  • dispose-previous-blend-source.png

The reference frames were generated with APNG Disassembler 2.9 (apngdis), independently of this crate's PNG decoder.

WPT attribution is included in tests/images/png/apng/wpt/README.txt, and the WPT BSD-3-Clause license is included in tests/images/png/apng/wpt/LICENSE.md.

I used AI assistance while creating and reviewing these test assets.

@RunDevelopment

Copy link
Copy Markdown
Member

Thanks for working on this. This looks much better. Just one thing:

The APNG files are minimal 3x1 images derived from the Web Platform Tests APNG dispose/blend cases.

Is there a reason why you did this?

Unfortunately, this makes it harder to review and verify correctness. Had you copied the WPT files as is, I could just look at the decoded frames and use WPT as the reference for what they should be. Now I have to analyze the APNGs you added to see whether they actually have the properties they should. And if they do, I can't use WPT as a reference to check whether our decoder actually decodes them correctly.

So unless there's a good reason for using 3x1 images, could you please use the WPT APNGs as is?

@kesmeey kesmeey force-pushed the apng-dispose-blend-reference-tests branch from 95f3bed to f52ad41 Compare June 26, 2026 12:28
@kesmeey

kesmeey commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for working on this. This looks much better. Just one thing:

The APNG files are minimal 3x1 images derived from the Web Platform Tests APNG dispose/blend cases.

Is there a reason why you did this?

Unfortunately, this makes it harder to review and verify correctness. Had you copied the WPT files as is, I could just look at the decoded frames and use WPT as the reference for what they should be. Now I have to analyze the APNGs you added to see whether they actually have the properties they should. And if they do, I can't use WPT as a reference to check whether our decoder actually decodes them correctly.

So unless there's a good reason for using 3x1 images, could you please use the WPT APNGs as is?

Thanks, that makes sense.

I updated the PR to copy the available WPT APNG files byte-for-byte and only rename them:

  • support/013.png -> fcTL-dispose-in-region-none.png
  • support/015.png -> fcTL-dispose-in-region-background.png
  • support/016.png -> fcTL-dispose-in-region-previous.png
  • support/018.png -> fcTL-blend-source-transparent.png

WPT does not seem to currently have APNG files for the background+source and previous+source combinations, so
those two are still derived minimal APNGs:

  • dispose-background-blend-source.png
  • dispose-previous-blend-source.png

I also updated the PR description/README to make that distinction clear.

@RunDevelopment RunDevelopment left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I verified that the new images are indeed what the Readme.txt says they are, and everything checks out. Thank you!

@RunDevelopment RunDevelopment merged commit 86e7792 into image-rs:main Jun 26, 2026
61 of 62 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test APNG dispose ops and blend ops

2 participants