Hi rendering-core!
I wanted to publicize a
newly supported feature in run_web_tests.py for WPT tests - fuzzy matching for reftests (or 'fuzzy reftests' for short). This feature is enabled by including a meta tag in the reftest (
example):
<meta name=fuzzy content="maxDifference=0-15;totalPixels=0-300">
The 'maxDifference' and 'totalPixels' variables define the maximum difference in any of the RGB channels and the total number of pixels that are allowed to differ respectively. They are a bit complicated, so check out the
full documentation for details. The variable names can be omitted for conciseness - the above is equivalent to:
<meta name=fuzzy content="0-15;0-300">
One Chromium-specific tip; if you pass
--debug-rwt-logging to
run_web_tests.py, you will be able to see the output lines from the underlying
image_diff.cc code. This is helpful when trying to determine the fuzzy bounds for a test, e.g.:
./third_party/blink/tools/run_web_tests.py --debug-rwt-logging external/wpt/css/css-images/image-orientation/image-orientation-none-content-images.html
...
19:56:32.029 1717778 "/usr/local/google/home/smcgruer/chromium/src/out/Release/image_diff --diff /tmp/tmpY0o691/actual.png /tmp/tmpY0o691/expected.png /tmp/tmpY0o691/diff.png --fuzzy-max-channel-diff=0-5 --fuzzy-max-pixels-diff=0-150" took 0.05s
19:56:32.030 1717778 Found pixels_different: 121, max_channel_diff: 3
Allowed pixels different; 0-150, channel diff: 0-5
We hope this feature will be useful to y'all, in enabling more testing of features that would be otherwise affected by subpixel shift or AA. Feedback and questions are most welcome. I personally think there's a lot of scope to improve fuzzy reftests, but we're starting with at least supporting them :)
Thanks,
Stephen
--