actual_image_url=actual_image_url,
actual_image_locator=actual_image_locator)
except Exception:
- logging.exception('got exception while creating new DiffRecord')
- return
+ # If we can't create a real DiffRecord for this (expected, actual) pair,
+ # store None and the UI will show whatever information we DO have.
+ # Fixes http://skbug.com/2368 .
+ logging.exception(
+ 'got exception while creating a DiffRecord for '
+ 'expected_image_url=%s , actual_image_url=%s; returning None' % (
+ expected_image_url, actual_image_url))
+ new_diff_record = None
self._diff_dict[key] = new_diff_record
def get_diff_record(self, expected_image_locator, actual_image_locator):
self.expectations_dict = expectations
self.extra_columns_dict = extra_columns
if not imageA_relative_url or not imageB_relative_url:
+ self._is_different = True
self.diff_record = None
elif imageA_relative_url == imageB_relative_url:
+ self._is_different = False
self.diff_record = None
else:
# TODO(epoger): Rather than blocking until image_diff_db can read in
# asynchronously: tell image_diff_db to download a bunch of file pairs,
# and only block later if we're still waiting for diff_records to come
# back.
+ self._is_different = True
image_diff_db.add_image_pair(
expected_image_locator=imageA_relative_url,
expected_image_url=posixpath.join(base_url, imageA_relative_url),
self.diff_record = image_diff_db.get_diff_record(
expected_image_locator=imageA_relative_url,
actual_image_locator=imageB_relative_url)
+ if self.diff_record and self.diff_record.get_num_pixels_differing() == 0:
+ self._is_different = False
def as_dict(self):
"""Returns a dictionary describing this ImagePair.
KEY__IMAGE_A_URL: self.imageA_relative_url,
KEY__IMAGE_B_URL: self.imageB_relative_url,
}
+ asdict[KEY__IS_DIFFERENT] = self._is_different
if self.expectations_dict:
asdict[KEY__EXPECTATIONS_DATA] = self.expectations_dict
if self.extra_columns_dict:
asdict[KEY__EXTRA_COLUMN_VALUES] = self.extra_columns_dict
if self.diff_record and (self.diff_record.get_num_pixels_differing() > 0):
- asdict[KEY__IS_DIFFERENT] = True
asdict[KEY__DIFFERENCE_DATA] = self.diff_record.as_dict()
- else:
- asdict[KEY__IS_DIFFERENT] = False
return asdict
'isDifferent': True,
},
],
+
+ # Test fix for http://skbug.com/2368 -- how do we handle an ImagePair
+ # missing one of its images?
+ [
+ # inputs:
+ 'arcofzorro/16206093933823793653.png',
+ 'nonexistentDir/111111.png',
+ {
+ 'ignoreFailure': True,
+ 'bugs': [1001, 1002],
+ },
+ {
+ 'builder': 'MyBuilder',
+ 'test': 'MyTest',
+ },
+ # expected output:
+ {
+ 'expectations': {
+ 'bugs': [1001, 1002],
+ 'ignoreFailure': True,
+ },
+ 'extraColumns': {
+ 'builder': 'MyBuilder',
+ 'test': 'MyTest',
+ },
+ 'imageAUrl': 'arcofzorro/16206093933823793653.png',
+ 'imageBUrl': 'nonexistentDir/111111.png',
+ 'isDifferent': True,
+ },
+ ],
]
db = imagediffdb.ImageDiffDB(self._temp_dir)
}
},
"header": {
- "dataHash": "-8308658702264135120",
+ "dataHash": "7627783634950094306",
"isEditable": false,
"isExported": true,
"schemaVersion": 2,
},
"imageAUrl": null,
"imageBUrl": "bitmap-64bitMD5/texdata/3695033638604474475.png",
- "isDifferent": false
+ "isDifferent": true
},
{
"extraColumns": {
},
"imageAUrl": "bitmap-64bitMD5/filterbitmap_checkerboard_32_2/712827739969462165.png",
"imageBUrl": null,
- "isDifferent": false
+ "isDifferent": true
},
{
"extraColumns": {
},
"imageAUrl": "bitmap-64bitMD5/filterbitmap_checkerboard_192_192/3154864687054945306.png",
"imageBUrl": null,
- "isDifferent": false
+ "isDifferent": true
},
{
"extraColumns": {
},
"imageAUrl": "bitmap-64bitMD5/bigblurs/17309852422285247848.png",
"imageBUrl": null,
- "isDifferent": false
+ "isDifferent": true
},
{
"extraColumns": {
},
"imageAUrl": "bitmap-64bitMD5/bitmapsource/16289727936158057543.png",
"imageBUrl": null,
- "isDifferent": false
+ "isDifferent": true
},
{
"extraColumns": {
},
"imageAUrl": "bitmap-64bitMD5/3x3bitmaprect/2054956815327187963.png",
"imageBUrl": null,
- "isDifferent": false
+ "isDifferent": true
},
{
"extraColumns": {
},
"imageAUrl": "bitmap-64bitMD5/aaclip/14456211900777561488.png",
"imageBUrl": null,
- "isDifferent": false
+ "isDifferent": true
},
{
"differenceData": {
}
},
"header": {
- "dataHash": "2099241024256114776",
+ "dataHash": "2775016045957284034",
"isEditable": false,
"isExported": true,
"schemaVersion": 2,
},
"imageAUrl": null,
"imageBUrl": "bitmap-64bitMD5/bigblurs/2422083043229439955.png",
- "isDifferent": false
+ "isDifferent": true
},
{
"extraColumns": {
},
"imageAUrl": null,
"imageBUrl": "bitmap-64bitMD5/bigblurs/17309852422285247848.png",
- "isDifferent": false
+ "isDifferent": true
},
{
"extraColumns": {
},
"imageAUrl": null,
"imageBUrl": "bitmap-64bitMD5/bitmapsource/17503582803589749280.png",
- "isDifferent": false
+ "isDifferent": true
},
{
"extraColumns": {
},
"imageAUrl": null,
"imageBUrl": "bitmap-64bitMD5/bitmapsource/16289727936158057543.png",
- "isDifferent": false
+ "isDifferent": true
},
{
"expectations": {
},
"imageAUrl": null,
"imageBUrl": "bitmap-64bitMD5/bigblurs/14704206703218007573.png",
- "isDifferent": false
+ "isDifferent": true
},
{
"extraColumns": {
},
"imageAUrl": null,
"imageBUrl": "bitmap-64bitMD5/bigblurs/17309852422285247848.png",
- "isDifferent": false
+ "isDifferent": true
},
{
"extraColumns": {
},
"imageAUrl": null,
"imageBUrl": "bitmap-64bitMD5/bigblurs/1822195599289208664.png",
- "isDifferent": false
+ "isDifferent": true
},
{
"extraColumns": {
},
"imageAUrl": null,
"imageBUrl": "bitmap-64bitMD5/bigblurs/16171608477794909861.png",
- "isDifferent": false
+ "isDifferent": true
},
{
"extraColumns": {
},
"imageAUrl": null,
"imageBUrl": "bitmap-64bitMD5/bigblurs/6539050160610613353.png",
- "isDifferent": false
+ "isDifferent": true
},
{
"expectations": {