Chromium Code Reviews| 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 """ |
| 11 | 11 |
| 12 # System-level imports | 12 # System-level imports |
| 13 import json | 13 import json |
| 14 import os | 14 import os |
| 15 import shutil | 15 import shutil |
| 16 import tempfile | 16 import tempfile |
| 17 | 17 |
| 18 # Imports from within Skia | 18 # Imports from within Skia |
| 19 import base_unittest | 19 import base_unittest |
| 20 | 20 |
| 21 # Maximum length of text diffs to show when tests fail | 21 # Maximum length of text diffs to show when tests fail |
| 22 MAX_DIFF_LENGTH = 30000 | 22 MAX_DIFF_LENGTH = 30000 |
| 23 | 23 |
| 24 EXPECTED_HEADER_CONTENTS = { | |
| 25 "type" : "ChecksummedImages", | |
| 26 "revision" : 1, | |
| 27 } | |
| 28 | |
| 24 | 29 |
| 25 class RenderPicturesTest(base_unittest.TestCase): | 30 class RenderPicturesTest(base_unittest.TestCase): |
| 26 | 31 |
| 27 def setUp(self): | 32 def setUp(self): |
| 28 self._input_skp_dir = tempfile.mkdtemp() | 33 self._input_skp_dir = tempfile.mkdtemp() |
| 29 self._temp_dir = tempfile.mkdtemp() | 34 self._temp_dir = tempfile.mkdtemp() |
| 30 self.maxDiff = MAX_DIFF_LENGTH | 35 self.maxDiff = MAX_DIFF_LENGTH |
| 31 | 36 |
| 32 def tearDown(self): | 37 def tearDown(self): |
| 33 shutil.rmtree(self._input_skp_dir) | 38 shutil.rmtree(self._input_skp_dir) |
| 34 shutil.rmtree(self._temp_dir) | 39 shutil.rmtree(self._temp_dir) |
| 35 | 40 |
| 36 def test_tiled_whole_image(self): | 41 def test_tiled_whole_image(self): |
| 37 """Run render_pictures with tiles and --writeWholeImage flag.""" | 42 """Run render_pictures with tiles and --writeWholeImage flag.""" |
| 38 output_json_path = os.path.join(self._temp_dir, 'output.json') | 43 output_json_path = os.path.join(self._temp_dir, 'output.json') |
| 39 self._generate_skps() | 44 self._generate_skps() |
| 40 # TODO(epoger): I noticed that when this is run without --writePath being | 45 # TODO(epoger): I noticed that when this is run without --writePath being |
| 41 # specified, this test writes red.png and green.png to the current working | 46 # specified, this test writes red_skp.png and green_skp.png to the current |
| 42 # directory. We should fix that... if --writePath is not specified, this | 47 # directory. We should fix that... if --writePath is not specified, this |
| 43 # probably shouldn't write out red.png and green.png at all! | 48 # probably shouldn't write out red_skp.png and green_skp.png at all! |
| 44 self._run_render_pictures(['-r', self._input_skp_dir, | 49 self._run_render_pictures(['-r', self._input_skp_dir, |
| 45 '--bbh', 'grid', '256', '256', | 50 '--bbh', 'grid', '256', '256', |
| 46 '--mode', 'tile', '256', '256', | 51 '--mode', 'tile', '256', '256', |
| 47 '--writeJsonSummaryPath', output_json_path, | 52 '--writeJsonSummaryPath', output_json_path, |
| 48 '--writePath', self._temp_dir, | 53 '--writePath', self._temp_dir, |
| 49 '--writeWholeImage']) | 54 '--writeWholeImage']) |
| 50 expected_summary_dict = { | 55 expected_summary_dict = { |
| 56 "header" : EXPECTED_HEADER_CONTENTS, | |
| 51 "actual-results" : { | 57 "actual-results" : { |
| 52 "no-comparison" : { | 58 "no-comparison" : { |
| 53 # Manually verified: 640x400 red rectangle with black border | 59 # Manually verified: 640x400 red rectangle with black border |
| 54 "red.png" : [ "bitmap-64bitMD5", 11092453015575919668 ], | 60 "red.skp" : { |
| 61 "checksumAlgorithm" : "bitmap-64bitMD5", | |
| 62 "checksumValue" : 11092453015575919668, | |
| 63 "filepath" : "red_skp.png", | |
|
epoger
2014/04/07 19:43:13
I changed this for consistency with the tiled case
rmistry
2014/04/07 20:07:22
Acknowledged.
| |
| 64 }, | |
| 55 # Manually verified: 640x400 green rectangle with black border | 65 # Manually verified: 640x400 green rectangle with black border |
| 56 "green.png" : [ "bitmap-64bitMD5", 8891695120562235492 ], | 66 "green.skp" : { |
| 67 "checksumAlgorithm" : "bitmap-64bitMD5", | |
| 68 "checksumValue" : 8891695120562235492, | |
| 69 "filepath" : "green_skp.png", | |
| 70 }, | |
| 57 } | 71 } |
| 58 } | 72 } |
| 59 } | 73 } |
| 60 self._assert_json_contents(output_json_path, expected_summary_dict) | 74 self._assert_json_contents(output_json_path, expected_summary_dict) |
| 61 self._assert_directory_contents( | 75 self._assert_directory_contents( |
| 62 self._temp_dir, ['red.png', 'green.png', 'output.json']) | 76 self._temp_dir, ['red_skp.png', 'green_skp.png', 'output.json']) |
| 63 | 77 |
| 64 def test_untiled(self): | 78 def test_untiled(self): |
| 65 """Run without tiles.""" | 79 """Run without tiles.""" |
| 66 output_json_path = os.path.join(self._temp_dir, 'output.json') | 80 output_json_path = os.path.join(self._temp_dir, 'output.json') |
| 67 self._generate_skps() | 81 self._generate_skps() |
| 68 self._run_render_pictures(['-r', self._input_skp_dir, | 82 self._run_render_pictures(['-r', self._input_skp_dir, |
| 69 '--writePath', self._temp_dir, | 83 '--writePath', self._temp_dir, |
| 70 '--writeJsonSummaryPath', output_json_path]) | 84 '--writeJsonSummaryPath', output_json_path]) |
| 71 expected_summary_dict = { | 85 expected_summary_dict = { |
| 86 "header" : EXPECTED_HEADER_CONTENTS, | |
| 72 "actual-results" : { | 87 "actual-results" : { |
| 73 "no-comparison" : { | 88 "no-comparison" : { |
| 74 # Manually verified: 640x400 red rectangle with black border | 89 # Manually verified: 640x400 red rectangle with black border |
| 75 "red.png" : ["bitmap-64bitMD5", 11092453015575919668], | 90 "red.skp" : { |
| 91 "checksumAlgorithm" : "bitmap-64bitMD5", | |
| 92 "checksumValue" : 11092453015575919668, | |
| 93 "filepath" : "red_skp.png", | |
| 94 }, | |
| 76 # Manually verified: 640x400 green rectangle with black border | 95 # Manually verified: 640x400 green rectangle with black border |
| 77 "green.png" : ["bitmap-64bitMD5", 8891695120562235492], | 96 "green.skp" : { |
| 97 "checksumAlgorithm" : "bitmap-64bitMD5", | |
| 98 "checksumValue" : 8891695120562235492, | |
| 99 "filepath" : "green_skp.png", | |
| 100 }, | |
| 78 } | 101 } |
| 79 } | 102 } |
| 80 } | 103 } |
| 81 self._assert_json_contents(output_json_path, expected_summary_dict) | 104 self._assert_json_contents(output_json_path, expected_summary_dict) |
| 82 self._assert_directory_contents( | 105 self._assert_directory_contents( |
| 83 self._temp_dir, ['red.png', 'green.png', 'output.json']) | 106 self._temp_dir, ['red_skp.png', 'green_skp.png', 'output.json']) |
| 84 | 107 |
| 85 def test_untiled_writeChecksumBasedFilenames(self): | 108 def test_untiled_writeChecksumBasedFilenames(self): |
| 86 """Same as test_untiled, but with --writeChecksumBasedFilenames.""" | 109 """Same as test_untiled, but with --writeChecksumBasedFilenames.""" |
| 87 output_json_path = os.path.join(self._temp_dir, 'output.json') | 110 output_json_path = os.path.join(self._temp_dir, 'output.json') |
| 88 self._generate_skps() | 111 self._generate_skps() |
| 89 self._run_render_pictures(['-r', self._input_skp_dir, | 112 self._run_render_pictures(['-r', self._input_skp_dir, |
| 90 '--writeChecksumBasedFilenames', | 113 '--writeChecksumBasedFilenames', |
| 91 '--writePath', self._temp_dir, | 114 '--writePath', self._temp_dir, |
| 92 '--writeJsonSummaryPath', output_json_path]) | 115 '--writeJsonSummaryPath', output_json_path]) |
| 93 expected_summary_dict = { | 116 expected_summary_dict = { |
| 117 "header" : EXPECTED_HEADER_CONTENTS, | |
| 94 "actual-results" : { | 118 "actual-results" : { |
| 95 "no-comparison" : { | 119 "no-comparison" : { |
| 96 # Manually verified: 640x400 red rectangle with black border | 120 # Manually verified: 640x400 red rectangle with black border |
| 97 "red.png" : ["bitmap-64bitMD5", 11092453015575919668], | 121 "red.skp" : { |
| 122 "checksumAlgorithm" : "bitmap-64bitMD5", | |
| 123 "checksumValue" : 11092453015575919668, | |
| 124 "filepath" : "red_skp/bitmap-64bitMD5_11092453015575919668.p ng", | |
|
epoger
2014/04/07 19:43:13
I changed this so we don't have to keep Yet Anothe
rmistry
2014/04/07 20:07:22
Not sure I understand, Do you mean having a module
epoger
2014/04/07 20:11:52
Sorry that was confusing.
We already have the kJs
rmistry
2014/04/07 20:19:53
Makes sense. LGTM.
| |
| 125 }, | |
| 98 # Manually verified: 640x400 green rectangle with black border | 126 # Manually verified: 640x400 green rectangle with black border |
| 99 "green.png" : ["bitmap-64bitMD5", 8891695120562235492], | 127 "green.skp" : { |
| 128 "checksumAlgorithm" : "bitmap-64bitMD5", | |
| 129 "checksumValue" : 8891695120562235492, | |
| 130 "filepath" : "green_skp/bitmap-64bitMD5_8891695120562235492. png", | |
| 131 }, | |
| 100 } | 132 } |
| 101 } | 133 } |
| 102 } | 134 } |
| 103 self._assert_json_contents(output_json_path, expected_summary_dict) | 135 self._assert_json_contents(output_json_path, expected_summary_dict) |
| 136 self._assert_directory_contents(self._temp_dir, ['red_skp', 'green_skp', 'ou tput.json']) | |
| 104 self._assert_directory_contents( | 137 self._assert_directory_contents( |
| 105 self._temp_dir, ['bitmap-64bitMD5_11092453015575919668.png', | 138 os.path.join(self._temp_dir, 'red_skp'), |
| 106 'bitmap-64bitMD5_8891695120562235492.png', | 139 ['bitmap-64bitMD5_11092453015575919668.png']) |
| 107 'output.json']) | 140 self._assert_directory_contents( |
| 141 os.path.join(self._temp_dir, 'green_skp'), | |
| 142 ['bitmap-64bitMD5_8891695120562235492.png']) | |
| 108 | 143 |
| 109 def test_untiled_validate(self): | 144 def test_untiled_validate(self): |
| 110 """Same as test_untiled, but with --validate. | 145 """Same as test_untiled, but with --validate. |
| 111 | 146 |
| 112 TODO(epoger): This test generates undesired results! The call | 147 TODO(epoger): This test generates undesired results! The call |
| 113 to render_pictures should succeed, and generate the same output as | 148 to render_pictures should succeed, and generate the same output as |
| 114 test_untiled. | 149 test_untiled. |
| 115 See https://code.google.com/p/skia/issues/detail?id=2044 ('render_pictures: | 150 See https://code.google.com/p/skia/issues/detail?id=2044 ('render_pictures: |
| 116 --validate fails') | 151 --validate fails') |
| 117 """ | 152 """ |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 128 | 163 |
| 129 TODO(epoger): This test generates undesired results! | 164 TODO(epoger): This test generates undesired results! |
| 130 See https://code.google.com/p/skia/issues/detail?id=2043 ('render_pictures: | 165 See https://code.google.com/p/skia/issues/detail?id=2043 ('render_pictures: |
| 131 --writeJsonSummaryPath fails unless --writePath is specified') | 166 --writeJsonSummaryPath fails unless --writePath is specified') |
| 132 """ | 167 """ |
| 133 output_json_path = os.path.join(self._temp_dir, 'output.json') | 168 output_json_path = os.path.join(self._temp_dir, 'output.json') |
| 134 self._generate_skps() | 169 self._generate_skps() |
| 135 self._run_render_pictures(['-r', self._input_skp_dir, | 170 self._run_render_pictures(['-r', self._input_skp_dir, |
| 136 '--writeJsonSummaryPath', output_json_path]) | 171 '--writeJsonSummaryPath', output_json_path]) |
| 137 expected_summary_dict = { | 172 expected_summary_dict = { |
| 173 "header" : EXPECTED_HEADER_CONTENTS, | |
| 138 "actual-results" : { | 174 "actual-results" : { |
| 139 "no-comparison" : None, | 175 "no-comparison" : None, |
| 140 } | 176 } |
| 141 } | 177 } |
| 142 self._assert_json_contents(output_json_path, expected_summary_dict) | 178 self._assert_json_contents(output_json_path, expected_summary_dict) |
| 143 | 179 |
| 144 def test_tiled(self): | 180 def test_tiled(self): |
| 145 """Generate individual tiles.""" | 181 """Generate individual tiles.""" |
| 146 output_json_path = os.path.join(self._temp_dir, 'output.json') | 182 output_json_path = os.path.join(self._temp_dir, 'output.json') |
| 147 self._generate_skps() | 183 self._generate_skps() |
| 148 self._run_render_pictures(['-r', self._input_skp_dir, | 184 self._run_render_pictures(['-r', self._input_skp_dir, |
| 149 '--bbh', 'grid', '256', '256', | 185 '--bbh', 'grid', '256', '256', |
| 150 '--mode', 'tile', '256', '256', | 186 '--mode', 'tile', '256', '256', |
| 151 '--writePath', self._temp_dir, | 187 '--writePath', self._temp_dir, |
| 152 '--writeJsonSummaryPath', output_json_path]) | 188 '--writeJsonSummaryPath', output_json_path]) |
| 153 expected_summary_dict = { | 189 expected_summary_dict = { |
| 190 "header" : EXPECTED_HEADER_CONTENTS, | |
| 154 "actual-results" : { | 191 "actual-results" : { |
| 155 "no-comparison" : { | 192 "no-comparison" : { |
| 156 # Manually verified these 6 images, all 256x256 tiles, | 193 # Manually verified these 6 images, all 256x256 tiles, |
| 157 # consistent with a tiled version of the 640x400 red rect | 194 # consistent with a tiled version of the 640x400 red rect |
| 158 # with black borders. | 195 # with black borders. |
| 159 "red0.png" : ["bitmap-64bitMD5", 5815827069051002745], | 196 "red.skp-tile0" : { |
| 160 "red1.png" : ["bitmap-64bitMD5", 9323613075234140270], | 197 "checksumAlgorithm" : "bitmap-64bitMD5", |
| 161 "red2.png" : ["bitmap-64bitMD5", 16670399404877552232], | 198 "checksumValue" : 5815827069051002745, |
| 162 "red3.png" : ["bitmap-64bitMD5", 2507897274083364964], | 199 "filepath" : "red_skp-tile0.png", |
| 163 "red4.png" : ["bitmap-64bitMD5", 7325267995523877959], | 200 }, |
| 164 "red5.png" : ["bitmap-64bitMD5", 2181381724594493116], | 201 "red.skp-tile1" : { |
| 202 "checksumAlgorithm" : "bitmap-64bitMD5", | |
| 203 "checksumValue" : 9323613075234140270, | |
| 204 "filepath" : "red_skp-tile1.png", | |
| 205 }, | |
| 206 "red.skp-tile2" : { | |
| 207 "checksumAlgorithm" : "bitmap-64bitMD5", | |
| 208 "checksumValue" : 16670399404877552232, | |
| 209 "filepath" : "red_skp-tile2.png", | |
| 210 }, | |
| 211 "red.skp-tile3" : { | |
| 212 "checksumAlgorithm" : "bitmap-64bitMD5", | |
| 213 "checksumValue" : 2507897274083364964, | |
| 214 "filepath" : "red_skp-tile3.png", | |
| 215 }, | |
| 216 "red.skp-tile4" : { | |
| 217 "checksumAlgorithm" : "bitmap-64bitMD5", | |
| 218 "checksumValue" : 7325267995523877959, | |
| 219 "filepath" : "red_skp-tile4.png", | |
| 220 }, | |
| 221 "red.skp-tile5" : { | |
| 222 "checksumAlgorithm" : "bitmap-64bitMD5", | |
| 223 "checksumValue" : 2181381724594493116, | |
| 224 "filepath" : "red_skp-tile5.png", | |
| 225 }, | |
| 165 # Manually verified these 6 images, all 256x256 tiles, | 226 # Manually verified these 6 images, all 256x256 tiles, |
| 166 # consistent with a tiled version of the 640x400 green rect | 227 # consistent with a tiled version of the 640x400 green rect |
| 167 # with black borders. | 228 # with black borders. |
| 168 "green0.png" : ["bitmap-64bitMD5", 12587324416545178013], | 229 "green.skp-tile0" : { |
| 169 "green1.png" : ["bitmap-64bitMD5", 7624374914829746293], | 230 "checksumAlgorithm" : "bitmap-64bitMD5", |
| 170 "green2.png" : ["bitmap-64bitMD5", 5686489729535631913], | 231 "checksumValue" : 12587324416545178013, |
| 171 "green3.png" : ["bitmap-64bitMD5", 7980646035555096146], | 232 "filepath" : "green_skp-tile0.png", |
| 172 "green4.png" : ["bitmap-64bitMD5", 17817086664365875131], | 233 }, |
| 173 "green5.png" : ["bitmap-64bitMD5", 10673669813016809363], | 234 "green.skp-tile1" : { |
| 235 "checksumAlgorithm" : "bitmap-64bitMD5", | |
| 236 "checksumValue" : 7624374914829746293, | |
| 237 "filepath" : "green_skp-tile1.png", | |
| 238 }, | |
| 239 "green.skp-tile2" : { | |
| 240 "checksumAlgorithm" : "bitmap-64bitMD5", | |
| 241 "checksumValue" : 5686489729535631913, | |
| 242 "filepath" : "green_skp-tile2.png", | |
| 243 }, | |
| 244 "green.skp-tile3" : { | |
| 245 "checksumAlgorithm" : "bitmap-64bitMD5", | |
| 246 "checksumValue" : 7980646035555096146, | |
| 247 "filepath" : "green_skp-tile3.png", | |
| 248 }, | |
| 249 "green.skp-tile4" : { | |
| 250 "checksumAlgorithm" : "bitmap-64bitMD5", | |
| 251 "checksumValue" : 17817086664365875131, | |
| 252 "filepath" : "green_skp-tile4.png", | |
| 253 }, | |
| 254 "green.skp-tile5" : { | |
| 255 "checksumAlgorithm" : "bitmap-64bitMD5", | |
| 256 "checksumValue" : 10673669813016809363, | |
| 257 "filepath" : "green_skp-tile5.png", | |
| 258 }, | |
| 174 } | 259 } |
| 175 } | 260 } |
| 176 } | 261 } |
| 177 self._assert_json_contents(output_json_path, expected_summary_dict) | 262 self._assert_json_contents(output_json_path, expected_summary_dict) |
| 178 self._assert_directory_contents( | 263 self._assert_directory_contents( |
| 179 self._temp_dir, | 264 self._temp_dir, |
| 180 ['red0.png', 'red1.png', 'red2.png', 'red3.png', 'red4.png', 'red5.png', | 265 ['red_skp-tile0.png', 'red_skp-tile1.png', 'red_skp-tile2.png', |
| 181 'green0.png', 'green1.png', 'green2.png', 'green3.png', 'green4.png', | 266 'red_skp-tile3.png', 'red_skp-tile4.png', 'red_skp-tile5.png', |
| 182 'green5.png', 'output.json']) | 267 'green_skp-tile0.png', 'green_skp-tile1.png', 'green_skp-tile2.png', |
| 268 'green_skp-tile3.png', 'green_skp-tile4.png', 'green_skp-tile5.png', | |
| 269 'output.json']) | |
| 183 | 270 |
| 184 def test_tiled_writeChecksumBasedFilenames(self): | 271 def test_tiled_writeChecksumBasedFilenames(self): |
| 185 """Same as test_tiled, but with --writeChecksumBasedFilenames.""" | 272 """Same as test_tiled, but with --writeChecksumBasedFilenames.""" |
| 186 output_json_path = os.path.join(self._temp_dir, 'output.json') | 273 output_json_path = os.path.join(self._temp_dir, 'output.json') |
| 187 self._generate_skps() | 274 self._generate_skps() |
| 188 self._run_render_pictures(['-r', self._input_skp_dir, | 275 self._run_render_pictures(['-r', self._input_skp_dir, |
| 189 '--bbh', 'grid', '256', '256', | 276 '--bbh', 'grid', '256', '256', |
| 190 '--mode', 'tile', '256', '256', | 277 '--mode', 'tile', '256', '256', |
| 191 '--writeChecksumBasedFilenames', | 278 '--writeChecksumBasedFilenames', |
| 192 '--writePath', self._temp_dir, | 279 '--writePath', self._temp_dir, |
| 193 '--writeJsonSummaryPath', output_json_path]) | 280 '--writeJsonSummaryPath', output_json_path]) |
| 194 expected_summary_dict = { | 281 expected_summary_dict = { |
| 282 "header" : EXPECTED_HEADER_CONTENTS, | |
| 195 "actual-results" : { | 283 "actual-results" : { |
| 196 "no-comparison" : { | 284 "no-comparison" : { |
| 197 # Manually verified these 6 images, all 256x256 tiles, | 285 # Manually verified these 6 images, all 256x256 tiles, |
| 198 # consistent with a tiled version of the 640x400 red rect | 286 # consistent with a tiled version of the 640x400 red rect |
| 199 # with black borders. | 287 # with black borders. |
| 200 "red0.png" : ["bitmap-64bitMD5", 5815827069051002745], | 288 "red.skp-tile0" : { |
| 201 "red1.png" : ["bitmap-64bitMD5", 9323613075234140270], | 289 "checksumAlgorithm" : "bitmap-64bitMD5", |
| 202 "red2.png" : ["bitmap-64bitMD5", 16670399404877552232], | 290 "checksumValue" : 5815827069051002745, |
| 203 "red3.png" : ["bitmap-64bitMD5", 2507897274083364964], | 291 "filepath" : "red_skp-tile0/bitmap-64bitMD5_5815827069051002 745.png", |
| 204 "red4.png" : ["bitmap-64bitMD5", 7325267995523877959], | 292 }, |
| 205 "red5.png" : ["bitmap-64bitMD5", 2181381724594493116], | 293 "red.skp-tile1" : { |
| 294 "checksumAlgorithm" : "bitmap-64bitMD5", | |
| 295 "checksumValue" : 9323613075234140270, | |
| 296 "filepath" : "red_skp-tile1/bitmap-64bitMD5_9323613075234140 270.png", | |
| 297 }, | |
| 298 "red.skp-tile2" : { | |
| 299 "checksumAlgorithm" : "bitmap-64bitMD5", | |
| 300 "checksumValue" : 16670399404877552232, | |
| 301 "filepath" : "red_skp-tile2/bitmap-64bitMD5_1667039940487755 2232.png", | |
| 302 }, | |
| 303 "red.skp-tile3" : { | |
| 304 "checksumAlgorithm" : "bitmap-64bitMD5", | |
| 305 "checksumValue" : 2507897274083364964, | |
| 306 "filepath" : "red_skp-tile3/bitmap-64bitMD5_2507897274083364 964.png", | |
| 307 }, | |
| 308 "red.skp-tile4" : { | |
| 309 "checksumAlgorithm" : "bitmap-64bitMD5", | |
| 310 "checksumValue" : 7325267995523877959, | |
| 311 "filepath" : "red_skp-tile4/bitmap-64bitMD5_7325267995523877 959.png", | |
| 312 }, | |
| 313 "red.skp-tile5" : { | |
| 314 "checksumAlgorithm" : "bitmap-64bitMD5", | |
| 315 "checksumValue" : 2181381724594493116, | |
| 316 "filepath" : "red_skp-tile5/bitmap-64bitMD5_2181381724594493 116.png", | |
| 317 }, | |
| 206 # Manually verified these 6 images, all 256x256 tiles, | 318 # Manually verified these 6 images, all 256x256 tiles, |
| 207 # consistent with a tiled version of the 640x400 green rect | 319 # consistent with a tiled version of the 640x400 green rect |
| 208 # with black borders. | 320 # with black borders. |
| 209 "green0.png" : ["bitmap-64bitMD5", 12587324416545178013], | 321 "green.skp-tile0" : { |
| 210 "green1.png" : ["bitmap-64bitMD5", 7624374914829746293], | 322 "checksumAlgorithm" : "bitmap-64bitMD5", |
| 211 "green2.png" : ["bitmap-64bitMD5", 5686489729535631913], | 323 "checksumValue" : 12587324416545178013, |
| 212 "green3.png" : ["bitmap-64bitMD5", 7980646035555096146], | 324 "filepath" : "green_skp-tile0/bitmap-64bitMD5_12587324416545 178013.png", |
| 213 "green4.png" : ["bitmap-64bitMD5", 17817086664365875131], | 325 }, |
| 214 "green5.png" : ["bitmap-64bitMD5", 10673669813016809363], | 326 "green.skp-tile1" : { |
| 327 "checksumAlgorithm" : "bitmap-64bitMD5", | |
| 328 "checksumValue" : 7624374914829746293, | |
| 329 "filepath" : "green_skp-tile1/bitmap-64bitMD5_76243749148297 46293.png", | |
| 330 }, | |
| 331 "green.skp-tile2" : { | |
| 332 "checksumAlgorithm" : "bitmap-64bitMD5", | |
| 333 "checksumValue" : 5686489729535631913, | |
| 334 "filepath" : "green_skp-tile2/bitmap-64bitMD5_56864897295356 31913.png", | |
| 335 }, | |
| 336 "green.skp-tile3" : { | |
| 337 "checksumAlgorithm" : "bitmap-64bitMD5", | |
| 338 "checksumValue" : 7980646035555096146, | |
| 339 "filepath" : "green_skp-tile3/bitmap-64bitMD5_79806460355550 96146.png", | |
| 340 }, | |
| 341 "green.skp-tile4" : { | |
| 342 "checksumAlgorithm" : "bitmap-64bitMD5", | |
| 343 "checksumValue" : 17817086664365875131, | |
| 344 "filepath" : "green_skp-tile4/bitmap-64bitMD5_17817086664365 875131.png", | |
| 345 }, | |
| 346 "green.skp-tile5" : { | |
| 347 "checksumAlgorithm" : "bitmap-64bitMD5", | |
| 348 "checksumValue" : 10673669813016809363, | |
| 349 "filepath" : "green_skp-tile5/bitmap-64bitMD5_10673669813016 809363.png", | |
| 350 }, | |
| 215 } | 351 } |
| 216 } | 352 } |
| 217 } | 353 } |
| 218 self._assert_json_contents(output_json_path, expected_summary_dict) | 354 self._assert_json_contents(output_json_path, expected_summary_dict) |
| 355 self._assert_directory_contents(self._temp_dir, [ | |
| 356 'red_skp-tile0', 'red_skp-tile1', 'red_skp-tile2', | |
| 357 'red_skp-tile3', 'red_skp-tile4', 'red_skp-tile5', | |
| 358 'green_skp-tile0', 'green_skp-tile1', 'green_skp-tile2', | |
| 359 'green_skp-tile3', 'green_skp-tile4', 'green_skp-tile5', | |
| 360 'output.json']) | |
| 361 # Just check a few of the subdirectories... | |
| 219 self._assert_directory_contents( | 362 self._assert_directory_contents( |
| 220 self._temp_dir, | 363 os.path.join(self._temp_dir, 'red_skp-tile0'), |
| 221 ['bitmap-64bitMD5_5815827069051002745.png', | 364 ['bitmap-64bitMD5_5815827069051002745.png']) |
| 222 'bitmap-64bitMD5_9323613075234140270.png', | 365 self._assert_directory_contents( |
| 223 'bitmap-64bitMD5_16670399404877552232.png', | 366 os.path.join(self._temp_dir, 'red_skp-tile1'), |
| 224 'bitmap-64bitMD5_2507897274083364964.png', | 367 ['bitmap-64bitMD5_9323613075234140270.png']) |
| 225 'bitmap-64bitMD5_7325267995523877959.png', | 368 self._assert_directory_contents( |
| 226 'bitmap-64bitMD5_2181381724594493116.png', | 369 os.path.join(self._temp_dir, 'green_skp-tile0'), |
| 227 'bitmap-64bitMD5_12587324416545178013.png', | 370 ['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 | 371 |
| 235 def _run_render_pictures(self, args): | 372 def _run_render_pictures(self, args): |
| 236 binary = self.find_path_to_program('render_pictures') | 373 binary = self.find_path_to_program('render_pictures') |
| 237 return self.run_command([binary, | 374 return self.run_command([binary, |
| 238 '--clone', '1', | 375 '--clone', '1', |
| 239 '--config', '8888', | 376 '--config', '8888', |
| 240 ] + args) | 377 ] + args) |
| 241 | 378 |
| 242 def _generate_skps(self): | 379 def _generate_skps(self): |
| 243 """Runs the skpmaker binary to generate files in self._input_skp_dir.""" | 380 """Runs the skpmaker binary to generate files in self._input_skp_dir.""" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 298 actual_dict = json.loads(file_contents) | 435 actual_dict = json.loads(file_contents) |
| 299 self.assertEqual(actual_dict, expected_dict) | 436 self.assertEqual(actual_dict, expected_dict) |
| 300 | 437 |
| 301 | 438 |
| 302 def main(): | 439 def main(): |
| 303 base_unittest.main(RenderPicturesTest) | 440 base_unittest.main(RenderPicturesTest) |
| 304 | 441 |
| 305 | 442 |
| 306 if __name__ == '__main__': | 443 if __name__ == '__main__': |
| 307 main() | 444 main() |
| OLD | NEW |