Title: [284938] trunk
Revision
284938
Author
simon.fra...@apple.com
Date
2021-10-27 12:45:14 -0700 (Wed, 27 Oct 2021)

Log Message

Preserve image diff precision until display time
https://bugs.webkit.org/show_bug.cgi?id=232365

Reviewed by Martin Robinson.

Tools:

Keep the precise image diff percentage value, saving it in full_results.json, and
only round it at presentation time in results.html.

* Scripts/webkitpy/port/image_diff.py:
(ImageDiffer._read):
* Scripts/webkitpy/port/port_testcase.py:
(PortTestCase.test_diff_image_failed_with_rounded_diff):

LayoutTests:

* fast/harness/full_results.json:
* fast/harness/results-expected.txt:
* fast/harness/results.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (284937 => 284938)


--- trunk/LayoutTests/ChangeLog	2021-10-27 19:41:12 UTC (rev 284937)
+++ trunk/LayoutTests/ChangeLog	2021-10-27 19:45:14 UTC (rev 284938)
@@ -1,3 +1,14 @@
+2021-10-27  Simon Fraser  <simon.fra...@apple.com>
+
+        Preserve image diff precision until display time
+        https://bugs.webkit.org/show_bug.cgi?id=232365
+
+        Reviewed by Martin Robinson.
+
+        * fast/harness/full_results.json:
+        * fast/harness/results-expected.txt:
+        * fast/harness/results.html:
+
 2021-10-27  Arcady Goldmints-Orlov  <agoldmi...@igalia.com>
 
         [GLIB] Remove tests that now pass from test expectations. Unreviewed test gardening.

Modified: trunk/LayoutTests/fast/harness/full_results.json (284937 => 284938)


--- trunk/LayoutTests/fast/harness/full_results.json	2021-10-27 19:41:12 UTC (rev 284937)
+++ trunk/LayoutTests/fast/harness/full_results.json	2021-10-27 19:45:14 UTC (rev 284938)
@@ -16,11 +16,23 @@
                         "report": "REGRESSION",
                         "expected": "PASS",
                         "actual": "IMAGE LEAK",
-                        "image_diff_percent": 0.26,
+                        "image_diff_percent": 0.261234,
                         "leaks": [{
                             "document": "http://localhost:8800/WebKit/cache-storage/image-fail-with-leak.html",
                         }]
                     },
+                    "image-fail.html": {
+                        "report": "REGRESSION",
+                        "expected": "PASS",
+                        "actual": "IMAGE",
+                        "image_diff_percent": 86.262301
+                    },
+                    "tiny-image-fail.html": {
+                        "report": "REGRESSION",
+                        "expected": "PASS",
+                        "actual": "IMAGE",
+                        "image_diff_percent": 0.002
+                    },
                     "leaky-worker.html": {
                         "report": "REGRESSION",
                         "expected": "PASS",

Modified: trunk/LayoutTests/fast/harness/results-expected.txt (284937 => 284938)


--- trunk/LayoutTests/fast/harness/results-expected.txt	2021-10-27 19:41:12 UTC (rev 284937)
+++ trunk/LayoutTests/fast/harness/results-expected.txt	2021-10-27 19:45:14 UTC (rev 284938)
@@ -10,7 +10,7 @@
 
 +DumpRenderTree-54888	crash log
 +DumpRenderTree-56804	crash log
-Tests that failed text/pixel/audio diff (5): flag all
+Tests that failed text/pixel/audio diff (7): flag all
 
  test 	results	image results	actual failure	expected failure	history
 +css1/font_properties/font_family.html	expected actual diff pretty diff	images	text missing		history
@@ -17,7 +17,9 @@
 +http/tests/storageAccess/request-storage-access-top-frame.html	expected actual diff pretty diff		text	pass timeout	history
 +http/wpt/cache-storage/cache-put-keys.https.any.worker.html	expected actual diff pretty diff		text	pass	history
 +http/wpt/cache-storage/image-fail-with-leak.html		images diff (0.26%)	image leak	pass	history
++http/wpt/cache-storage/image-fail.html		images diff (86.26%)	image	pass	history
 +http/wpt/cache-storage/leaky-worker.html			leak	pass	history
++http/wpt/cache-storage/tiny-image-fail.html		images diff (0.01%)	image	pass	history
 Tests that had no expected results (probably new) (1): flag all
 
 test	results	image results	actual failure	expected failure	history

Modified: trunk/LayoutTests/fast/harness/results.html (284937 => 284938)


--- trunk/LayoutTests/fast/harness/results.html	2021-10-27 19:41:12 UTC (rev 284937)
+++ trunk/LayoutTests/fast/harness/results.html	2021-10-27 19:45:14 UTC (rev 284938)
@@ -1415,7 +1415,7 @@
                     result += TestResultsController.resultLink(testPrefix, '-actual.png', 'actual');
                 }
 
-                let diff = testResult.info.image_diff_percent;
+                let diff = Math.max(testResult.info.image_diff_percent, 0.01).toFixed(2);
                 result += TestResultsController.resultLink(testPrefix, '-diff.png', 'diff (' + diff + '%)');
             }
         }

Modified: trunk/Tools/ChangeLog (284937 => 284938)


--- trunk/Tools/ChangeLog	2021-10-27 19:41:12 UTC (rev 284937)
+++ trunk/Tools/ChangeLog	2021-10-27 19:45:14 UTC (rev 284938)
@@ -1,3 +1,18 @@
+2021-10-27  Simon Fraser  <simon.fra...@apple.com>
+
+        Preserve image diff precision until display time
+        https://bugs.webkit.org/show_bug.cgi?id=232365
+
+        Reviewed by Martin Robinson.
+
+        Keep the precise image diff percentage value, saving it in full_results.json, and
+        only round it at presentation time in results.html.
+
+        * Scripts/webkitpy/port/image_diff.py:
+        (ImageDiffer._read):
+        * Scripts/webkitpy/port/port_testcase.py:
+        (PortTestCase.test_diff_image_failed_with_rounded_diff):
+
 2021-10-27  Dmitry Bezhetskov  <dbezhets...@igalia.com>
 
         [WASM-Function-References] Add call_ref spec tests

Modified: trunk/Tools/Scripts/webkitpy/port/image_diff.py (284937 => 284938)


--- trunk/Tools/Scripts/webkitpy/port/image_diff.py	2021-10-27 19:41:12 UTC (rev 284937)
+++ trunk/Tools/Scripts/webkitpy/port/image_diff.py	2021-10-27 19:45:14 UTC (rev 284938)
@@ -152,11 +152,6 @@
         total_pixels = int(string_utils.decode(m.group(2), target_type=str))
 
         passed = diff_percent <= self._tolerance
-        if not passed:
-            # FIXME: This prettification should happen at display time.
-            diff_percent = round(diff_percent * 100) / 100
-            diff_percent = max(diff_percent, 0.01)
-
         return ImageDiffResult(passed=passed, diff_image=output_image, difference=diff_percent, tolerance=self._tolerance, fuzzy_data={'max_difference': max_difference, 'total_pixels': total_pixels}, error_string=err_str or None)
 
     def stop(self):

Modified: trunk/Tools/Scripts/webkitpy/port/port_testcase.py (284937 => 284938)


--- trunk/Tools/Scripts/webkitpy/port/port_testcase.py	2021-10-27 19:41:12 UTC (rev 284937)
+++ trunk/Tools/Scripts/webkitpy/port/port_testcase.py	2021-10-27 19:45:14 UTC (rev 284938)
@@ -351,7 +351,7 @@
         port = self.make_port()
         port._server_process_constructor = lambda port, nm, cmd, env, crash_message=None: MockServerProcess(lines=['Content-Length: 4\n', 'test', 'diff: 0.101234%\n', 'maxDifference=8; totalPixels=20\n', '#EOF\n'])
         image_differ = ImageDiffer(port)
-        self.assertEqual(image_differ.diff_image(b'foo', b'bar', tolerance=0.1), ImageDiffResult(passed=False, diff_image=b'test', difference=0.1, tolerance=0.1, fuzzy_data={'max_difference': 8, 'total_pixels': 20}))
+        self.assertEqual(image_differ.diff_image(b'foo', b'bar', tolerance=0.1), ImageDiffResult(passed=False, diff_image=b'test', difference=0.101234, tolerance=0.1, fuzzy_data={'max_difference': 8, 'total_pixels': 20}))
 
     def test_diff_image_failed(self):
         port = self.make_port()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to