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

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

Issue 546753003: Bugfix that cause skpdiff to segfault. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fixed tools self tests Created 6 years, 3 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 the render_pictures binary. 9 Test the render_pictures binary.
10 """ 10 """
(...skipping 18 matching lines...) Expand all
29 EXPECTED_HEADER_CONTENTS = { 29 EXPECTED_HEADER_CONTENTS = {
30 "type" : "ChecksummedImages", 30 "type" : "ChecksummedImages",
31 "revision" : 1, 31 "revision" : 1,
32 } 32 }
33 33
34 # Manually verified: 640x400 red rectangle with black border 34 # Manually verified: 640x400 red rectangle with black border
35 # Standard expectations will be set up in such a way that this image fails 35 # Standard expectations will be set up in such a way that this image fails
36 # the comparison. 36 # the comparison.
37 RED_WHOLEIMAGE = { 37 RED_WHOLEIMAGE = {
38 "checksumAlgorithm" : "bitmap-64bitMD5", 38 "checksumAlgorithm" : "bitmap-64bitMD5",
39 "checksumValue" : 11092453015575919668, 39 "checksumValue" : 2853310525600416231,
40 "comparisonResult" : "failed", 40 "comparisonResult" : "failed",
41 "filepath" : "red_skp.png", 41 "filepath" : "red_skp.png",
42 } 42 }
43 43
44 # Manually verified: 640x400 green rectangle with black border 44 # Manually verified: 640x400 green rectangle with black border
45 # Standard expectations will be set up in such a way that this image passes 45 # Standard expectations will be set up in such a way that this image passes
46 # the comparison. 46 # the comparison.
47 GREEN_WHOLEIMAGE = { 47 GREEN_WHOLEIMAGE = {
48 "checksumAlgorithm" : "bitmap-64bitMD5", 48 "checksumAlgorithm" : "bitmap-64bitMD5",
49 "checksumValue" : 8891695120562235492, 49 "checksumValue" : 11143979097452425335,
50 "comparisonResult" : "succeeded", 50 "comparisonResult" : "succeeded",
51 "filepath" : "green_skp.png", 51 "filepath" : "green_skp.png",
52 } 52 }
53 53
54 # Manually verified these 6 images, all 256x256 tiles, 54 # Manually verified these 6 images, all 256x256 tiles,
55 # consistent with a tiled version of the 640x400 red rect 55 # consistent with a tiled version of the 640x400 red rect
56 # with black borders. 56 # with black borders.
57 # Standard expectations will be set up in such a way that these images fail 57 # Standard expectations will be set up in such a way that these images fail
58 # the comparison. 58 # the comparison.
59 RED_TILES = [{ 59 RED_TILES = [{
60 "checksumAlgorithm" : "bitmap-64bitMD5", 60 "checksumAlgorithm" : "bitmap-64bitMD5",
61 "checksumValue" : 5815827069051002745, 61 "checksumValue" : 5815827069051002745,
62 "comparisonResult" : "failed", 62 "comparisonResult" : "failed",
63 "filepath" : "red_skp-tile0.png", 63 "filepath" : "red_skp-tile0.png",
64 },{ 64 },{
65 "checksumAlgorithm" : "bitmap-64bitMD5", 65 "checksumAlgorithm" : "bitmap-64bitMD5",
66 "checksumValue" : 9323613075234140270, 66 "checksumValue" : 9323613075234140270,
67 "comparisonResult" : "failed", 67 "comparisonResult" : "failed",
68 "filepath" : "red_skp-tile1.png", 68 "filepath" : "red_skp-tile1.png",
69 }, { 69 }, {
70 "checksumAlgorithm" : "bitmap-64bitMD5", 70 "checksumAlgorithm" : "bitmap-64bitMD5",
71 "checksumValue" : 16670399404877552232, 71 "checksumValue" : 15939355025996362179,
72 "comparisonResult" : "failed", 72 "comparisonResult" : "failed",
73 "filepath" : "red_skp-tile2.png", 73 "filepath" : "red_skp-tile2.png",
74 }, { 74 }, {
75 "checksumAlgorithm" : "bitmap-64bitMD5", 75 "checksumAlgorithm" : "bitmap-64bitMD5",
76 "checksumValue" : 2507897274083364964, 76 "checksumValue" : 649771916797529222,
77 "comparisonResult" : "failed", 77 "comparisonResult" : "failed",
78 "filepath" : "red_skp-tile3.png", 78 "filepath" : "red_skp-tile3.png",
79 }, { 79 }, {
80 "checksumAlgorithm" : "bitmap-64bitMD5", 80 "checksumAlgorithm" : "bitmap-64bitMD5",
81 "checksumValue" : 7325267995523877959, 81 "checksumValue" : 8132820002266077288,
82 "comparisonResult" : "failed", 82 "comparisonResult" : "failed",
83 "filepath" : "red_skp-tile4.png", 83 "filepath" : "red_skp-tile4.png",
84 }, { 84 }, {
85 "checksumAlgorithm" : "bitmap-64bitMD5", 85 "checksumAlgorithm" : "bitmap-64bitMD5",
86 "checksumValue" : 2181381724594493116, 86 "checksumValue" : 2406160701181324581,
87 "comparisonResult" : "failed", 87 "comparisonResult" : "failed",
88 "filepath" : "red_skp-tile5.png", 88 "filepath" : "red_skp-tile5.png",
89 }] 89 }]
90 90
91 # Manually verified these 6 images, all 256x256 tiles, 91 # Manually verified these 6 images, all 256x256 tiles,
92 # consistent with a tiled version of the 640x400 green rect 92 # consistent with a tiled version of the 640x400 green rect
93 # with black borders. 93 # with black borders.
94 # Standard expectations will be set up in such a way that these images pass 94 # Standard expectations will be set up in such a way that these images pass
95 # the comparison. 95 # the comparison.
96 GREEN_TILES = [{ 96 GREEN_TILES = [{
97 "checksumAlgorithm" : "bitmap-64bitMD5", 97 "checksumAlgorithm" : "bitmap-64bitMD5",
98 "checksumValue" : 12587324416545178013, 98 "checksumValue" : 12587324416545178013,
99 "comparisonResult" : "succeeded", 99 "comparisonResult" : "succeeded",
100 "filepath" : "green_skp-tile0.png", 100 "filepath" : "green_skp-tile0.png",
101 }, { 101 }, {
102 "checksumAlgorithm" : "bitmap-64bitMD5", 102 "checksumAlgorithm" : "bitmap-64bitMD5",
103 "checksumValue" : 7624374914829746293, 103 "checksumValue" : 7624374914829746293,
104 "comparisonResult" : "succeeded", 104 "comparisonResult" : "succeeded",
105 "filepath" : "green_skp-tile1.png", 105 "filepath" : "green_skp-tile1.png",
106 }, { 106 }, {
107 "checksumAlgorithm" : "bitmap-64bitMD5", 107 "checksumAlgorithm" : "bitmap-64bitMD5",
108 "checksumValue" : 5686489729535631913, 108 "checksumValue" : 11866144860997809880,
109 "comparisonResult" : "succeeded", 109 "comparisonResult" : "succeeded",
110 "filepath" : "green_skp-tile2.png", 110 "filepath" : "green_skp-tile2.png",
111 }, { 111 }, {
112 "checksumAlgorithm" : "bitmap-64bitMD5", 112 "checksumAlgorithm" : "bitmap-64bitMD5",
113 "checksumValue" : 7980646035555096146, 113 "checksumValue" : 3893392565127823822,
114 "comparisonResult" : "succeeded", 114 "comparisonResult" : "succeeded",
115 "filepath" : "green_skp-tile3.png", 115 "filepath" : "green_skp-tile3.png",
116 }, { 116 }, {
117 "checksumAlgorithm" : "bitmap-64bitMD5", 117 "checksumAlgorithm" : "bitmap-64bitMD5",
118 "checksumValue" : 17817086664365875131, 118 "checksumValue" : 2083084978343901738,
119 "comparisonResult" : "succeeded", 119 "comparisonResult" : "succeeded",
120 "filepath" : "green_skp-tile4.png", 120 "filepath" : "green_skp-tile4.png",
121 }, { 121 }, {
122 "checksumAlgorithm" : "bitmap-64bitMD5", 122 "checksumAlgorithm" : "bitmap-64bitMD5",
123 "checksumValue" : 10673669813016809363, 123 "checksumValue" : 89620927366502076,
124 "comparisonResult" : "succeeded", 124 "comparisonResult" : "succeeded",
125 "filepath" : "green_skp-tile5.png", 125 "filepath" : "green_skp-tile5.png",
126 }] 126 }]
127 127
128 128
129 def modified_dict(input_dict, modification_dict): 129 def modified_dict(input_dict, modification_dict):
130 """Returns a dict, with some modifications applied to it. 130 """Returns a dict, with some modifications applied to it.
131 131
132 Args: 132 Args:
133 input_dict: a dictionary (which will be copied, not modified in place) 133 input_dict: a dictionary (which will be copied, not modified in place)
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 "image-base-gs-url" : None, 378 "image-base-gs-url" : None,
379 "descriptions" : { 379 "descriptions" : {
380 "builder": "builderName", 380 "builder": "builderName",
381 "renderMode": "renderModeName", 381 "renderMode": "renderModeName",
382 }, 382 },
383 "actual-results" : { 383 "actual-results" : {
384 "red.skp": { 384 "red.skp": {
385 # Manually verified: 640x400 red rectangle with black border 385 # Manually verified: 640x400 red rectangle with black border
386 "whole-image": { 386 "whole-image": {
387 "checksumAlgorithm" : "bitmap-64bitMD5", 387 "checksumAlgorithm" : "bitmap-64bitMD5",
388 "checksumValue" : 11092453015575919668, 388 "checksumValue" : 2853310525600416231,
389 "comparisonResult" : "no-comparison", 389 "comparisonResult" : "no-comparison",
390 "filepath" : 390 "filepath" :
391 "red_skp/bitmap-64bitMD5_11092453015575919668.png", 391 "red_skp/bitmap-64bitMD5_2853310525600416231.png",
392 }, 392 },
393 }, 393 },
394 "green.skp": { 394 "green.skp": {
395 # Manually verified: 640x400 green rectangle with black border 395 # Manually verified: 640x400 green rectangle with black border
396 "whole-image": { 396 "whole-image": {
397 "checksumAlgorithm" : "bitmap-64bitMD5", 397 "checksumAlgorithm" : "bitmap-64bitMD5",
398 "checksumValue" : 8891695120562235492, 398 "checksumValue" : 11143979097452425335,
399 "comparisonResult" : "no-comparison", 399 "comparisonResult" : "no-comparison",
400 "filepath" : 400 "filepath" :
401 "green_skp/bitmap-64bitMD5_8891695120562235492.png", 401 "green_skp/bitmap-64bitMD5_11143979097452425335.png",
402 }, 402 },
403 } 403 }
404 } 404 }
405 } 405 }
406 self._assert_json_contents(output_json_path, expected_summary_dict) 406 self._assert_json_contents(output_json_path, expected_summary_dict)
407 self._assert_directory_contents(write_path_dir, ['red_skp', 'green_skp']) 407 self._assert_directory_contents(write_path_dir, ['red_skp', 'green_skp'])
408 self._assert_directory_contents( 408 self._assert_directory_contents(
409 os.path.join(write_path_dir, 'red_skp'), 409 os.path.join(write_path_dir, 'red_skp'),
410 ['bitmap-64bitMD5_11092453015575919668.png']) 410 ['bitmap-64bitMD5_2853310525600416231.png'])
411 self._assert_directory_contents( 411 self._assert_directory_contents(
412 os.path.join(write_path_dir, 'green_skp'), 412 os.path.join(write_path_dir, 'green_skp'),
413 ['bitmap-64bitMD5_8891695120562235492.png']) 413 ['bitmap-64bitMD5_11143979097452425335.png'])
414 414
415 def test_untiled_validate(self): 415 def test_untiled_validate(self):
416 """Same as test_untiled, but with --validate.""" 416 """Same as test_untiled, but with --validate."""
417 self._test_untiled(additional_args=['--validate']) 417 self._test_untiled(additional_args=['--validate'])
418 418
419 def test_untiled_without_writePath(self): 419 def test_untiled_without_writePath(self):
420 """Same as test_untiled, but without --writePath.""" 420 """Same as test_untiled, but without --writePath."""
421 output_json_path = os.path.join(self._output_dir, 'actuals.json') 421 output_json_path = os.path.join(self._output_dir, 'actuals.json')
422 self._generate_skps() 422 self._generate_skps()
423 expectations_path = self._create_expectations() 423 expectations_path = self._create_expectations()
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 "filepath" : 538 "filepath" :
539 "red_skp/bitmap-64bitMD5_5815827069051002745.png", 539 "red_skp/bitmap-64bitMD5_5815827069051002745.png",
540 }, { 540 }, {
541 "checksumAlgorithm" : "bitmap-64bitMD5", 541 "checksumAlgorithm" : "bitmap-64bitMD5",
542 "checksumValue" : 9323613075234140270, 542 "checksumValue" : 9323613075234140270,
543 "comparisonResult" : "no-comparison", 543 "comparisonResult" : "no-comparison",
544 "filepath" : 544 "filepath" :
545 "red_skp/bitmap-64bitMD5_9323613075234140270.png", 545 "red_skp/bitmap-64bitMD5_9323613075234140270.png",
546 }, { 546 }, {
547 "checksumAlgorithm" : "bitmap-64bitMD5", 547 "checksumAlgorithm" : "bitmap-64bitMD5",
548 "checksumValue" : 16670399404877552232, 548 "checksumValue" : 15939355025996362179,
549 "comparisonResult" : "no-comparison", 549 "comparisonResult" : "no-comparison",
550 "filepath" : 550 "filepath" :
551 "red_skp/bitmap-64bitMD5_16670399404877552232.png", 551 "red_skp/bitmap-64bitMD5_15939355025996362179.png",
552 }, { 552 }, {
553 "checksumAlgorithm" : "bitmap-64bitMD5", 553 "checksumAlgorithm" : "bitmap-64bitMD5",
554 "checksumValue" : 2507897274083364964, 554 "checksumValue" : 649771916797529222,
555 "comparisonResult" : "no-comparison", 555 "comparisonResult" : "no-comparison",
556 "filepath" : 556 "filepath" :
557 "red_skp/bitmap-64bitMD5_2507897274083364964.png", 557 "red_skp/bitmap-64bitMD5_649771916797529222.png",
558 }, { 558 }, {
559 "checksumAlgorithm" : "bitmap-64bitMD5", 559 "checksumAlgorithm" : "bitmap-64bitMD5",
560 "checksumValue" : 7325267995523877959, 560 "checksumValue" : 8132820002266077288,
561 "comparisonResult" : "no-comparison", 561 "comparisonResult" : "no-comparison",
562 "filepath" : 562 "filepath" :
563 "red_skp/bitmap-64bitMD5_7325267995523877959.png", 563 "red_skp/bitmap-64bitMD5_8132820002266077288.png",
564 }, { 564 }, {
565 "checksumAlgorithm" : "bitmap-64bitMD5", 565 "checksumAlgorithm" : "bitmap-64bitMD5",
566 "checksumValue" : 2181381724594493116, 566 "checksumValue" : 2406160701181324581,
567 "comparisonResult" : "no-comparison", 567 "comparisonResult" : "no-comparison",
568 "filepath" : 568 "filepath" :
569 "red_skp/bitmap-64bitMD5_2181381724594493116.png", 569 "red_skp/bitmap-64bitMD5_2406160701181324581.png",
570 }], 570 }],
571 }, 571 },
572 "green.skp": { 572 "green.skp": {
573 # Manually verified these 6 images, all 256x256 tiles, 573 # Manually verified these 6 images, all 256x256 tiles,
574 # consistent with a tiled version of the 640x400 green rect 574 # consistent with a tiled version of the 640x400 green rect
575 # with black borders. 575 # with black borders.
576 "tiled-images": [{ 576 "tiled-images": [{
577 "checksumAlgorithm" : "bitmap-64bitMD5", 577 "checksumAlgorithm" : "bitmap-64bitMD5",
578 "checksumValue" : 12587324416545178013, 578 "checksumValue" : 12587324416545178013,
579 "comparisonResult" : "no-comparison", 579 "comparisonResult" : "no-comparison",
580 "filepath" : 580 "filepath" :
581 "green_skp/bitmap-64bitMD5_12587324416545178013.png", 581 "green_skp/bitmap-64bitMD5_12587324416545178013.png",
582 }, { 582 }, {
583 "checksumAlgorithm" : "bitmap-64bitMD5", 583 "checksumAlgorithm" : "bitmap-64bitMD5",
584 "checksumValue" : 7624374914829746293, 584 "checksumValue" : 7624374914829746293,
585 "comparisonResult" : "no-comparison", 585 "comparisonResult" : "no-comparison",
586 "filepath" : 586 "filepath" :
587 "green_skp/bitmap-64bitMD5_7624374914829746293.png", 587 "green_skp/bitmap-64bitMD5_7624374914829746293.png",
588 }, { 588 }, {
589 "checksumAlgorithm" : "bitmap-64bitMD5", 589 "checksumAlgorithm" : "bitmap-64bitMD5",
590 "checksumValue" : 5686489729535631913, 590 "checksumValue" : 11866144860997809880,
591 "comparisonResult" : "no-comparison", 591 "comparisonResult" : "no-comparison",
592 "filepath" : 592 "filepath" :
593 "green_skp/bitmap-64bitMD5_5686489729535631913.png", 593 "green_skp/bitmap-64bitMD5_11866144860997809880.png",
594 }, { 594 }, {
595 "checksumAlgorithm" : "bitmap-64bitMD5", 595 "checksumAlgorithm" : "bitmap-64bitMD5",
596 "checksumValue" : 7980646035555096146, 596 "checksumValue" : 3893392565127823822,
597 "comparisonResult" : "no-comparison", 597 "comparisonResult" : "no-comparison",
598 "filepath" : 598 "filepath" :
599 "green_skp/bitmap-64bitMD5_7980646035555096146.png", 599 "green_skp/bitmap-64bitMD5_3893392565127823822.png",
600 }, { 600 }, {
601 "checksumAlgorithm" : "bitmap-64bitMD5", 601 "checksumAlgorithm" : "bitmap-64bitMD5",
602 "checksumValue" : 17817086664365875131, 602 "checksumValue" : 2083084978343901738,
603 "comparisonResult" : "no-comparison", 603 "comparisonResult" : "no-comparison",
604 "filepath" : 604 "filepath" :
605 "green_skp/bitmap-64bitMD5_17817086664365875131.png", 605 "green_skp/bitmap-64bitMD5_2083084978343901738.png",
606 }, { 606 }, {
607 "checksumAlgorithm" : "bitmap-64bitMD5", 607 "checksumAlgorithm" : "bitmap-64bitMD5",
608 "checksumValue" : 10673669813016809363, 608 "checksumValue" : 89620927366502076,
609 "comparisonResult" : "no-comparison", 609 "comparisonResult" : "no-comparison",
610 "filepath" : 610 "filepath" :
611 "green_skp/bitmap-64bitMD5_10673669813016809363.png", 611 "green_skp/bitmap-64bitMD5_89620927366502076.png",
612 }], 612 }],
613 } 613 }
614 } 614 }
615 } 615 }
616 self._assert_json_contents(output_json_path, expected_summary_dict) 616 self._assert_json_contents(output_json_path, expected_summary_dict)
617 self._assert_directory_contents(write_path_dir, ['red_skp', 'green_skp']) 617 self._assert_directory_contents(write_path_dir, ['red_skp', 'green_skp'])
618 self._assert_directory_contents( 618 self._assert_directory_contents(
619 os.path.join(write_path_dir, 'red_skp'), 619 os.path.join(write_path_dir, 'red_skp'),
620 ['bitmap-64bitMD5_5815827069051002745.png', 620 ['bitmap-64bitMD5_5815827069051002745.png',
621 'bitmap-64bitMD5_9323613075234140270.png', 621 'bitmap-64bitMD5_9323613075234140270.png',
622 'bitmap-64bitMD5_16670399404877552232.png', 622 'bitmap-64bitMD5_15939355025996362179.png',
623 'bitmap-64bitMD5_2507897274083364964.png', 623 'bitmap-64bitMD5_649771916797529222.png',
624 'bitmap-64bitMD5_7325267995523877959.png', 624 'bitmap-64bitMD5_8132820002266077288.png',
625 'bitmap-64bitMD5_2181381724594493116.png']) 625 'bitmap-64bitMD5_2406160701181324581.png'])
626 self._assert_directory_contents( 626 self._assert_directory_contents(
627 os.path.join(write_path_dir, 'green_skp'), 627 os.path.join(write_path_dir, 'green_skp'),
628 ['bitmap-64bitMD5_12587324416545178013.png', 628 ['bitmap-64bitMD5_12587324416545178013.png',
629 'bitmap-64bitMD5_7624374914829746293.png', 629 'bitmap-64bitMD5_7624374914829746293.png',
630 'bitmap-64bitMD5_5686489729535631913.png', 630 'bitmap-64bitMD5_11866144860997809880.png',
631 'bitmap-64bitMD5_7980646035555096146.png', 631 'bitmap-64bitMD5_3893392565127823822.png',
632 'bitmap-64bitMD5_17817086664365875131.png', 632 'bitmap-64bitMD5_2083084978343901738.png',
633 'bitmap-64bitMD5_10673669813016809363.png']) 633 'bitmap-64bitMD5_89620927366502076.png'])
634 634
635 def _run_render_pictures(self, args): 635 def _run_render_pictures(self, args):
636 binary = find_run_binary.find_path_to_program('render_pictures') 636 binary = find_run_binary.find_path_to_program('render_pictures')
637 return find_run_binary.run_command( 637 return find_run_binary.run_command(
638 [binary, '--config', '8888'] + args) 638 [binary, '--config', '8888'] + args)
639 639
640 def _create_expectations(self, missing_some_images=False, 640 def _create_expectations(self, missing_some_images=False,
641 ignore_some_failures=False, 641 ignore_some_failures=False,
642 rel_path='expectations.json'): 642 rel_path='expectations.json'):
643 """Creates expectations JSON file within self._expectations_dir . 643 """Creates expectations JSON file within self._expectations_dir .
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 self.assertMultiLineEqual(prettyprinted_expected_dict, 745 self.assertMultiLineEqual(prettyprinted_expected_dict,
746 prettyprinted_json_dict) 746 prettyprinted_json_dict)
747 747
748 748
749 def main(): 749 def main():
750 base_unittest.main(RenderPicturesTest) 750 base_unittest.main(RenderPicturesTest)
751 751
752 752
753 if __name__ == '__main__': 753 if __name__ == '__main__':
754 main() 754 main()
OLDNEW
« tools/skpdiff/SkDiffContext.cpp ('K') | « tools/skpdiff/SkDiffContext.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698