OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Module that outputs an JSON summary containing the comparision of images.""" | 6 """Module that outputs an JSON summary containing the comparision of images.""" |
7 | 7 |
8 import json | 8 import json |
9 import optparse | 9 import optparse |
10 import os | 10 import os |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 expected_image_locator=image_locator_nopatch, | 141 expected_image_locator=image_locator_nopatch, |
142 actual_image_locator=image_locator_withpatch) | 142 actual_image_locator=image_locator_withpatch) |
143 file_differences.append({ | 143 file_differences.append({ |
144 json_summary_constants.JSONKEY_FILE_NAME: imagefile_nopatch, | 144 json_summary_constants.JSONKEY_FILE_NAME: imagefile_nopatch, |
145 json_summary_constants.JSONKEY_SKP_LOCATION: posixpath.join( | 145 json_summary_constants.JSONKEY_SKP_LOCATION: posixpath.join( |
146 gs_skp_dir, skpfile_nopatch), | 146 gs_skp_dir, skpfile_nopatch), |
147 json_summary_constants.JSONKEY_NUM_PIXELS_DIFFERING: | 147 json_summary_constants.JSONKEY_NUM_PIXELS_DIFFERING: |
148 diff_record.get_num_pixels_differing(), | 148 diff_record.get_num_pixels_differing(), |
149 json_summary_constants.JSONKEY_PERCENT_PIXELS_DIFFERING: | 149 json_summary_constants.JSONKEY_PERCENT_PIXELS_DIFFERING: |
150 diff_record.get_percent_pixels_differing(), | 150 diff_record.get_percent_pixels_differing(), |
151 json_summary_constants.JSONKEY_WEIGHTED_DIFF_MEASURE: | |
152 diff_record.get_weighted_diff_measure(), | |
153 json_summary_constants.JSONKEY_MAX_DIFF_PER_CHANNEL: | 151 json_summary_constants.JSONKEY_MAX_DIFF_PER_CHANNEL: |
154 diff_record.get_max_diff_per_channel(), | 152 diff_record.get_max_diff_per_channel(), |
155 json_summary_constants.JSONKEY_PERCEPTUAL_DIFF: | 153 json_summary_constants.JSONKEY_PERCEPTUAL_DIFF: |
156 diff_record.get_perceptual_difference(), | 154 diff_record.get_perceptual_difference(), |
157 }) | 155 }) |
158 if file_differences: | 156 if file_differences: |
159 slave_dict[json_summary_constants.JSONKEY_FAILED_FILES_COUNT] = len( | 157 slave_dict[json_summary_constants.JSONKEY_FAILED_FILES_COUNT] = len( |
160 file_differences) | 158 file_differences) |
161 with open(output_file_path, 'w') as f: | 159 with open(output_file_path, 'w') as f: |
162 f.write(json.dumps(json_summary, indent=4, sort_keys=True)) | 160 f.write(json.dumps(json_summary, indent=4, sort_keys=True)) |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 option_parser.error( | 252 option_parser.error( |
255 'Must specify img_root, nopatch_json, nopatch_images_base_url, ' | 253 'Must specify img_root, nopatch_json, nopatch_images_base_url, ' |
256 'withpatch_json, withpatch_images_base_url, output_file_path, ' | 254 'withpatch_json, withpatch_images_base_url, output_file_path, ' |
257 'gs_output_dir, gs_skp_dir, and slave_num.') | 255 'gs_output_dir, gs_skp_dir, and slave_num.') |
258 | 256 |
259 WriteJsonSummary(options.img_root, options.nopatch_json, | 257 WriteJsonSummary(options.img_root, options.nopatch_json, |
260 options.nopatch_images_base_url, options.withpatch_json, | 258 options.nopatch_images_base_url, options.withpatch_json, |
261 options.withpatch_images_base_url, options.output_file_path, | 259 options.withpatch_images_base_url, options.output_file_path, |
262 options.gs_output_dir, options.gs_skp_dir, options.slave_num, | 260 options.gs_output_dir, options.gs_skp_dir, options.slave_num, |
263 options.add_to_sys_path) | 261 options.add_to_sys_path) |
OLD | NEW |