results_test.py revision 16f418080ff6751e15e0193263149412de9c848a
1#!/usr/bin/python
2
3"""
4Copyright 2013 Google Inc.
5
6Use of this source code is governed by a BSD-style license that can be
7found in the LICENSE file.
8
9Test results.py
10
11TODO(epoger): Create a command to update the expected results (in
12self._output_dir_expected) when appropriate.  For now, you should:
131. examine the results in self._output_dir_actual and make sure they are ok
142. rm -rf self._output_dir_expected
153. mv self._output_dir_actual self._output_dir_expected
16Although, if you're using an SVN checkout, this will blow away .svn directories
17within self._output_dir_expected, which wouldn't be good...
18
19"""
20
21import os
22import sys
23
24# Imports from within Skia
25import base_unittest
26import results
27import gm_json  # must import results first, so that gm_json will be in sys.path
28
29
30class ResultsTest(base_unittest.TestCase):
31
32  def test_gm(self):
33    """Process results of a GM run with the Results object."""
34    results_obj = results.Results(
35        actuals_root=os.path.join(self._input_dir, 'gm-actuals'),
36        expected_root=os.path.join(self._input_dir, 'gm-expectations'),
37        generated_images_root=self._temp_dir)
38    gm_json.WriteToFile(
39        results_obj.get_results_of_type(results.KEY__HEADER__RESULTS_ALL),
40        os.path.join(self._output_dir_actual, 'gm.json'))
41
42
43def main():
44  base_unittest.main(ResultsTest)
45
46
47if __name__ == '__main__':
48  main()
49