Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(322)

Side by Side Diff: gm/rebaseline_server/compare_rendered_pictures_test.py

Issue 451053004: change setA/setB labels if viewing actuals vs expectations (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add hover-notes to setA and setB column headers Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 compare_rendered_pictures.py 9 Test compare_rendered_pictures.py
10 10
(...skipping 22 matching lines...) Expand all
33 import gm_json 33 import gm_json
34 import imagediffdb 34 import imagediffdb
35 import results 35 import results
36 36
37 37
38 class CompareRenderedPicturesTest(base_unittest.TestCase): 38 class CompareRenderedPicturesTest(base_unittest.TestCase):
39 39
40 def test_endToEnd(self): 40 def test_endToEnd(self):
41 """Generate two sets of SKPs, run render_pictures over both, and compare 41 """Generate two sets of SKPs, run render_pictures over both, and compare
42 the results.""" 42 the results."""
43 setA_label = 'before_patch' 43 setA_subdir = 'before_patch'
44 setB_label = 'after_patch' 44 setB_subdir = 'after_patch'
45 self._generate_skps_and_run_render_pictures( 45 self._generate_skps_and_run_render_pictures(
46 subdir=setA_label, skpdict={ 46 subdir=setA_subdir, skpdict={
47 'changed.skp': 200, 47 'changed.skp': 200,
48 'unchanged.skp': 100, 48 'unchanged.skp': 100,
49 'only-in-before.skp': 128, 49 'only-in-before.skp': 128,
50 }) 50 })
51 self._generate_skps_and_run_render_pictures( 51 self._generate_skps_and_run_render_pictures(
52 subdir=setB_label, skpdict={ 52 subdir=setB_subdir, skpdict={
53 'changed.skp': 201, 53 'changed.skp': 201,
54 'unchanged.skp': 100, 54 'unchanged.skp': 100,
55 'only-in-after.skp': 128, 55 'only-in-after.skp': 128,
56 }) 56 })
57 57
58 results_obj = compare_rendered_pictures.RenderedPicturesComparisons( 58 results_obj = compare_rendered_pictures.RenderedPicturesComparisons(
59 setA_dirs=[os.path.join(self.temp_dir, setA_label)], 59 setA_dirs=[os.path.join(self.temp_dir, setA_subdir)],
60 setB_dirs=[os.path.join(self.temp_dir, setB_label)], 60 setB_dirs=[os.path.join(self.temp_dir, setB_subdir)],
61 setA_section=gm_json.JSONKEY_ACTUALRESULTS, 61 setA_section=gm_json.JSONKEY_ACTUALRESULTS,
62 setB_section=gm_json.JSONKEY_ACTUALRESULTS, 62 setB_section=gm_json.JSONKEY_ACTUALRESULTS,
63 image_diff_db=imagediffdb.ImageDiffDB(self.temp_dir), 63 image_diff_db=imagediffdb.ImageDiffDB(self.temp_dir),
64 image_base_gs_url='gs://fakebucket/fake/path', 64 image_base_gs_url='gs://fakebucket/fake/path',
65 diff_base_url='/static/generated-images', 65 diff_base_url='/static/generated-images')
66 setA_label=setA_label, setB_label=setB_label)
67 results_obj.get_timestamp = mock_get_timestamp 66 results_obj.get_timestamp = mock_get_timestamp
68 67
69 gm_json.WriteToFile( 68 gm_json.WriteToFile(
70 results_obj.get_packaged_results_of_type( 69 results_obj.get_packaged_results_of_type(
71 results.KEY__HEADER__RESULTS_ALL), 70 results.KEY__HEADER__RESULTS_ALL),
72 os.path.join(self.output_dir_actual, 'compare_rendered_pictures.json')) 71 os.path.join(self.output_dir_actual, 'compare_rendered_pictures.json'))
73 72
74 def test_repo_url(self): 73 def test_repo_url(self):
75 """Use repo: URL to specify summary files.""" 74 """Use repo: URL to specify summary files."""
76 base_repo_url = 'repo:gm/rebaseline_server/testdata/inputs/skp-summaries' 75 base_repo_url = 'repo:gm/rebaseline_server/testdata/inputs/skp-summaries'
77 results_obj = compare_rendered_pictures.RenderedPicturesComparisons( 76 results_obj = compare_rendered_pictures.RenderedPicturesComparisons(
78 setA_dirs=[posixpath.join(base_repo_url, 'expectations')], 77 setA_dirs=[posixpath.join(base_repo_url, 'expectations')],
79 setB_dirs=[posixpath.join(base_repo_url, 'actuals')], 78 setB_dirs=[posixpath.join(base_repo_url, 'actuals')],
80 setA_section=gm_json.JSONKEY_EXPECTEDRESULTS, 79 setA_section=gm_json.JSONKEY_EXPECTEDRESULTS,
81 setB_section=gm_json.JSONKEY_ACTUALRESULTS, 80 setB_section=gm_json.JSONKEY_ACTUALRESULTS,
82 image_diff_db=imagediffdb.ImageDiffDB(self.temp_dir), 81 image_diff_db=imagediffdb.ImageDiffDB(self.temp_dir),
83 image_base_gs_url='gs://fakebucket/fake/path', 82 image_base_gs_url='gs://fakebucket/fake/path',
84 diff_base_url='/static/generated-images', 83 diff_base_url='/static/generated-images')
85 setA_label='setA', setB_label='setB')
86 results_obj.get_timestamp = mock_get_timestamp 84 results_obj.get_timestamp = mock_get_timestamp
87 85
88 gm_json.WriteToFile( 86 gm_json.WriteToFile(
89 results_obj.get_packaged_results_of_type( 87 results_obj.get_packaged_results_of_type(
90 results.KEY__HEADER__RESULTS_ALL), 88 results.KEY__HEADER__RESULTS_ALL),
91 os.path.join(self.output_dir_actual, 'compare_rendered_pictures.json')) 89 os.path.join(self.output_dir_actual, 'compare_rendered_pictures.json'))
92 90
93 def _generate_skps_and_run_render_pictures(self, subdir, skpdict): 91 def _generate_skps_and_run_render_pictures(self, subdir, skpdict):
94 """Generate SKPs and run render_pictures on them. 92 """Generate SKPs and run render_pictures on them.
95 93
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 """Mock version of BaseComparisons.get_timestamp() for testing.""" 139 """Mock version of BaseComparisons.get_timestamp() for testing."""
142 return 12345678 140 return 12345678
143 141
144 142
145 def main(): 143 def main():
146 base_unittest.main(CompareRenderedPicturesTest) 144 base_unittest.main(CompareRenderedPicturesTest)
147 145
148 146
149 if __name__ == '__main__': 147 if __name__ == '__main__':
150 main() 148 main()
OLDNEW
« no previous file with comments | « gm/rebaseline_server/compare_rendered_pictures.py ('k') | gm/rebaseline_server/static/live-view.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698