Skip to content

Commit

Permalink
Bug 1551088 - Part 8. Add reftest annotations for slight premultiplic…
Browse files Browse the repository at this point in the history
…ation differences. r=tnikkel

Differential Revision: https://phabricator.services.mozilla.com/D46451
  • Loading branch information
aosmond committed Sep 24, 2019
1 parent f4261e1 commit 54fc490
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 16 deletions.
13 changes: 12 additions & 1 deletion browser/tools/mozscreenshots/browser_screenshots_cropping.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,18 @@ async function compareImages(window, expected, test) {
"The test and expected images must be the same size"
);

return window.windowUtils.compareCanvases(expectedCanvas, testCanvas, {});
var maxDifference = {};
var differences = window.windowUtils.compareCanvases(
expectedCanvas,
testCanvas,
maxDifference
);

// Fuzz for minor differences that can be caused by the encoder.
if (maxDifference.value > 1) {
return differences;
}
return 0;
}

async function cropAndCompare(window, src, expected, test, region, subregions) {
Expand Down
2 changes: 1 addition & 1 deletion image/test/reftest/ico/cur/reftest.list
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ICO BMP and PNG mixed tests

== wrapper.html?pointer.cur wrapper.html?pointer.png
fuzzy(1-1,67-67) == wrapper.html?pointer.cur wrapper.html?pointer.png

2 changes: 1 addition & 1 deletion image/test/reftest/ico/ico-bmp-32bpp/reftest.list
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
== ico-size-256x256-32bpp.ico ico-size-256x256-32bpp.png
== ico-partial-transparent-32bpp.ico ico-partial-transparent-32bpp.png
== ico-transparent-32bpp.ico ico-transparent-32bpp.png
== ico-not-square-transparent-32bpp.ico ico-not-square-transparent-32bpp.png
fuzzy(1-1,81-81) == ico-not-square-transparent-32bpp.ico ico-not-square-transparent-32bpp.png
2 changes: 1 addition & 1 deletion image/test/reftest/ico/ico-mixed/reftest.list
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# ICO BMP and PNG mixed tests

== mixed-bmp-png.ico mixed-bmp-png48.png
fuzzy(1-1,407-407) == mixed-bmp-png.ico mixed-bmp-png48.png
2 changes: 1 addition & 1 deletion image/test/reftest/ico/ico-png/reftest.list
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@
== wrapper.html?xcrn0g04.ico about:blank

# Test ICO PNG transparency
== transparent-png.ico transparent-png.png
fuzzy(1-1,29-29) == transparent-png.ico transparent-png.png

16 changes: 8 additions & 8 deletions image/test/reftest/pngsuite-background/reftest.list
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
# identically and thus share common reference HTML files.

# bgai4a08 - 8 bit grayscale, alpha, no background chunk, interlaced
fuzzy-if(cocoaWidget||skiaContent,0-1,0-1024) == wrapper.html?bgai4a08.png bg__4a08.html
fuzzy(0-2,0-1024) == wrapper.html?bgai4a08.png bg__4a08.html
# bgai4a16 - 16 bit grayscale, alpha, no background chunk, interlaced
fuzzy-if(cocoaWidget||skiaContent,0-1,0-1024) == wrapper.html?bgai4a16.png bg__4a16.html
fuzzy(0-2,0-1024) == wrapper.html?bgai4a16.png bg__4a16.html
# bgan6a08 - 3x8 bits rgb color, alpha, no background chunk
fuzzy-if(cocoaWidget||skiaContent,0-1,0-1024) == wrapper.html?bgan6a08.png bg__6a08.html
fuzzy(0-2,0-1024) == wrapper.html?bgan6a08.png bg__6a08.html
# bgan6a16 - 3x16 bits rgb color, alpha, no background chunk
fuzzy-if(cocoaWidget||skiaContent,0-1,0-1024) == wrapper.html?bgan6a16.png bg__6a16.html
fuzzy(0-2,0-1024) == wrapper.html?bgan6a16.png bg__6a16.html
# bgbn4a08 - 8 bit grayscale, alpha, black background chunk
fuzzy-if(cocoaWidget||skiaContent,0-1,0-1024) == wrapper.html?bgbn4a08.png bg__4a08.html
fuzzy(0-2,0-1024) == wrapper.html?bgbn4a08.png bg__4a08.html
# bggn4a16 - 16 bit grayscale, alpha, gray background chunk
fuzzy-if(cocoaWidget||skiaContent,0-1,0-1024) == wrapper.html?bggn4a16.png bg__4a16.html
fuzzy(0-2,0-1024) == wrapper.html?bggn4a16.png bg__4a16.html
# bgwn6a08 - 3x8 bits rgb color, alpha, white background chunk
fuzzy-if(cocoaWidget||skiaContent,0-1,0-1024) == wrapper.html?bgwn6a08.png bg__6a08.html
fuzzy(0-2,0-1024) == wrapper.html?bgwn6a08.png bg__6a08.html
# bgyn6a16 - 3x16 bits rgb color, alpha, yellow background chunk
fuzzy-if(cocoaWidget||skiaContent,0-1,0-1024) == wrapper.html?bgyn6a16.png bg__6a16.html
fuzzy(0-2,0-1024) == wrapper.html?bgyn6a16.png bg__6a16.html
Binary file modified image/test/unit/image1png16x16.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified image/test/unit/image1png64x64.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions image/test/unit/test_imgtools.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function run_test() {
var refName = "image1png16x16.jpg";
var refFile = do_get_file(refName);
istream = getFileInputStream(refFile);
Assert.equal(istream.available(), 1051);
Assert.equal(istream.available(), 1054);
var referenceBytes = streamToArray(istream);

// compare the encoder's output to the reference file.
Expand All @@ -186,7 +186,7 @@ function run_test() {
refName = "image1png64x64.jpg";
refFile = do_get_file(refName);
istream = getFileInputStream(refFile);
Assert.equal(istream.available(), 4503);
Assert.equal(istream.available(), 4507);
referenceBytes = streamToArray(istream);

// compare the encoder's output to the reference file.
Expand Down
2 changes: 1 addition & 1 deletion layout/reftests/bugs/reftest.list
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ fuzzy-if(Android,0-3,0-50) fuzzy-if(skiaContent,0-1,0-133) == 273681-1.html 2736
== 283686-2.html 283686-2-ref.html
== 283686-3.html about:blank
== 289384-1.xhtml 289384-ref.xhtml
random-if(d2d) fuzzy-if(Android,0-8,0-1439) fuzzy-if(webrender,0-9,0-2024) HTTP == 289480.html#top 289480-ref.html # basically-verbatim acid2 test, HTTP for a 404 page -- bug 578114 for the d2d failures
random-if(d2d) fuzzy(0-1,0-16) fuzzy-if(Android,0-8,0-1439) fuzzy-if(webrender,0-9,0-2024) HTTP == 289480.html#top 289480-ref.html # basically-verbatim acid2 test, HTTP for a 404 page -- bug 578114 for the d2d failures
== 290129-1.html 290129-1-ref.html
== 291078-1.html 291078-1-ref.html
== 291078-2.html 291078-2-ref.html
Expand Down

0 comments on commit 54fc490

Please sign in to comment.