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 compare_rendered_pictures.py | 9 Test compare_rendered_pictures.py |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 image_base_gs_url='gs://fakebucket/fake/path', | 61 image_base_gs_url='gs://fakebucket/fake/path', |
62 diff_base_url='/static/generated-images', | 62 diff_base_url='/static/generated-images', |
63 setA_label=setA_label, setB_label=setB_label) | 63 setA_label=setA_label, setB_label=setB_label) |
64 results_obj.get_timestamp = mock_get_timestamp | 64 results_obj.get_timestamp = mock_get_timestamp |
65 | 65 |
66 gm_json.WriteToFile( | 66 gm_json.WriteToFile( |
67 results_obj.get_packaged_results_of_type( | 67 results_obj.get_packaged_results_of_type( |
68 results.KEY__HEADER__RESULTS_ALL), | 68 results.KEY__HEADER__RESULTS_ALL), |
69 os.path.join(self.output_dir_actual, 'compare_rendered_pictures.json')) | 69 os.path.join(self.output_dir_actual, 'compare_rendered_pictures.json')) |
70 | 70 |
| 71 def test_repo_url(self): |
| 72 """Use repo: URL to specify summary files.""" |
| 73 results_obj = compare_rendered_pictures.RenderedPicturesComparisons( |
| 74 setA_dirs=[ |
| 75 'repo:gm/rebaseline_server/testdata/inputs/skp-actuals/setA'], |
| 76 setB_dirs=[ |
| 77 'repo:gm/rebaseline_server/testdata/inputs/skp-actuals/setB'], |
| 78 image_diff_db=imagediffdb.ImageDiffDB(self.temp_dir), |
| 79 image_base_gs_url='gs://fakebucket/fake/path', |
| 80 diff_base_url='/static/generated-images', |
| 81 setA_label='setA', setB_label='setB') |
| 82 results_obj.get_timestamp = mock_get_timestamp |
| 83 |
| 84 gm_json.WriteToFile( |
| 85 results_obj.get_packaged_results_of_type( |
| 86 results.KEY__HEADER__RESULTS_ALL), |
| 87 os.path.join(self.output_dir_actual, 'compare_rendered_pictures.json')) |
| 88 |
71 def _generate_skps_and_run_render_pictures(self, subdir, skpdict): | 89 def _generate_skps_and_run_render_pictures(self, subdir, skpdict): |
72 """Generate SKPs and run render_pictures on them. | 90 """Generate SKPs and run render_pictures on them. |
73 | 91 |
74 Args: | 92 Args: |
75 subdir: subdirectory (within self.temp_dir) to write all files into | 93 subdir: subdirectory (within self.temp_dir) to write all files into |
76 skpdict: {skpname: redvalue} dictionary describing the SKP files to render | 94 skpdict: {skpname: redvalue} dictionary describing the SKP files to render |
77 """ | 95 """ |
78 out_path = os.path.join(self.temp_dir, subdir) | 96 out_path = os.path.join(self.temp_dir, subdir) |
79 os.makedirs(out_path) | 97 os.makedirs(out_path) |
80 for skpname, redvalue in skpdict.iteritems(): | 98 for skpname, redvalue in skpdict.iteritems(): |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 """Mock version of BaseComparisons.get_timestamp() for testing.""" | 137 """Mock version of BaseComparisons.get_timestamp() for testing.""" |
120 return 12345678 | 138 return 12345678 |
121 | 139 |
122 | 140 |
123 def main(): | 141 def main(): |
124 base_unittest.main(CompareRenderedPicturesTest) | 142 base_unittest.main(CompareRenderedPicturesTest) |
125 | 143 |
126 | 144 |
127 if __name__ == '__main__': | 145 if __name__ == '__main__': |
128 main() | 146 main() |
OLD | NEW |