Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Unified Diff: gm/rebaseline_server/imagediffdb.py

Issue 178253010: rebaseline_server: use new intermediate JSON format (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: line wraps Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: gm/rebaseline_server/imagediffdb.py
diff --git a/gm/rebaseline_server/imagediffdb.py b/gm/rebaseline_server/imagediffdb.py
index 8cec46bc9434fcb74ee7d1b1d2619e0411704618..e2608e2d866d4d54eef884b8483c14f116861b23 100644
--- a/gm/rebaseline_server/imagediffdb.py
+++ b/gm/rebaseline_server/imagediffdb.py
@@ -43,6 +43,14 @@ WHITEDIFFS_SUBDIR = 'whitediffs'
VALUES_PER_BAND = 256
+# Keys used within DiffRecord dictionary representations.
+# Keep these in sync with static/constants.js
+KEY__DIFFERENCE_DATA__MAX_DIFF_PER_CHANNEL = 'maxDiffPerChannel'
+KEY__DIFFERENCE_DATA__NUM_DIFF_PIXELS = 'numDifferingPixels'
+KEY__DIFFERENCE_DATA__PERCENT_DIFF_PIXELS = 'percentDifferingPixels'
+KEY__DIFFERENCE_DATA__PERCEPTUAL_DIFF = 'perceptualDifference'
+KEY__DIFFERENCE_DATA__WEIGHTED_DIFF = 'weightedDiffMeasure'
+
class DiffRecord(object):
""" Record of differences between two images. """
@@ -186,10 +194,12 @@ class DiffRecord(object):
"""Returns a dictionary representation of this DiffRecord, as needed when
constructing the JSON representation."""
return {
- 'numDifferingPixels': self._num_pixels_differing,
- 'percentDifferingPixels': self.get_percent_pixels_differing(),
- 'weightedDiffMeasure': self.get_weighted_diff_measure(),
- 'maxDiffPerChannel': self._max_diff_per_channel,
+ KEY__DIFFERENCE_DATA__NUM_DIFF_PIXELS: self._num_pixels_differing,
+ KEY__DIFFERENCE_DATA__PERCENT_DIFF_PIXELS:
+ self.get_percent_pixels_differing(),
+ KEY__DIFFERENCE_DATA__WEIGHTED_DIFF: self.get_weighted_diff_measure(),
+ KEY__DIFFERENCE_DATA__MAX_DIFF_PER_CHANNEL: self._max_diff_per_channel,
+ KEY__DIFFERENCE_DATA__PERCEPTUAL_DIFF: self._perceptual_difference,
}
@@ -398,6 +408,9 @@ def _get_difference_locator(expected_image_locator, actual_image_locator):
"""Returns the locator string used to look up the diffs between expected_image
and actual_image.
+ We must keep this function in sync with getImageDiffRelativeUrl() in
+ static/loader.js
+
Args:
expected_image_locator: locator string pointing at expected image
actual_image_locator: locator string pointing at actual image

Powered by Google App Engine
This is Rietveld 408576698