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

Unified Diff: gm/rebaseline_server/imagepairset.py

Issue 196533021: rebaseline_server: make intermediate JSON specify base urls for diff images (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: nits Created 6 years, 9 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
« no previous file with comments | « no previous file | gm/rebaseline_server/imagepairset_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/rebaseline_server/imagepairset.py
diff --git a/gm/rebaseline_server/imagepairset.py b/gm/rebaseline_server/imagepairset.py
index 26c833e1b0bd95e1c9c39ebb3103307209d5507a..48c30647183e27736b44f46636b63231bd0beaa9 100644
--- a/gm/rebaseline_server/imagepairset.py
+++ b/gm/rebaseline_server/imagepairset.py
@@ -9,6 +9,10 @@ found in the LICENSE file.
ImagePairSet class; see its docstring below.
"""
+# System-level imports
+import posixpath
+
+# Local imports
import column
# Keys used within dictionary representation of ImagePairSet.
@@ -16,10 +20,15 @@ import column
KEY__EXTRACOLUMNHEADERS = 'extraColumnHeaders'
KEY__IMAGEPAIRS = 'imagePairs'
KEY__IMAGESETS = 'imageSets'
-KEY__IMAGESETS__BASE_URL = 'baseUrl'
-KEY__IMAGESETS__DESCRIPTION = 'description'
+KEY__IMAGESETS__FIELD__BASE_URL = 'baseUrl'
+KEY__IMAGESETS__FIELD__DESCRIPTION = 'description'
+KEY__IMAGESETS__SET__DIFFS = 'diffs'
+KEY__IMAGESETS__SET__IMAGE_A = 'imageA'
+KEY__IMAGESETS__SET__IMAGE_B = 'imageB'
+KEY__IMAGESETS__SET__WHITEDIFFS = 'whiteDiffs'
DEFAULT_DESCRIPTIONS = ('setA', 'setB')
+DIFF_BASE_URL = '/static/generated-images'
class ImagePairSet(object):
@@ -42,16 +51,18 @@ class ImagePairSet(object):
self._extra_column_tallies = {} # maps column_id -> values
# -> instances_per_value
self._image_pair_dicts = []
+ self._image_base_url = None
+ self._diff_base_url = DIFF_BASE_URL
def add_image_pair(self, image_pair):
"""Adds an ImagePair; this may be repeated any number of times."""
# Special handling when we add the first ImagePair...
if not self._image_pair_dicts:
- self._base_url = image_pair.base_url
+ self._image_base_url = image_pair.base_url
- if image_pair.base_url != self._base_url:
+ if image_pair.base_url != self._image_base_url:
raise Exception('added ImagePair with base_url "%s" instead of "%s"' % (
- image_pair.base_url, self._base_url))
+ image_pair.base_url, self._image_base_url))
self._image_pair_dicts.append(image_pair.as_dict())
extra_columns_dict = image_pair.extra_columns_dict
if extra_columns_dict:
@@ -127,14 +138,29 @@ class ImagePairSet(object):
Uses the KEY__* constants as keys.
"""
+ key_description = KEY__IMAGESETS__FIELD__DESCRIPTION
+ key_base_url = KEY__IMAGESETS__FIELD__BASE_URL
return {
KEY__EXTRACOLUMNHEADERS: self._column_headers_as_dict(),
KEY__IMAGEPAIRS: self._image_pair_dicts,
- KEY__IMAGESETS: [{
- KEY__IMAGESETS__BASE_URL: self._base_url,
- KEY__IMAGESETS__DESCRIPTION: self._descriptions[0],
- }, {
- KEY__IMAGESETS__BASE_URL: self._base_url,
- KEY__IMAGESETS__DESCRIPTION: self._descriptions[1],
- }],
+ KEY__IMAGESETS: {
+ KEY__IMAGESETS__SET__IMAGE_A: {
+ key_description: self._descriptions[0],
+ key_base_url: self._image_base_url,
+ },
+ KEY__IMAGESETS__SET__IMAGE_B: {
+ key_description: self._descriptions[1],
+ key_base_url: self._image_base_url,
+ },
+ KEY__IMAGESETS__SET__DIFFS: {
+ key_description: 'color difference per channel',
+ key_base_url: posixpath.join(
+ self._diff_base_url, 'diffs'),
+ },
+ KEY__IMAGESETS__SET__WHITEDIFFS: {
+ key_description: 'differing pixels in white',
+ key_base_url: posixpath.join(
+ self._diff_base_url, 'whitediffs'),
+ },
+ },
}
« no previous file with comments | « no previous file | gm/rebaseline_server/imagepairset_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698