| 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 """ |
| 11 | 11 |
| 12 # System-level imports | 12 # System-level imports |
| 13 import shutil | 13 import shutil |
| 14 import tempfile | 14 import tempfile |
| 15 import unittest | 15 import unittest |
| 16 | 16 |
| 17 # Local imports | 17 # Local imports |
| 18 import imagediffdb | 18 import imagediffdb |
| 19 import imagepair | 19 import imagepair |
| 20 | 20 |
| 21 | 21 |
| 22 IMG_URL_BASE = 'http://chromium-skia-gm.commondatastorage.googleapis.com/gm/bitm
ap-64bitMD5/' | 22 IMG_URL_BASE = ('http://chromium-skia-gm.commondatastorage.googleapis.com/' |
| 23 'gm/bitmap-64bitMD5/') |
| 23 | 24 |
| 24 | 25 |
| 25 class ImagePairTest(unittest.TestCase): | 26 class ImagePairTest(unittest.TestCase): |
| 26 | 27 |
| 27 def setUp(self): | 28 def setUp(self): |
| 28 self._temp_dir = tempfile.mkdtemp() | 29 self._temp_dir = tempfile.mkdtemp() |
| 29 self.maxDiff = None | 30 self.maxDiff = None |
| 30 | 31 |
| 31 def tearDown(self): | 32 def tearDown(self): |
| 32 shutil.rmtree(self._temp_dir) | 33 shutil.rmtree(self._temp_dir) |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 'arcofzorro/16206093933823793653.png', | 81 'arcofzorro/16206093933823793653.png', |
| 81 'arcofzorro/13786535001616823825.png', | 82 'arcofzorro/13786535001616823825.png', |
| 82 None, | 83 None, |
| 83 None, | 84 None, |
| 84 # expected output: | 85 # expected output: |
| 85 { | 86 { |
| 86 'differenceData': { | 87 'differenceData': { |
| 87 'maxDiffPerChannel': [255, 255, 247], | 88 'maxDiffPerChannel': [255, 255, 247], |
| 88 'numDifferingPixels': 662, | 89 'numDifferingPixels': 662, |
| 89 'percentDifferingPixels': 0.0662, | 90 'percentDifferingPixels': 0.0662, |
| 90 'perceptualDifference': 0.06620000000000914, | 91 'perceptualDifference': 0.06620300000000157, |
| 91 }, | 92 }, |
| 92 'imageAUrl': 'arcofzorro/16206093933823793653.png', | 93 'imageAUrl': 'arcofzorro/16206093933823793653.png', |
| 93 'imageBUrl': 'arcofzorro/13786535001616823825.png', | 94 'imageBUrl': 'arcofzorro/13786535001616823825.png', |
| 94 'isDifferent': True, | 95 'isDifferent': True, |
| 95 }, | 96 }, |
| 96 ], | 97 ], |
| 97 | 98 |
| 98 [ | 99 [ |
| 99 # inputs: | 100 # inputs: |
| 100 'gradients_degenerate_2pt/10552995703607727960.png', | 101 'gradients_degenerate_2pt/10552995703607727960.png', |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 self.assertEqual(image_pair.as_dict(), selftest[4]) | 175 self.assertEqual(image_pair.as_dict(), selftest[4]) |
| 175 | 176 |
| 176 | 177 |
| 177 def main(): | 178 def main(): |
| 178 suite = unittest.TestLoader().loadTestsFromTestCase(ImagePairTest) | 179 suite = unittest.TestLoader().loadTestsFromTestCase(ImagePairTest) |
| 179 unittest.TextTestRunner(verbosity=2).run(suite) | 180 unittest.TextTestRunner(verbosity=2).run(suite) |
| 180 | 181 |
| 181 | 182 |
| 182 if __name__ == '__main__': | 183 if __name__ == '__main__': |
| 183 main() | 184 main() |
| OLD | NEW |