setA_section, setB_section,
image_diff_db,
image_base_gs_url=DEFAULT_IMAGE_BASE_GS_URL, diff_base_url=None,
- setA_label='setA', setB_label='setB',
+ setA_label=None, setB_label=None,
gs=None, truncate_results=False, prefetch_only=False,
download_all_images=False):
"""Constructor: downloads images and generates diffs.
diff_base_url: base URL within which the client should look for diff
images; if not specified, defaults to a "file:///" URL representation
of image_diff_db's storage_root
- setA_label: description to use for results in setA
- setB_label: description to use for results in setB
+ setA_label: description to use for results in setA; if None, will be
+ set to a reasonable default
+ setB_label: description to use for results in setB; if None, will be
+ set to a reasonable default
gs: instance of GSUtils object we can use to download summary files
truncate_results: FOR MANUAL TESTING: if True, truncate the set of images
we process, to speed up testing.
self._diff_base_url = (
diff_base_url or
url_utils.create_filepath_url(image_diff_db.storage_root))
- self._setA_label = setA_label
- self._setB_label = setB_label
self._gs = gs
self.truncate_results = truncate_results
self._prefetch_only = prefetch_only
self._download_all_images = download_all_images
+ # If we are comparing two different section types, we can use those
+ # as the default labels for setA and setB.
+ if setA_section != setB_section:
+ self._setA_label = setA_label or setA_section
+ self._setB_label = setB_label or setB_section
+ else:
+ self._setA_label = setA_label or 'setA'
+ self._setB_label = setB_label or 'setB'
+
tempdir = tempfile.mkdtemp()
try:
setA_root = os.path.join(tempdir, 'setA')
def test_endToEnd(self):
"""Generate two sets of SKPs, run render_pictures over both, and compare
the results."""
- setA_label = 'before_patch'
- setB_label = 'after_patch'
+ setA_subdir = 'before_patch'
+ setB_subdir = 'after_patch'
self._generate_skps_and_run_render_pictures(
- subdir=setA_label, skpdict={
+ subdir=setA_subdir, skpdict={
'changed.skp': 200,
'unchanged.skp': 100,
'only-in-before.skp': 128,
})
self._generate_skps_and_run_render_pictures(
- subdir=setB_label, skpdict={
+ subdir=setB_subdir, skpdict={
'changed.skp': 201,
'unchanged.skp': 100,
'only-in-after.skp': 128,
})
results_obj = compare_rendered_pictures.RenderedPicturesComparisons(
- setA_dirs=[os.path.join(self.temp_dir, setA_label)],
- setB_dirs=[os.path.join(self.temp_dir, setB_label)],
+ setA_dirs=[os.path.join(self.temp_dir, setA_subdir)],
+ setB_dirs=[os.path.join(self.temp_dir, setB_subdir)],
setA_section=gm_json.JSONKEY_ACTUALRESULTS,
setB_section=gm_json.JSONKEY_ACTUALRESULTS,
image_diff_db=imagediffdb.ImageDiffDB(self.temp_dir),
image_base_gs_url='gs://fakebucket/fake/path',
- diff_base_url='/static/generated-images',
- setA_label=setA_label, setB_label=setB_label)
+ diff_base_url='/static/generated-images')
results_obj.get_timestamp = mock_get_timestamp
gm_json.WriteToFile(
setB_section=gm_json.JSONKEY_ACTUALRESULTS,
image_diff_db=imagediffdb.ImageDiffDB(self.temp_dir),
image_base_gs_url='gs://fakebucket/fake/path',
- diff_base_url='/static/generated-images',
- setA_label='setA', setB_label='setB')
+ diff_base_url='/static/generated-images')
results_obj.get_timestamp = mock_get_timestamp
gm_json.WriteToFile(
<a ng-class="'sort-' + sortedByColumnsCls(constants.KEY__IMAGEPAIRS__IMAGE_A_URL)"
ng-click="sortResultsBy('none', constants.KEY__IMAGEPAIRS__IMAGE_A_URL)"
href=""
+ title="setA: '{{setASection}}' within {{setADir}}"
class="sortable-header">
{{imageSets[constants.KEY__IMAGESETS__SET__IMAGE_A][constants.KEY__IMAGESETS__FIELD__DESCRIPTION]}}
</a>
<a ng-class="'sort-' + sortedByColumnsCls(constants.KEY__IMAGEPAIRS__IMAGE_B_URL)"
ng-click="sortResultsBy('none', constants.KEY__IMAGEPAIRS__IMAGE_B_URL)"
href=""
+ title="setB: '{{setBSection}}' within {{setBDir}}"
class="sortable-header">
{{imageSets[constants.KEY__IMAGESETS__SET__IMAGE_B][constants.KEY__IMAGESETS__FIELD__DESCRIPTION]}}
</a>
},
"imageA": {
"baseUrl": "http://storage.cloud.google.com/fakebucket/fake/path",
- "description": "before_patch"
+ "description": "setA"
},
"imageB": {
"baseUrl": "http://storage.cloud.google.com/fakebucket/fake/path",
- "description": "after_patch"
+ "description": "setB"
},
"whiteDiffs": {
"baseUrl": "/static/generated-images/whitediffs",
},
"imageA": {
"baseUrl": "http://storage.cloud.google.com/fakebucket/fake/path",
- "description": "setA"
+ "description": "expected-results"
},
"imageB": {
"baseUrl": "http://storage.cloud.google.com/fakebucket/fake/path",
- "description": "setB"
+ "description": "actual-results"
},
"whiteDiffs": {
"baseUrl": "/static/generated-images/whitediffs",