Repository navigation
Progressive AVIF tests - #62764
Progressive AVIF tests#62764jakearchibald wants to merge 1 commit into
Conversation
|
There are no reviewers for this pull request. Please reach out on the chat room to get help with this. Thank you! |
| // A second image, requested after the one under test, whose completion is | ||
| // the signal to screenshot. | ||
| // | ||
| // The question this answers is "have the bytes of the layer under test been | ||
| // delivered yet", and a barrier resource answers it causally rather than by | ||
| // guessing at a wall-clock duration. | ||
| // | ||
| // It is a plain unlayered AVIF, so completing it means the image decoding | ||
| // pipeline has taken in and finished a resource queued *after* the one under | ||
| // test. | ||
| // | ||
| // It is trickled like the image under test so that both travel the same | ||
| // wptserve pipe machinery rather than one taking a different path through | ||
| // the server, and because trickle sets no-store, so the barrier stays a real | ||
| // network fetch on every test instead of an instant cache hit. | ||
| const kBarrierSrc = "/images/green.avif?pipe=trickle(d0)"; |
There was a problem hiding this comment.
This is worth thinking about. I couldn't come up with a better way to decide "the browser would have done a progressive render now if it could". The alternative would be a timeout, but this seems less flaky. I tested it under CPU load locally and Chrome still correctly passes.
|
So I ran some AI on this PR and it highlighted two potential issues.
There are three reasons that doesn't actually work:
Why this test misses those bugs: Every pixel is identical: The 25×25 preview layer in both scaled tests is completely solid blue (and completely uniform 50% see-through in the alpha test). Think of averaging two numbers: (10 + 10) / 2 = 10. If every pixel next to every other pixel has the exact same color and transparency, you can't tell whether the blending math between neighboring pixels is broken! While a solid 50%-transparent box would still catch one bug (like accidentally multiplying by 50% twice and washing out the color), it won't catch wrong color/alpha weighting across edges—and a solid blue box also won't catch if the decoder cropped, flipped, distorted, or stretched pixels unevenly inside the 100×100 square. How to fix it: |
|
I'm open to solutions to the race. It seems to work ok now. The AI response doesn't offer a suggestion unless I'm missing something. |
|
I asked for one for the race. This is what I got back: |
|
Hmmmmm I'm not sure folks are keen on tests that take seconds to fail. That's exactly what I was trying to avoid. |
This tests progressive rendering support for AVIF. Chrome correctly passes, and Firefox/Safari correctly fail.