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 imagepair.py | 9 Test imagepair.py |
10 """ | 10 """ |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 'builder': 'MyBuilder', | 125 'builder': 'MyBuilder', |
126 'test': 'MyTest', | 126 'test': 'MyTest', |
127 }, | 127 }, |
128 'imageAUrl': | 128 'imageAUrl': |
129 'gradients_degenerate_2pt/10552995703607727960.png', | 129 'gradients_degenerate_2pt/10552995703607727960.png', |
130 'imageBUrl': | 130 'imageBUrl': |
131 'gradients_degenerate_2pt/11198253335583713230.png', | 131 'gradients_degenerate_2pt/11198253335583713230.png', |
132 'isDifferent': True, | 132 'isDifferent': True, |
133 }, | 133 }, |
134 ], | 134 ], |
| 135 |
| 136 # Test fix for http://skbug.com/2368 -- how do we handle an ImagePair |
| 137 # missing one of its images? |
| 138 [ |
| 139 # inputs: |
| 140 'arcofzorro/16206093933823793653.png', |
| 141 'nonexistentDir/111111.png', |
| 142 { |
| 143 'ignoreFailure': True, |
| 144 'bugs': [1001, 1002], |
| 145 }, |
| 146 { |
| 147 'builder': 'MyBuilder', |
| 148 'test': 'MyTest', |
| 149 }, |
| 150 # expected output: |
| 151 { |
| 152 'expectations': { |
| 153 'bugs': [1001, 1002], |
| 154 'ignoreFailure': True, |
| 155 }, |
| 156 'extraColumns': { |
| 157 'builder': 'MyBuilder', |
| 158 'test': 'MyTest', |
| 159 }, |
| 160 'imageAUrl': 'arcofzorro/16206093933823793653.png', |
| 161 'imageBUrl': 'nonexistentDir/111111.png', |
| 162 'isDifferent': True, |
| 163 }, |
| 164 ], |
135 ] | 165 ] |
136 | 166 |
137 db = imagediffdb.ImageDiffDB(self._temp_dir) | 167 db = imagediffdb.ImageDiffDB(self._temp_dir) |
138 for selftest in selftests: | 168 for selftest in selftests: |
139 image_pair = imagepair.ImagePair( | 169 image_pair = imagepair.ImagePair( |
140 image_diff_db=db, | 170 image_diff_db=db, |
141 base_url=IMG_URL_BASE, | 171 base_url=IMG_URL_BASE, |
142 imageA_relative_url=selftest[0], | 172 imageA_relative_url=selftest[0], |
143 imageB_relative_url=selftest[1], | 173 imageB_relative_url=selftest[1], |
144 expectations=selftest[2], | 174 expectations=selftest[2], |
145 extra_columns=selftest[3]) | 175 extra_columns=selftest[3]) |
146 self.assertEqual(image_pair.as_dict(), selftest[4]) | 176 self.assertEqual(image_pair.as_dict(), selftest[4]) |
147 | 177 |
148 | 178 |
149 def main(): | 179 def main(): |
150 suite = unittest.TestLoader().loadTestsFromTestCase(ImagePairTest) | 180 suite = unittest.TestLoader().loadTestsFromTestCase(ImagePairTest) |
151 unittest.TextTestRunner(verbosity=2).run(suite) | 181 unittest.TextTestRunner(verbosity=2).run(suite) |
152 | 182 |
153 | 183 |
154 if __name__ == '__main__': | 184 if __name__ == '__main__': |
155 main() | 185 main() |
OLD | NEW |