OLD | NEW |
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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 output_list.append(output_dict) | 149 output_list.append(output_dict) |
150 return output_list | 150 return output_list |
151 | 151 |
152 | 152 |
153 class RenderPicturesTest(base_unittest.TestCase): | 153 class RenderPicturesTest(base_unittest.TestCase): |
154 | 154 |
155 def setUp(self): | 155 def setUp(self): |
156 self.maxDiff = MAX_DIFF_LENGTH | 156 self.maxDiff = MAX_DIFF_LENGTH |
157 self._expectations_dir = tempfile.mkdtemp() | 157 self._expectations_dir = tempfile.mkdtemp() |
158 self._input_skp_dir = tempfile.mkdtemp() | 158 self._input_skp_dir = tempfile.mkdtemp() |
159 self._temp_dir = tempfile.mkdtemp() | 159 # All output of render_pictures binary will go into this directory. |
| 160 self._output_dir = tempfile.mkdtemp() |
160 | 161 |
161 def tearDown(self): | 162 def tearDown(self): |
162 shutil.rmtree(self._expectations_dir) | 163 shutil.rmtree(self._expectations_dir) |
163 shutil.rmtree(self._input_skp_dir) | 164 shutil.rmtree(self._input_skp_dir) |
164 shutil.rmtree(self._temp_dir) | 165 shutil.rmtree(self._output_dir) |
165 | 166 |
166 def test_tiled_whole_image(self): | 167 def test_tiled_whole_image(self): |
167 """Run render_pictures with tiles and --writeWholeImage flag. | 168 """Run render_pictures with tiles and --writeWholeImage flag. |
168 | 169 |
169 TODO(epoger): This test generates undesired results! The JSON summary | 170 TODO(epoger): This test generates undesired results! The JSON summary |
170 includes both whole-image and tiled-images (as it should), but only | 171 includes both whole-image and tiled-images (as it should), but only |
171 whole-images are written out to disk. See http://skbug.com/2463 | 172 whole-images are written out to disk. See http://skbug.com/2463 |
| 173 Once I fix that, I should add a similar test that exercises mismatchPath. |
172 | 174 |
173 TODO(epoger): I noticed that when this is run without --writePath being | 175 TODO(epoger): I noticed that when this is run without --writePath being |
174 specified, this test writes red_skp.png and green_skp.png to the current | 176 specified, this test writes red_skp.png and green_skp.png to the current |
175 directory. We should fix that... if --writePath is not specified, this | 177 directory. We should fix that... if --writePath is not specified, this |
176 probably shouldn't write out red_skp.png and green_skp.png at all! | 178 probably shouldn't write out red_skp.png and green_skp.png at all! |
177 See http://skbug.com/2464 | 179 See http://skbug.com/2464 |
178 """ | 180 """ |
179 output_json_path = os.path.join(self._temp_dir, 'actuals.json') | 181 output_json_path = os.path.join(self._output_dir, 'actuals.json') |
| 182 write_path_dir = self.create_empty_dir( |
| 183 path=os.path.join(self._output_dir, 'writePath')) |
180 self._generate_skps() | 184 self._generate_skps() |
181 expectations_path = self._create_expectations() | 185 expectations_path = self._create_expectations() |
182 self._run_render_pictures([ | 186 self._run_render_pictures([ |
183 '-r', self._input_skp_dir, | 187 '-r', self._input_skp_dir, |
184 '--bbh', 'grid', '256', '256', | 188 '--bbh', 'grid', '256', '256', |
185 '--mode', 'tile', '256', '256', | 189 '--mode', 'tile', '256', '256', |
186 '--readJsonSummaryPath', expectations_path, | 190 '--readJsonSummaryPath', expectations_path, |
187 '--writeJsonSummaryPath', output_json_path, | 191 '--writeJsonSummaryPath', output_json_path, |
188 '--writePath', self._temp_dir, | 192 '--writePath', write_path_dir, |
189 '--writeWholeImage']) | 193 '--writeWholeImage']) |
190 expected_summary_dict = { | 194 expected_summary_dict = { |
191 "header" : EXPECTED_HEADER_CONTENTS, | 195 "header" : EXPECTED_HEADER_CONTENTS, |
192 "actual-results" : { | 196 "actual-results" : { |
193 "red.skp": { | 197 "red.skp": { |
194 "tiled-images": RED_TILES, | 198 "tiled-images": RED_TILES, |
195 "whole-image": RED_WHOLEIMAGE, | 199 "whole-image": RED_WHOLEIMAGE, |
196 }, | 200 }, |
197 "green.skp": { | 201 "green.skp": { |
198 "tiled-images": GREEN_TILES, | 202 "tiled-images": GREEN_TILES, |
199 "whole-image": GREEN_WHOLEIMAGE, | 203 "whole-image": GREEN_WHOLEIMAGE, |
200 } | 204 } |
201 } | 205 } |
202 } | 206 } |
203 self._assert_json_contents(output_json_path, expected_summary_dict) | 207 self._assert_json_contents(output_json_path, expected_summary_dict) |
204 self._assert_directory_contents( | 208 self._assert_directory_contents( |
205 self._temp_dir, ['red_skp.png', 'green_skp.png', 'actuals.json']) | 209 write_path_dir, ['red_skp.png', 'green_skp.png']) |
206 | 210 |
207 def test_missing_tile_and_whole_image(self): | 211 def test_missing_tile_and_whole_image(self): |
208 """test_tiled_whole_image, but missing expectations for some images. | 212 """test_tiled_whole_image, but missing expectations for some images. |
209 """ | 213 """ |
210 output_json_path = os.path.join(self._temp_dir, 'actuals.json') | 214 output_json_path = os.path.join(self._output_dir, 'actuals.json') |
| 215 write_path_dir = self.create_empty_dir( |
| 216 path=os.path.join(self._output_dir, 'writePath')) |
211 self._generate_skps() | 217 self._generate_skps() |
212 expectations_path = self._create_expectations(missing_some_images=True) | 218 expectations_path = self._create_expectations(missing_some_images=True) |
213 self._run_render_pictures([ | 219 self._run_render_pictures([ |
214 '-r', self._input_skp_dir, | 220 '-r', self._input_skp_dir, |
215 '--bbh', 'grid', '256', '256', | 221 '--bbh', 'grid', '256', '256', |
216 '--mode', 'tile', '256', '256', | 222 '--mode', 'tile', '256', '256', |
217 '--readJsonSummaryPath', expectations_path, | 223 '--readJsonSummaryPath', expectations_path, |
218 '--writeJsonSummaryPath', output_json_path, | 224 '--writeJsonSummaryPath', output_json_path, |
219 '--writePath', self._temp_dir, | 225 '--writePath', write_path_dir, |
220 '--writeWholeImage']) | 226 '--writeWholeImage']) |
221 modified_red_tiles = copy.deepcopy(RED_TILES) | 227 modified_red_tiles = copy.deepcopy(RED_TILES) |
222 modified_red_tiles[5]['comparisonResult'] = 'no-comparison' | 228 modified_red_tiles[5]['comparisonResult'] = 'no-comparison' |
223 expected_summary_dict = { | 229 expected_summary_dict = { |
224 "header" : EXPECTED_HEADER_CONTENTS, | 230 "header" : EXPECTED_HEADER_CONTENTS, |
225 "actual-results" : { | 231 "actual-results" : { |
226 "red.skp": { | 232 "red.skp": { |
227 "tiled-images": modified_red_tiles, | 233 "tiled-images": modified_red_tiles, |
228 "whole-image": modified_dict( | 234 "whole-image": modified_dict( |
229 RED_WHOLEIMAGE, {"comparisonResult" : "no-comparison"}), | 235 RED_WHOLEIMAGE, {"comparisonResult" : "no-comparison"}), |
230 }, | 236 }, |
231 "green.skp": { | 237 "green.skp": { |
232 "tiled-images": GREEN_TILES, | 238 "tiled-images": GREEN_TILES, |
233 "whole-image": GREEN_WHOLEIMAGE, | 239 "whole-image": GREEN_WHOLEIMAGE, |
234 } | 240 } |
235 } | 241 } |
236 } | 242 } |
237 self._assert_json_contents(output_json_path, expected_summary_dict) | 243 self._assert_json_contents(output_json_path, expected_summary_dict) |
238 | 244 |
239 def test_untiled(self): | 245 def test_untiled(self): |
240 """Run without tiles.""" | 246 """Run without tiles.""" |
241 output_json_path = os.path.join(self._temp_dir, 'actuals.json') | 247 output_json_path = os.path.join(self._output_dir, 'actuals.json') |
| 248 write_path_dir = self.create_empty_dir( |
| 249 path=os.path.join(self._output_dir, 'writePath')) |
242 self._generate_skps() | 250 self._generate_skps() |
243 expectations_path = self._create_expectations() | 251 expectations_path = self._create_expectations() |
244 self._run_render_pictures([ | 252 self._run_render_pictures([ |
245 '-r', self._input_skp_dir, | 253 '-r', self._input_skp_dir, |
246 '--readJsonSummaryPath', expectations_path, | 254 '--readJsonSummaryPath', expectations_path, |
247 '--writePath', self._temp_dir, | 255 '--writePath', write_path_dir, |
248 '--writeJsonSummaryPath', output_json_path]) | 256 '--writeJsonSummaryPath', output_json_path]) |
249 expected_summary_dict = { | 257 expected_summary_dict = { |
250 "header" : EXPECTED_HEADER_CONTENTS, | 258 "header" : EXPECTED_HEADER_CONTENTS, |
251 "actual-results" : { | 259 "actual-results" : { |
252 "red.skp": { | 260 "red.skp": { |
253 "whole-image": RED_WHOLEIMAGE, | 261 "whole-image": RED_WHOLEIMAGE, |
254 }, | 262 }, |
255 "green.skp": { | 263 "green.skp": { |
256 "whole-image": GREEN_WHOLEIMAGE, | 264 "whole-image": GREEN_WHOLEIMAGE, |
257 } | 265 } |
258 } | 266 } |
259 } | 267 } |
260 self._assert_json_contents(output_json_path, expected_summary_dict) | 268 self._assert_json_contents(output_json_path, expected_summary_dict) |
261 self._assert_directory_contents( | 269 self._assert_directory_contents( |
262 self._temp_dir, ['red_skp.png', 'green_skp.png', 'actuals.json']) | 270 write_path_dir, ['red_skp.png', 'green_skp.png']) |
263 | 271 |
264 def test_untiled_writeChecksumBasedFilenames(self): | 272 def test_untiled_writeChecksumBasedFilenames(self): |
265 """Same as test_untiled, but with --writeChecksumBasedFilenames.""" | 273 """Same as test_untiled, but with --writeChecksumBasedFilenames.""" |
266 output_json_path = os.path.join(self._temp_dir, 'actuals.json') | 274 output_json_path = os.path.join(self._output_dir, 'actuals.json') |
| 275 write_path_dir = self.create_empty_dir( |
| 276 path=os.path.join(self._output_dir, 'writePath')) |
267 self._generate_skps() | 277 self._generate_skps() |
268 self._run_render_pictures(['-r', self._input_skp_dir, | 278 self._run_render_pictures(['-r', self._input_skp_dir, |
269 '--writeChecksumBasedFilenames', | 279 '--writeChecksumBasedFilenames', |
270 '--writePath', self._temp_dir, | 280 '--writePath', write_path_dir, |
271 '--writeJsonSummaryPath', output_json_path]) | 281 '--writeJsonSummaryPath', output_json_path]) |
272 expected_summary_dict = { | 282 expected_summary_dict = { |
273 "header" : EXPECTED_HEADER_CONTENTS, | 283 "header" : EXPECTED_HEADER_CONTENTS, |
274 "actual-results" : { | 284 "actual-results" : { |
275 "red.skp": { | 285 "red.skp": { |
276 # Manually verified: 640x400 red rectangle with black border | 286 # Manually verified: 640x400 red rectangle with black border |
277 "whole-image": { | 287 "whole-image": { |
278 "checksumAlgorithm" : "bitmap-64bitMD5", | 288 "checksumAlgorithm" : "bitmap-64bitMD5", |
279 "checksumValue" : 11092453015575919668, | 289 "checksumValue" : 11092453015575919668, |
280 "comparisonResult" : "no-comparison", | 290 "comparisonResult" : "no-comparison", |
281 "filepath" : "red_skp/bitmap-64bitMD5_11092453015575919668.p
ng", | 291 "filepath" : "red_skp/bitmap-64bitMD5_11092453015575919668.p
ng", |
282 }, | 292 }, |
283 }, | 293 }, |
284 "green.skp": { | 294 "green.skp": { |
285 # Manually verified: 640x400 green rectangle with black border | 295 # Manually verified: 640x400 green rectangle with black border |
286 "whole-image": { | 296 "whole-image": { |
287 "checksumAlgorithm" : "bitmap-64bitMD5", | 297 "checksumAlgorithm" : "bitmap-64bitMD5", |
288 "checksumValue" : 8891695120562235492, | 298 "checksumValue" : 8891695120562235492, |
289 "comparisonResult" : "no-comparison", | 299 "comparisonResult" : "no-comparison", |
290 "filepath" : "green_skp/bitmap-64bitMD5_8891695120562235492.
png", | 300 "filepath" : "green_skp/bitmap-64bitMD5_8891695120562235492.
png", |
291 }, | 301 }, |
292 } | 302 } |
293 } | 303 } |
294 } | 304 } |
295 self._assert_json_contents(output_json_path, expected_summary_dict) | 305 self._assert_json_contents(output_json_path, expected_summary_dict) |
296 self._assert_directory_contents(self._temp_dir, [ | 306 self._assert_directory_contents(write_path_dir, ['red_skp', 'green_skp']) |
297 'red_skp', 'green_skp', 'actuals.json']) | |
298 self._assert_directory_contents( | 307 self._assert_directory_contents( |
299 os.path.join(self._temp_dir, 'red_skp'), | 308 os.path.join(write_path_dir, 'red_skp'), |
300 ['bitmap-64bitMD5_11092453015575919668.png']) | 309 ['bitmap-64bitMD5_11092453015575919668.png']) |
301 self._assert_directory_contents( | 310 self._assert_directory_contents( |
302 os.path.join(self._temp_dir, 'green_skp'), | 311 os.path.join(write_path_dir, 'green_skp'), |
303 ['bitmap-64bitMD5_8891695120562235492.png']) | 312 ['bitmap-64bitMD5_8891695120562235492.png']) |
304 | 313 |
305 def test_untiled_validate(self): | 314 def test_untiled_validate(self): |
306 """Same as test_untiled, but with --validate.""" | 315 """Same as test_untiled, but with --validate.""" |
307 output_json_path = os.path.join(self._temp_dir, 'actuals.json') | 316 output_json_path = os.path.join(self._output_dir, 'actuals.json') |
| 317 write_path_dir = self.create_empty_dir( |
| 318 path=os.path.join(self._output_dir, 'writePath')) |
308 self._generate_skps() | 319 self._generate_skps() |
309 expectations_path = self._create_expectations() | 320 expectations_path = self._create_expectations() |
310 self._run_render_pictures([ | 321 self._run_render_pictures([ |
311 '-r', self._input_skp_dir, | 322 '-r', self._input_skp_dir, |
312 '--readJsonSummaryPath', expectations_path, | 323 '--readJsonSummaryPath', expectations_path, |
313 '--validate', | 324 '--validate', |
314 '--writePath', self._temp_dir, | 325 '--writePath', write_path_dir, |
315 '--writeJsonSummaryPath', output_json_path]) | 326 '--writeJsonSummaryPath', output_json_path]) |
316 expected_summary_dict = { | 327 expected_summary_dict = { |
317 "header" : EXPECTED_HEADER_CONTENTS, | 328 "header" : EXPECTED_HEADER_CONTENTS, |
318 "actual-results" : { | 329 "actual-results" : { |
319 "red.skp": { | 330 "red.skp": { |
320 "whole-image": RED_WHOLEIMAGE, | 331 "whole-image": RED_WHOLEIMAGE, |
321 }, | 332 }, |
322 "green.skp": { | 333 "green.skp": { |
323 "whole-image": GREEN_WHOLEIMAGE, | 334 "whole-image": GREEN_WHOLEIMAGE, |
324 } | 335 } |
325 } | 336 } |
326 } | 337 } |
327 self._assert_json_contents(output_json_path, expected_summary_dict) | 338 self._assert_json_contents(output_json_path, expected_summary_dict) |
328 self._assert_directory_contents( | 339 self._assert_directory_contents( |
329 self._temp_dir, ['red_skp.png', 'green_skp.png', 'actuals.json']) | 340 write_path_dir, ['red_skp.png', 'green_skp.png']) |
330 | 341 |
331 def test_untiled_without_writePath(self): | 342 def test_untiled_without_writePath(self): |
332 """Same as test_untiled, but without --writePath.""" | 343 """Same as test_untiled, but without --writePath.""" |
333 output_json_path = os.path.join(self._temp_dir, 'actuals.json') | 344 output_json_path = os.path.join(self._output_dir, 'actuals.json') |
334 self._generate_skps() | 345 self._generate_skps() |
335 expectations_path = self._create_expectations() | 346 expectations_path = self._create_expectations() |
336 self._run_render_pictures([ | 347 self._run_render_pictures([ |
337 '-r', self._input_skp_dir, | 348 '-r', self._input_skp_dir, |
338 '--readJsonSummaryPath', expectations_path, | 349 '--readJsonSummaryPath', expectations_path, |
339 '--writeJsonSummaryPath', output_json_path]) | 350 '--writeJsonSummaryPath', output_json_path]) |
340 expected_summary_dict = { | 351 expected_summary_dict = { |
341 "header" : EXPECTED_HEADER_CONTENTS, | 352 "header" : EXPECTED_HEADER_CONTENTS, |
342 "actual-results" : { | 353 "actual-results" : { |
343 "red.skp": { | 354 "red.skp": { |
344 "whole-image": RED_WHOLEIMAGE, | 355 "whole-image": RED_WHOLEIMAGE, |
345 }, | 356 }, |
346 "green.skp": { | 357 "green.skp": { |
347 "whole-image": GREEN_WHOLEIMAGE, | 358 "whole-image": GREEN_WHOLEIMAGE, |
348 } | 359 } |
349 } | 360 } |
350 } | 361 } |
351 self._assert_json_contents(output_json_path, expected_summary_dict) | 362 self._assert_json_contents(output_json_path, expected_summary_dict) |
352 | 363 |
353 def test_tiled(self): | 364 def test_tiled(self): |
354 """Generate individual tiles.""" | 365 """Generate individual tiles.""" |
355 output_json_path = os.path.join(self._temp_dir, 'actuals.json') | 366 output_json_path = os.path.join(self._output_dir, 'actuals.json') |
| 367 write_path_dir = self.create_empty_dir( |
| 368 path=os.path.join(self._output_dir, 'writePath')) |
356 self._generate_skps() | 369 self._generate_skps() |
357 expectations_path = self._create_expectations() | 370 expectations_path = self._create_expectations() |
358 self._run_render_pictures([ | 371 self._run_render_pictures([ |
359 '-r', self._input_skp_dir, | 372 '-r', self._input_skp_dir, |
360 '--bbh', 'grid', '256', '256', | 373 '--bbh', 'grid', '256', '256', |
361 '--mode', 'tile', '256', '256', | 374 '--mode', 'tile', '256', '256', |
362 '--readJsonSummaryPath', expectations_path, | 375 '--readJsonSummaryPath', expectations_path, |
363 '--writePath', self._temp_dir, | 376 '--writePath', write_path_dir, |
364 '--writeJsonSummaryPath', output_json_path]) | 377 '--writeJsonSummaryPath', output_json_path]) |
365 expected_summary_dict = { | 378 expected_summary_dict = { |
366 "header" : EXPECTED_HEADER_CONTENTS, | 379 "header" : EXPECTED_HEADER_CONTENTS, |
367 "actual-results" : { | 380 "actual-results" : { |
368 "red.skp": { | 381 "red.skp": { |
369 "tiled-images": RED_TILES, | 382 "tiled-images": RED_TILES, |
370 }, | 383 }, |
371 "green.skp": { | 384 "green.skp": { |
372 "tiled-images": GREEN_TILES, | 385 "tiled-images": GREEN_TILES, |
373 } | 386 } |
374 } | 387 } |
375 } | 388 } |
376 self._assert_json_contents(output_json_path, expected_summary_dict) | 389 self._assert_json_contents(output_json_path, expected_summary_dict) |
377 self._assert_directory_contents( | 390 self._assert_directory_contents( |
378 self._temp_dir, | 391 write_path_dir, |
379 ['red_skp-tile0.png', 'red_skp-tile1.png', 'red_skp-tile2.png', | 392 ['red_skp-tile0.png', 'red_skp-tile1.png', 'red_skp-tile2.png', |
380 'red_skp-tile3.png', 'red_skp-tile4.png', 'red_skp-tile5.png', | 393 'red_skp-tile3.png', 'red_skp-tile4.png', 'red_skp-tile5.png', |
381 'green_skp-tile0.png', 'green_skp-tile1.png', 'green_skp-tile2.png', | 394 'green_skp-tile0.png', 'green_skp-tile1.png', 'green_skp-tile2.png', |
382 'green_skp-tile3.png', 'green_skp-tile4.png', 'green_skp-tile5.png', | 395 'green_skp-tile3.png', 'green_skp-tile4.png', 'green_skp-tile5.png', |
383 'actuals.json']) | 396 ]) |
| 397 |
| 398 def test_tiled_mismatches(self): |
| 399 """Same as test_tiled, but only write out mismatching images.""" |
| 400 output_json_path = os.path.join(self._output_dir, 'actuals.json') |
| 401 mismatch_path_dir = self.create_empty_dir( |
| 402 path=os.path.join(self._output_dir, 'mismatchPath')) |
| 403 self._generate_skps() |
| 404 expectations_path = self._create_expectations() |
| 405 self._run_render_pictures([ |
| 406 '-r', self._input_skp_dir, |
| 407 '--bbh', 'grid', '256', '256', |
| 408 '--mode', 'tile', '256', '256', |
| 409 '--readJsonSummaryPath', expectations_path, |
| 410 '--mismatchPath', mismatch_path_dir, |
| 411 '--writeJsonSummaryPath', output_json_path]) |
| 412 expected_summary_dict = { |
| 413 "header" : EXPECTED_HEADER_CONTENTS, |
| 414 "actual-results" : { |
| 415 "red.skp": { |
| 416 "tiled-images": RED_TILES, |
| 417 }, |
| 418 "green.skp": { |
| 419 "tiled-images": GREEN_TILES, |
| 420 } |
| 421 } |
| 422 } |
| 423 self._assert_json_contents(output_json_path, expected_summary_dict) |
| 424 self._assert_directory_contents( |
| 425 mismatch_path_dir, |
| 426 ['red_skp-tile0.png', 'red_skp-tile1.png', 'red_skp-tile2.png', |
| 427 'red_skp-tile3.png', 'red_skp-tile4.png', 'red_skp-tile5.png', |
| 428 ]) |
384 | 429 |
385 def test_tiled_writeChecksumBasedFilenames(self): | 430 def test_tiled_writeChecksumBasedFilenames(self): |
386 """Same as test_tiled, but with --writeChecksumBasedFilenames.""" | 431 """Same as test_tiled, but with --writeChecksumBasedFilenames.""" |
387 output_json_path = os.path.join(self._temp_dir, 'actuals.json') | 432 output_json_path = os.path.join(self._output_dir, 'actuals.json') |
| 433 write_path_dir = self.create_empty_dir( |
| 434 path=os.path.join(self._output_dir, 'writePath')) |
388 self._generate_skps() | 435 self._generate_skps() |
389 self._run_render_pictures(['-r', self._input_skp_dir, | 436 self._run_render_pictures(['-r', self._input_skp_dir, |
390 '--bbh', 'grid', '256', '256', | 437 '--bbh', 'grid', '256', '256', |
391 '--mode', 'tile', '256', '256', | 438 '--mode', 'tile', '256', '256', |
392 '--writeChecksumBasedFilenames', | 439 '--writeChecksumBasedFilenames', |
393 '--writePath', self._temp_dir, | 440 '--writePath', write_path_dir, |
394 '--writeJsonSummaryPath', output_json_path]) | 441 '--writeJsonSummaryPath', output_json_path]) |
395 expected_summary_dict = { | 442 expected_summary_dict = { |
396 "header" : EXPECTED_HEADER_CONTENTS, | 443 "header" : EXPECTED_HEADER_CONTENTS, |
397 "actual-results" : { | 444 "actual-results" : { |
398 "red.skp": { | 445 "red.skp": { |
399 # Manually verified these 6 images, all 256x256 tiles, | 446 # Manually verified these 6 images, all 256x256 tiles, |
400 # consistent with a tiled version of the 640x400 red rect | 447 # consistent with a tiled version of the 640x400 red rect |
401 # with black borders. | 448 # with black borders. |
402 "tiled-images": [{ | 449 "tiled-images": [{ |
403 "checksumAlgorithm" : "bitmap-64bitMD5", | 450 "checksumAlgorithm" : "bitmap-64bitMD5", |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 }, { | 510 }, { |
464 "checksumAlgorithm" : "bitmap-64bitMD5", | 511 "checksumAlgorithm" : "bitmap-64bitMD5", |
465 "checksumValue" : 10673669813016809363, | 512 "checksumValue" : 10673669813016809363, |
466 "comparisonResult" : "no-comparison", | 513 "comparisonResult" : "no-comparison", |
467 "filepath" : "green_skp/bitmap-64bitMD5_10673669813016809363
.png", | 514 "filepath" : "green_skp/bitmap-64bitMD5_10673669813016809363
.png", |
468 }], | 515 }], |
469 } | 516 } |
470 } | 517 } |
471 } | 518 } |
472 self._assert_json_contents(output_json_path, expected_summary_dict) | 519 self._assert_json_contents(output_json_path, expected_summary_dict) |
473 self._assert_directory_contents(self._temp_dir, [ | 520 self._assert_directory_contents(write_path_dir, ['red_skp', 'green_skp']) |
474 'red_skp', 'green_skp', 'actuals.json']) | |
475 self._assert_directory_contents( | 521 self._assert_directory_contents( |
476 os.path.join(self._temp_dir, 'red_skp'), | 522 os.path.join(write_path_dir, 'red_skp'), |
477 ['bitmap-64bitMD5_5815827069051002745.png', | 523 ['bitmap-64bitMD5_5815827069051002745.png', |
478 'bitmap-64bitMD5_9323613075234140270.png', | 524 'bitmap-64bitMD5_9323613075234140270.png', |
479 'bitmap-64bitMD5_16670399404877552232.png', | 525 'bitmap-64bitMD5_16670399404877552232.png', |
480 'bitmap-64bitMD5_2507897274083364964.png', | 526 'bitmap-64bitMD5_2507897274083364964.png', |
481 'bitmap-64bitMD5_7325267995523877959.png', | 527 'bitmap-64bitMD5_7325267995523877959.png', |
482 'bitmap-64bitMD5_2181381724594493116.png']) | 528 'bitmap-64bitMD5_2181381724594493116.png']) |
483 self._assert_directory_contents( | 529 self._assert_directory_contents( |
484 os.path.join(self._temp_dir, 'green_skp'), | 530 os.path.join(write_path_dir, 'green_skp'), |
485 ['bitmap-64bitMD5_12587324416545178013.png', | 531 ['bitmap-64bitMD5_12587324416545178013.png', |
486 'bitmap-64bitMD5_7624374914829746293.png', | 532 'bitmap-64bitMD5_7624374914829746293.png', |
487 'bitmap-64bitMD5_5686489729535631913.png', | 533 'bitmap-64bitMD5_5686489729535631913.png', |
488 'bitmap-64bitMD5_7980646035555096146.png', | 534 'bitmap-64bitMD5_7980646035555096146.png', |
489 'bitmap-64bitMD5_17817086664365875131.png', | 535 'bitmap-64bitMD5_17817086664365875131.png', |
490 'bitmap-64bitMD5_10673669813016809363.png']) | 536 'bitmap-64bitMD5_10673669813016809363.png']) |
491 | 537 |
492 def _run_render_pictures(self, args): | 538 def _run_render_pictures(self, args): |
493 binary = self.find_path_to_program('render_pictures') | 539 binary = self.find_path_to_program('render_pictures') |
494 return self.run_command([binary, | 540 return self.run_command([binary, |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 self.assertMultiLineEqual(prettyprinted_expected_dict, | 641 self.assertMultiLineEqual(prettyprinted_expected_dict, |
596 prettyprinted_json_dict) | 642 prettyprinted_json_dict) |
597 | 643 |
598 | 644 |
599 def main(): | 645 def main(): |
600 base_unittest.main(RenderPicturesTest) | 646 base_unittest.main(RenderPicturesTest) |
601 | 647 |
602 | 648 |
603 if __name__ == '__main__': | 649 if __name__ == '__main__': |
604 main() | 650 main() |
OLD | NEW |