diff options
author | 2014-04-04 16:40:25 +0000 | |
---|---|---|
committer | 2014-04-04 16:40:25 +0000 | |
commit | 3eb77e4d5a381fa55197f6bd03c599e709146069 (patch) | |
tree | 86e637b6feaa657e225a5b706508b7215c4168ce /gm/rebaseline_server/compare_rendered_pictures_test.py | |
parent | a13767579d25a7182d697e93d0df294eccc91507 (diff) |
teach rebaseline_server how to compare results of multiple render_pictures runs
BUG=skia:2230,skia:1942
NOTRY=True
R=rmistry@google.com
Author: epoger@google.com
Review URL: https://codereview.chromium.org/216103004
git-svn-id: http://skia.googlecode.com/svn/trunk@14062 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'gm/rebaseline_server/compare_rendered_pictures_test.py')
-rwxr-xr-x | gm/rebaseline_server/compare_rendered_pictures_test.py | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/gm/rebaseline_server/compare_rendered_pictures_test.py b/gm/rebaseline_server/compare_rendered_pictures_test.py new file mode 100755 index 0000000000..c1eebb794b --- /dev/null +++ b/gm/rebaseline_server/compare_rendered_pictures_test.py @@ -0,0 +1,61 @@ +#!/usr/bin/python + +""" +Copyright 2014 Google Inc. + +Use of this source code is governed by a BSD-style license that can be +found in the LICENSE file. + +Test compare_rendered_pictures.py + +TODO(epoger): Create a command to update the expected results (in +self._output_dir_expected) when appropriate. For now, you should: +1. examine the results in self._output_dir_actual and make sure they are ok +2. rm -rf self._output_dir_expected +3. mv self._output_dir_actual self._output_dir_expected +Although, if you're using an SVN checkout, this will blow away .svn directories +within self._output_dir_expected, which wouldn't be good... + +""" + +import os +import sys + +# Imports from within Skia +import base_unittest +import compare_rendered_pictures +import results +import gm_json # must import results first, so that gm_json will be in sys.path + + +class CompareRenderedPicturesTest(base_unittest.TestCase): + + def test_endToEnd(self): + """Compare results of two render_pictures runs.""" + # TODO(epoger): Specify image_base_url pointing at the directory on local + # disk containing our test images, so that we can actually compute pixel + # diffs. For now, this test attempts to download images from + # DEFAULT_IMAGE_BASE_URL, and there aren't any there yet. + results_obj = compare_rendered_pictures.RenderedPicturesComparisons( + actuals_root=os.path.join(self._input_dir, 'render_pictures_output'), + subdirs=('before_patch', 'after_patch'), + generated_images_root=self._temp_dir, + diff_base_url='/static/generated-images') + results_obj.get_timestamp = mock_get_timestamp + gm_json.WriteToFile( + results_obj.get_packaged_results_of_type( + results.KEY__HEADER__RESULTS_ALL), + os.path.join(self._output_dir_actual, 'compare_rendered_pictures.json')) + + +def mock_get_timestamp(): + """Mock version of BaseComparisons.get_timestamp() for testing.""" + return 12345678 + + +def main(): + base_unittest.main(CompareRenderedPicturesTest) + + +if __name__ == '__main__': + main() |