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

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

Issue 480293002: rebaseline_server: constrain setADir/setBDir to consistently refer to single directories, not lists (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
« no previous file with comments | « gm/rebaseline_server/compare_rendered_pictures.py ('k') | gm/rebaseline_server/server.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_subdir, 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_subdir)], 59 setA_dir=os.path.join(self.temp_dir, setA_subdir),
60 setB_dirs=[os.path.join(self.temp_dir, setB_subdir)], 60 setB_dir=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 results_obj.get_timestamp = mock_get_timestamp 66 results_obj.get_timestamp = mock_get_timestamp
67 67
68 # Overwrite elements within the results that change from one test run 68 # Overwrite elements within the results that change from one test run
69 # to the next. 69 # to the next.
70 # pylint: disable=W0212 70 # pylint: disable=W0212
71 results_obj._setA_descriptions[results.KEY__SET_DESCRIPTIONS__DIR] = [ 71 results_obj._setA_descriptions[results.KEY__SET_DESCRIPTIONS__DIR] = [
72 'before-patch-fake-dir'] 72 'before-patch-fake-dir']
73 results_obj._setB_descriptions[results.KEY__SET_DESCRIPTIONS__DIR] = [ 73 results_obj._setB_descriptions[results.KEY__SET_DESCRIPTIONS__DIR] = [
74 'after-patch-fake-dir'] 74 'after-patch-fake-dir']
75 75
76 gm_json.WriteToFile( 76 gm_json.WriteToFile(
77 results_obj.get_packaged_results_of_type( 77 results_obj.get_packaged_results_of_type(
78 results.KEY__HEADER__RESULTS_ALL), 78 results.KEY__HEADER__RESULTS_ALL),
79 os.path.join(self.output_dir_actual, 'compare_rendered_pictures.json')) 79 os.path.join(self.output_dir_actual, 'compare_rendered_pictures.json'))
80 80
81 def test_repo_url(self): 81 def test_repo_url(self):
82 """Use repo: URL to specify summary files.""" 82 """Use repo: URL to specify summary files."""
83 base_repo_url = 'repo:gm/rebaseline_server/testdata/inputs/skp-summaries' 83 base_repo_url = 'repo:gm/rebaseline_server/testdata/inputs/skp-summaries'
84 results_obj = compare_rendered_pictures.RenderedPicturesComparisons( 84 results_obj = compare_rendered_pictures.RenderedPicturesComparisons(
85 setA_dirs=[posixpath.join(base_repo_url, 'expectations')], 85 setA_dir=posixpath.join(base_repo_url, 'expectations'),
86 setB_dirs=[posixpath.join(base_repo_url, 'actuals')], 86 setB_dir=posixpath.join(base_repo_url, 'actuals'),
87 setA_section=gm_json.JSONKEY_EXPECTEDRESULTS, 87 setA_section=gm_json.JSONKEY_EXPECTEDRESULTS,
88 setB_section=gm_json.JSONKEY_ACTUALRESULTS, 88 setB_section=gm_json.JSONKEY_ACTUALRESULTS,
89 image_diff_db=imagediffdb.ImageDiffDB(self.temp_dir), 89 image_diff_db=imagediffdb.ImageDiffDB(self.temp_dir),
90 image_base_gs_url='gs://fakebucket/fake/path', 90 image_base_gs_url='gs://fakebucket/fake/path',
91 diff_base_url='/static/generated-images') 91 diff_base_url='/static/generated-images')
92 results_obj.get_timestamp = mock_get_timestamp 92 results_obj.get_timestamp = mock_get_timestamp
93 93
94 # Overwrite elements within the results that change from one test run 94 # Overwrite elements within the results that change from one test run
95 # to the next. 95 # to the next.
96 # pylint: disable=W0212 96 # pylint: disable=W0212
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 """Mock version of BaseComparisons.get_timestamp() for testing.""" 155 """Mock version of BaseComparisons.get_timestamp() for testing."""
156 return 12345678 156 return 12345678
157 157
158 158
159 def main(): 159 def main():
160 base_unittest.main(CompareRenderedPicturesTest) 160 base_unittest.main(CompareRenderedPicturesTest)
161 161
162 162
163 if __name__ == '__main__': 163 if __name__ == '__main__':
164 main() 164 main()
OLDNEW
« no previous file with comments | « gm/rebaseline_server/compare_rendered_pictures.py ('k') | gm/rebaseline_server/server.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698