OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 | 2 |
3 """ | 3 """ |
4 Copyright 2013 Google Inc. | 4 Copyright 2013 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_to_expectations.py | 9 Test compare_to_expectations.py |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 # Imports from within Skia | 24 # Imports from within Skia |
25 import base_unittest | 25 import base_unittest |
26 import compare_to_expectations | 26 import compare_to_expectations |
27 import results | 27 import results |
28 import gm_json # must import results first, so that gm_json will be in sys.path | 28 import gm_json # must import results first, so that gm_json will be in sys.path |
29 | 29 |
30 | 30 |
31 class CompareToExpectationsTest(base_unittest.TestCase): | 31 class CompareToExpectationsTest(base_unittest.TestCase): |
32 | 32 |
33 def test_gm(self): | 33 def test_gm(self): |
34 """Process results of a GM run with the Results object.""" | 34 """Process results of a GM run with the ExpectationComparisons object.""" |
35 results_obj = compare_to_expectations.Results( | 35 results_obj = compare_to_expectations.ExpectationComparisons( |
36 actuals_root=os.path.join(self._input_dir, 'gm-actuals'), | 36 actuals_root=os.path.join(self._input_dir, 'gm-actuals'), |
37 expected_root=os.path.join(self._input_dir, 'gm-expectations'), | 37 expected_root=os.path.join(self._input_dir, 'gm-expectations'), |
38 generated_images_root=self._temp_dir, | 38 generated_images_root=self._temp_dir, |
39 diff_base_url='/static/generated-images') | 39 diff_base_url='/static/generated-images') |
40 results_obj.get_timestamp = mock_get_timestamp | 40 results_obj.get_timestamp = mock_get_timestamp |
41 gm_json.WriteToFile( | 41 gm_json.WriteToFile( |
42 results_obj.get_packaged_results_of_type( | 42 results_obj.get_packaged_results_of_type( |
43 results.KEY__HEADER__RESULTS_ALL), | 43 results.KEY__HEADER__RESULTS_ALL), |
44 os.path.join(self._output_dir_actual, 'gm.json')) | 44 os.path.join(self._output_dir_actual, 'gm.json')) |
45 | 45 |
46 | 46 |
47 def mock_get_timestamp(): | 47 def mock_get_timestamp(): |
48 """Mock version of Results.get_timestamp() for testing.""" | 48 """Mock version of BaseComparisons.get_timestamp() for testing.""" |
49 return 12345678 | 49 return 12345678 |
50 | 50 |
51 | 51 |
52 def main(): | 52 def main(): |
53 base_unittest.main(CompareToExpectationsTest) | 53 base_unittest.main(CompareToExpectationsTest) |
54 | 54 |
55 | 55 |
56 if __name__ == '__main__': | 56 if __name__ == '__main__': |
57 main() | 57 main() |
OLD | NEW |