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

Side by Side Diff: tools/tests/render_pictures_test.py

Issue 226293002: add explicit filepaths to render_pictures JSON summary (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 8 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 | « no previous file | no next file » | 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 the render_pictures binary. 9 Test the render_pictures binary.
10 """ 10 """
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 self._run_render_pictures(['-r', self._input_skp_dir, 44 self._run_render_pictures(['-r', self._input_skp_dir,
45 '--bbh', 'grid', '256', '256', 45 '--bbh', 'grid', '256', '256',
46 '--mode', 'tile', '256', '256', 46 '--mode', 'tile', '256', '256',
47 '--writeJsonSummaryPath', output_json_path, 47 '--writeJsonSummaryPath', output_json_path,
48 '--writePath', self._temp_dir, 48 '--writePath', self._temp_dir,
49 '--writeWholeImage']) 49 '--writeWholeImage'])
50 expected_summary_dict = { 50 expected_summary_dict = {
51 "actual-results" : { 51 "actual-results" : {
52 "no-comparison" : { 52 "no-comparison" : {
53 # Manually verified: 640x400 red rectangle with black border 53 # Manually verified: 640x400 red rectangle with black border
54 "red.png" : [ "bitmap-64bitMD5", 11092453015575919668 ], 54 "red.skp" : {
55 "bitmap-64bitMD5" : 11092453015575919668,
56 "filepath" : "red.png",
57 },
55 # Manually verified: 640x400 green rectangle with black border 58 # Manually verified: 640x400 green rectangle with black border
56 "green.png" : [ "bitmap-64bitMD5", 8891695120562235492 ], 59 "green.skp" : {
60 "bitmap-64bitMD5" : 8891695120562235492,
61 "filepath" : "green.png",
62 },
57 } 63 }
58 } 64 }
59 } 65 }
60 self._assert_json_contents(output_json_path, expected_summary_dict) 66 self._assert_json_contents(output_json_path, expected_summary_dict)
61 self._assert_directory_contents( 67 self._assert_directory_contents(
62 self._temp_dir, ['red.png', 'green.png', 'output.json']) 68 self._temp_dir, ['red.png', 'green.png', 'output.json'])
63 69
64 def test_untiled(self): 70 def test_untiled(self):
65 """Run without tiles.""" 71 """Run without tiles."""
66 output_json_path = os.path.join(self._temp_dir, 'output.json') 72 output_json_path = os.path.join(self._temp_dir, 'output.json')
67 self._generate_skps() 73 self._generate_skps()
68 self._run_render_pictures(['-r', self._input_skp_dir, 74 self._run_render_pictures(['-r', self._input_skp_dir,
69 '--writePath', self._temp_dir, 75 '--writePath', self._temp_dir,
70 '--writeJsonSummaryPath', output_json_path]) 76 '--writeJsonSummaryPath', output_json_path])
71 expected_summary_dict = { 77 expected_summary_dict = {
72 "actual-results" : { 78 "actual-results" : {
73 "no-comparison" : { 79 "no-comparison" : {
74 # Manually verified: 640x400 red rectangle with black border 80 # Manually verified: 640x400 red rectangle with black border
75 "red.png" : ["bitmap-64bitMD5", 11092453015575919668], 81 "red.skp" : {
82 "bitmap-64bitMD5" : 11092453015575919668,
83 "filepath" : "red.png",
84 },
76 # Manually verified: 640x400 green rectangle with black border 85 # Manually verified: 640x400 green rectangle with black border
77 "green.png" : ["bitmap-64bitMD5", 8891695120562235492], 86 "green.skp" : {
87 "bitmap-64bitMD5" : 8891695120562235492,
88 "filepath" : "green.png",
89 },
78 } 90 }
79 } 91 }
80 } 92 }
81 self._assert_json_contents(output_json_path, expected_summary_dict) 93 self._assert_json_contents(output_json_path, expected_summary_dict)
82 self._assert_directory_contents( 94 self._assert_directory_contents(
83 self._temp_dir, ['red.png', 'green.png', 'output.json']) 95 self._temp_dir, ['red.png', 'green.png', 'output.json'])
84 96
85 def test_untiled_writeChecksumBasedFilenames(self): 97 def test_untiled_writeChecksumBasedFilenames(self):
86 """Same as test_untiled, but with --writeChecksumBasedFilenames.""" 98 """Same as test_untiled, but with --writeChecksumBasedFilenames."""
87 output_json_path = os.path.join(self._temp_dir, 'output.json') 99 output_json_path = os.path.join(self._temp_dir, 'output.json')
88 self._generate_skps() 100 self._generate_skps()
89 self._run_render_pictures(['-r', self._input_skp_dir, 101 self._run_render_pictures(['-r', self._input_skp_dir,
90 '--writeChecksumBasedFilenames', 102 '--writeChecksumBasedFilenames',
91 '--writePath', self._temp_dir, 103 '--writePath', self._temp_dir,
92 '--writeJsonSummaryPath', output_json_path]) 104 '--writeJsonSummaryPath', output_json_path])
93 expected_summary_dict = { 105 expected_summary_dict = {
94 "actual-results" : { 106 "actual-results" : {
95 "no-comparison" : { 107 "no-comparison" : {
96 # Manually verified: 640x400 red rectangle with black border 108 # Manually verified: 640x400 red rectangle with black border
97 "red.png" : ["bitmap-64bitMD5", 11092453015575919668], 109 "red.skp" : {
110 "bitmap-64bitMD5" : 11092453015575919668,
111 "filepath" : "bitmap-64bitMD5/red_skp/11092453015575919668.p ng",
epoger 2014/04/04 18:14:40 instead of bitmap-64bitMD5/red_skp/11092453015575
epoger 2014/04/04 18:34:21 Done.
112 },
98 # Manually verified: 640x400 green rectangle with black border 113 # Manually verified: 640x400 green rectangle with black border
99 "green.png" : ["bitmap-64bitMD5", 8891695120562235492], 114 "green.skp" : {
115 "bitmap-64bitMD5" : 8891695120562235492,
116 "filepath" : "bitmap-64bitMD5/green_skp/8891695120562235492. png",
117 },
100 } 118 }
101 } 119 }
102 } 120 }
103 self._assert_json_contents(output_json_path, expected_summary_dict) 121 self._assert_json_contents(output_json_path, expected_summary_dict)
122 self._assert_directory_contents(self._temp_dir, ['output.json'])
104 self._assert_directory_contents( 123 self._assert_directory_contents(
105 self._temp_dir, ['bitmap-64bitMD5_11092453015575919668.png', 124 os.path.join(self._temp_dir, 'bitmap-64bitMD5', 'red_skp'),
106 'bitmap-64bitMD5_8891695120562235492.png', 125 ['11092453015575919668.png'])
107 'output.json']) 126 self._assert_directory_contents(
127 os.path.join(self._temp_dir, 'bitmap-64bitMD5', 'green_skp'),
128 ['8891695120562235492.png'])
108 129
109 def test_untiled_validate(self): 130 def test_untiled_validate(self):
110 """Same as test_untiled, but with --validate. 131 """Same as test_untiled, but with --validate.
111 132
112 TODO(epoger): This test generates undesired results! The call 133 TODO(epoger): This test generates undesired results! The call
113 to render_pictures should succeed, and generate the same output as 134 to render_pictures should succeed, and generate the same output as
114 test_untiled. 135 test_untiled.
115 See https://code.google.com/p/skia/issues/detail?id=2044 ('render_pictures: 136 See https://code.google.com/p/skia/issues/detail?id=2044 ('render_pictures:
116 --validate fails') 137 --validate fails')
117 """ 138 """
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 '--bbh', 'grid', '256', '256', 170 '--bbh', 'grid', '256', '256',
150 '--mode', 'tile', '256', '256', 171 '--mode', 'tile', '256', '256',
151 '--writePath', self._temp_dir, 172 '--writePath', self._temp_dir,
152 '--writeJsonSummaryPath', output_json_path]) 173 '--writeJsonSummaryPath', output_json_path])
153 expected_summary_dict = { 174 expected_summary_dict = {
154 "actual-results" : { 175 "actual-results" : {
155 "no-comparison" : { 176 "no-comparison" : {
156 # Manually verified these 6 images, all 256x256 tiles, 177 # Manually verified these 6 images, all 256x256 tiles,
157 # consistent with a tiled version of the 640x400 red rect 178 # consistent with a tiled version of the 640x400 red rect
158 # with black borders. 179 # with black borders.
159 "red0.png" : ["bitmap-64bitMD5", 5815827069051002745], 180 "red.skp-tile0" : {
160 "red1.png" : ["bitmap-64bitMD5", 9323613075234140270], 181 "bitmap-64bitMD5" : 5815827069051002745,
161 "red2.png" : ["bitmap-64bitMD5", 16670399404877552232], 182 "filepath" : "red_skp-tile0.png",
162 "red3.png" : ["bitmap-64bitMD5", 2507897274083364964], 183 },
163 "red4.png" : ["bitmap-64bitMD5", 7325267995523877959], 184 "red.skp-tile1" : {
164 "red5.png" : ["bitmap-64bitMD5", 2181381724594493116], 185 "bitmap-64bitMD5" : 9323613075234140270,
186 "filepath" : "red_skp-tile1.png",
187 },
188 "red.skp-tile2" : {
189 "bitmap-64bitMD5" : 16670399404877552232,
190 "filepath" : "red_skp-tile2.png",
191 },
192 "red.skp-tile3" : {
193 "bitmap-64bitMD5" : 2507897274083364964,
194 "filepath" : "red_skp-tile3.png",
195 },
196 "red.skp-tile4" : {
197 "bitmap-64bitMD5" : 7325267995523877959,
198 "filepath" : "red_skp-tile4.png",
199 },
200 "red.skp-tile5" : {
201 "bitmap-64bitMD5" : 2181381724594493116,
202 "filepath" : "red_skp-tile5.png",
203 },
165 # Manually verified these 6 images, all 256x256 tiles, 204 # Manually verified these 6 images, all 256x256 tiles,
166 # consistent with a tiled version of the 640x400 green rect 205 # consistent with a tiled version of the 640x400 green rect
167 # with black borders. 206 # with black borders.
168 "green0.png" : ["bitmap-64bitMD5", 12587324416545178013], 207 "green.skp-tile0" : {
169 "green1.png" : ["bitmap-64bitMD5", 7624374914829746293], 208 "bitmap-64bitMD5" : 12587324416545178013,
170 "green2.png" : ["bitmap-64bitMD5", 5686489729535631913], 209 "filepath" : "green_skp-tile0.png",
171 "green3.png" : ["bitmap-64bitMD5", 7980646035555096146], 210 },
172 "green4.png" : ["bitmap-64bitMD5", 17817086664365875131], 211 "green.skp-tile1" : {
173 "green5.png" : ["bitmap-64bitMD5", 10673669813016809363], 212 "bitmap-64bitMD5" : 7624374914829746293,
213 "filepath" : "green_skp-tile1.png",
214 },
215 "green.skp-tile2" : {
216 "bitmap-64bitMD5" : 5686489729535631913,
217 "filepath" : "green_skp-tile2.png",
218 },
219 "green.skp-tile3" : {
220 "bitmap-64bitMD5" : 7980646035555096146,
221 "filepath" : "green_skp-tile3.png",
222 },
223 "green.skp-tile4" : {
224 "bitmap-64bitMD5" : 17817086664365875131,
225 "filepath" : "green_skp-tile4.png",
226 },
227 "green.skp-tile5" : {
228 "bitmap-64bitMD5" : 10673669813016809363,
229 "filepath" : "green_skp-tile5.png",
230 },
174 } 231 }
175 } 232 }
176 } 233 }
177 self._assert_json_contents(output_json_path, expected_summary_dict) 234 self._assert_json_contents(output_json_path, expected_summary_dict)
178 self._assert_directory_contents(
179 self._temp_dir,
180 ['red0.png', 'red1.png', 'red2.png', 'red3.png', 'red4.png', 'red5.png',
181 'green0.png', 'green1.png', 'green2.png', 'green3.png', 'green4.png',
182 'green5.png', 'output.json'])
183 235
184 def test_tiled_writeChecksumBasedFilenames(self): 236 def test_tiled_writeChecksumBasedFilenames(self):
185 """Same as test_tiled, but with --writeChecksumBasedFilenames.""" 237 """Same as test_tiled, but with --writeChecksumBasedFilenames."""
186 output_json_path = os.path.join(self._temp_dir, 'output.json') 238 output_json_path = os.path.join(self._temp_dir, 'output.json')
187 self._generate_skps() 239 self._generate_skps()
188 self._run_render_pictures(['-r', self._input_skp_dir, 240 self._run_render_pictures(['-r', self._input_skp_dir,
189 '--bbh', 'grid', '256', '256', 241 '--bbh', 'grid', '256', '256',
190 '--mode', 'tile', '256', '256', 242 '--mode', 'tile', '256', '256',
191 '--writeChecksumBasedFilenames', 243 '--writeChecksumBasedFilenames',
192 '--writePath', self._temp_dir, 244 '--writePath', self._temp_dir,
193 '--writeJsonSummaryPath', output_json_path]) 245 '--writeJsonSummaryPath', output_json_path])
194 expected_summary_dict = { 246 expected_summary_dict = {
195 "actual-results" : { 247 "actual-results" : {
196 "no-comparison" : { 248 "no-comparison" : {
197 # Manually verified these 6 images, all 256x256 tiles, 249 # Manually verified these 6 images, all 256x256 tiles,
198 # consistent with a tiled version of the 640x400 red rect 250 # consistent with a tiled version of the 640x400 red rect
199 # with black borders. 251 # with black borders.
200 "red0.png" : ["bitmap-64bitMD5", 5815827069051002745], 252 "red.skp-tile0" : {
epoger 2014/04/04 18:14:40 add some version header too
epoger 2014/04/04 18:34:21 Done.
201 "red1.png" : ["bitmap-64bitMD5", 9323613075234140270], 253 "bitmap-64bitMD5" : 5815827069051002745,
202 "red2.png" : ["bitmap-64bitMD5", 16670399404877552232], 254 "filepath" : "bitmap-64bitMD5/red_skp-tile0/5815827069051002 745.png",
epoger 2014/04/04 18:14:40 instead of bitmap-64bitMD5/red_skp-tile0/58158270
epoger 2014/04/04 18:34:21 Done.
203 "red3.png" : ["bitmap-64bitMD5", 2507897274083364964], 255 },
204 "red4.png" : ["bitmap-64bitMD5", 7325267995523877959], 256 "red.skp-tile1" : {
epoger 2014/04/04 18:14:40 instead: "algorithm": "bitmap-64bitMD5", "checksum
epoger 2014/04/04 18:34:21 Done.
205 "red5.png" : ["bitmap-64bitMD5", 2181381724594493116], 257 "bitmap-64bitMD5" : 9323613075234140270,
258 "filepath" : "bitmap-64bitMD5/red_skp-tile1/9323613075234140 270.png",
259 },
260 "red.skp-tile2" : {
261 "bitmap-64bitMD5" : 16670399404877552232,
epoger 2014/04/04 18:14:40 Note: changing the format of this JSON will break
262 "filepath" : "bitmap-64bitMD5/red_skp-tile2/1667039940487755 2232.png",
263 },
264 "red.skp-tile3" : {
265 "bitmap-64bitMD5" : 2507897274083364964,
266 "filepath" : "bitmap-64bitMD5/red_skp-tile3/2507897274083364 964.png",
267 },
268 "red.skp-tile4" : {
269 "bitmap-64bitMD5" : 7325267995523877959,
270 "filepath" : "bitmap-64bitMD5/red_skp-tile4/7325267995523877 959.png",
271 },
272 "red.skp-tile5" : {
273 "bitmap-64bitMD5" : 2181381724594493116,
274 "filepath" : "bitmap-64bitMD5/red_skp-tile5/2181381724594493 116.png",
275 },
206 # Manually verified these 6 images, all 256x256 tiles, 276 # Manually verified these 6 images, all 256x256 tiles,
207 # consistent with a tiled version of the 640x400 green rect 277 # consistent with a tiled version of the 640x400 green rect
208 # with black borders. 278 # with black borders.
209 "green0.png" : ["bitmap-64bitMD5", 12587324416545178013], 279 "green.skp-tile0" : {
210 "green1.png" : ["bitmap-64bitMD5", 7624374914829746293], 280 "bitmap-64bitMD5" : 12587324416545178013,
211 "green2.png" : ["bitmap-64bitMD5", 5686489729535631913], 281 "filepath" : "bitmap-64bitMD5/green_skp-tile0/12587324416545 178013.png",
212 "green3.png" : ["bitmap-64bitMD5", 7980646035555096146], 282 },
213 "green4.png" : ["bitmap-64bitMD5", 17817086664365875131], 283 "green.skp-tile1" : {
214 "green5.png" : ["bitmap-64bitMD5", 10673669813016809363], 284 "bitmap-64bitMD5" : 7624374914829746293,
285 "filepath" : "bitmap-64bitMD5/green_skp-tile1/76243749148297 46293.png",
286 },
287 "green.skp-tile2" : {
288 "bitmap-64bitMD5" : 5686489729535631913,
289 "filepath" : "bitmap-64bitMD5/green_skp-tile2/56864897295356 31913.png",
290 },
291 "green.skp-tile3" : {
292 "bitmap-64bitMD5" : 7980646035555096146,
293 "filepath" : "bitmap-64bitMD5/green_skp-tile3/79806460355550 96146.png",
294 },
295 "green.skp-tile4" : {
296 "bitmap-64bitMD5" : 17817086664365875131,
297 "filepath" : "bitmap-64bitMD5/green_skp-tile4/17817086664365 875131.png",
298 },
299 "green.skp-tile5" : {
300 "bitmap-64bitMD5" : 10673669813016809363,
301 "filepath" : "bitmap-64bitMD5/green_skp-tile5/10673669813016 809363.png",
302 },
215 } 303 }
216 } 304 }
217 } 305 }
218 self._assert_json_contents(output_json_path, expected_summary_dict) 306 self._assert_json_contents(output_json_path, expected_summary_dict)
219 self._assert_directory_contents(
220 self._temp_dir,
221 ['bitmap-64bitMD5_5815827069051002745.png',
222 'bitmap-64bitMD5_9323613075234140270.png',
223 'bitmap-64bitMD5_16670399404877552232.png',
224 'bitmap-64bitMD5_2507897274083364964.png',
225 'bitmap-64bitMD5_7325267995523877959.png',
226 'bitmap-64bitMD5_2181381724594493116.png',
227 'bitmap-64bitMD5_12587324416545178013.png',
228 'bitmap-64bitMD5_7624374914829746293.png',
229 'bitmap-64bitMD5_5686489729535631913.png',
230 'bitmap-64bitMD5_7980646035555096146.png',
231 'bitmap-64bitMD5_17817086664365875131.png',
232 'bitmap-64bitMD5_10673669813016809363.png',
233 'output.json'])
234 307
235 def _run_render_pictures(self, args): 308 def _run_render_pictures(self, args):
236 binary = self.find_path_to_program('render_pictures') 309 binary = self.find_path_to_program('render_pictures')
237 return self.run_command([binary, 310 return self.run_command([binary,
238 '--clone', '1', 311 '--clone', '1',
239 '--config', '8888', 312 '--config', '8888',
240 ] + args) 313 ] + args)
241 314
242 def _generate_skps(self): 315 def _generate_skps(self):
243 """Runs the skpmaker binary to generate files in self._input_skp_dir.""" 316 """Runs the skpmaker binary to generate files in self._input_skp_dir."""
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 actual_dict = json.loads(file_contents) 371 actual_dict = json.loads(file_contents)
299 self.assertEqual(actual_dict, expected_dict) 372 self.assertEqual(actual_dict, expected_dict)
300 373
301 374
302 def main(): 375 def main():
303 base_unittest.main(RenderPicturesTest) 376 base_unittest.main(RenderPicturesTest)
304 377
305 378
306 if __name__ == '__main__': 379 if __name__ == '__main__':
307 main() 380 main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698