OLD | NEW |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 """ | 3 """ |
4 Copyright 2014 Google Inc. | 4 Copyright 2014 Google Inc. |
5 | 5 |
6 Use of this source code is governed by a BSD-style license that can be | 6 Use of this source code is governed by a BSD-style license that can be |
7 found in the LICENSE file. | 7 found in the LICENSE file. |
8 | 8 |
9 Test the render_pictures binary. | 9 Test the render_pictures binary. |
10 """ | 10 """ |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
262 }, | 262 }, |
263 "green.skp": { | 263 "green.skp": { |
264 "whole-image": GREEN_WHOLEIMAGE, | 264 "whole-image": GREEN_WHOLEIMAGE, |
265 } | 265 } |
266 } | 266 } |
267 } | 267 } |
268 self._assert_json_contents(output_json_path, expected_summary_dict) | 268 self._assert_json_contents(output_json_path, expected_summary_dict) |
269 self._assert_directory_contents( | 269 self._assert_directory_contents( |
270 write_path_dir, ['red_skp.png', 'green_skp.png']) | 270 write_path_dir, ['red_skp.png', 'green_skp.png']) |
271 | 271 |
272 def test_untiled_empty_expectations_file(self): | |
scroggo
2014/05/19 13:28:32
It looks like this function could share code with
epoger
2014/05/19 14:52:00
Good idea. I took a stab at this; please let me k
scroggo
2014/05/19 15:07:38
Looks good.
| |
273 """Same as test_untiled, but with an empty expectations file.""" | |
274 output_json_path = os.path.join(self._output_dir, 'actuals.json') | |
275 write_path_dir = self.create_empty_dir( | |
276 path=os.path.join(self._output_dir, 'writePath')) | |
277 self._generate_skps() | |
278 expectations_path = os.path.join(self._expectations_dir, 'empty') | |
279 with open(expectations_path, 'w') as fh: | |
280 pass | |
281 self._run_render_pictures([ | |
282 '-r', self._input_skp_dir, | |
283 '--readJsonSummaryPath', expectations_path, | |
284 '--writePath', write_path_dir, | |
285 '--writeJsonSummaryPath', output_json_path]) | |
286 expected_summary_dict = { | |
287 "header" : EXPECTED_HEADER_CONTENTS, | |
288 "actual-results" : { | |
289 "red.skp": { | |
290 "whole-image": modified_dict( | |
291 RED_WHOLEIMAGE, {"comparisonResult" : "no-comparison"}), | |
292 }, | |
293 "green.skp": { | |
294 "whole-image": modified_dict( | |
295 GREEN_WHOLEIMAGE, {"comparisonResult" : "no-comparison"}), | |
296 } | |
297 } | |
298 } | |
299 self._assert_json_contents(output_json_path, expected_summary_dict) | |
300 self._assert_directory_contents( | |
301 write_path_dir, ['red_skp.png', 'green_skp.png']) | |
302 | |
272 def test_untiled_writeChecksumBasedFilenames(self): | 303 def test_untiled_writeChecksumBasedFilenames(self): |
273 """Same as test_untiled, but with --writeChecksumBasedFilenames.""" | 304 """Same as test_untiled, but with --writeChecksumBasedFilenames.""" |
274 output_json_path = os.path.join(self._output_dir, 'actuals.json') | 305 output_json_path = os.path.join(self._output_dir, 'actuals.json') |
275 write_path_dir = self.create_empty_dir( | 306 write_path_dir = self.create_empty_dir( |
276 path=os.path.join(self._output_dir, 'writePath')) | 307 path=os.path.join(self._output_dir, 'writePath')) |
277 self._generate_skps() | 308 self._generate_skps() |
278 self._run_render_pictures(['-r', self._input_skp_dir, | 309 self._run_render_pictures(['-r', self._input_skp_dir, |
279 '--writeChecksumBasedFilenames', | 310 '--writeChecksumBasedFilenames', |
280 '--writePath', write_path_dir, | 311 '--writePath', write_path_dir, |
281 '--writeJsonSummaryPath', output_json_path]) | 312 '--writeJsonSummaryPath', output_json_path]) |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
641 self.assertMultiLineEqual(prettyprinted_expected_dict, | 672 self.assertMultiLineEqual(prettyprinted_expected_dict, |
642 prettyprinted_json_dict) | 673 prettyprinted_json_dict) |
643 | 674 |
644 | 675 |
645 def main(): | 676 def main(): |
646 base_unittest.main(RenderPicturesTest) | 677 base_unittest.main(RenderPicturesTest) |
647 | 678 |
648 | 679 |
649 if __name__ == '__main__': | 680 if __name__ == '__main__': |
650 main() | 681 main() |
OLD | NEW |