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

Unified 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: unittests now pass 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/skimage_main.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/tests/render_pictures_test.py
diff --git a/tools/tests/render_pictures_test.py b/tools/tests/render_pictures_test.py
index 162531a6adc698acc1f056912a3f5d9269bbce2c..9a002189ca0cd10574c4f2a680820543a92fc57d 100755
--- a/tools/tests/render_pictures_test.py
+++ b/tools/tests/render_pictures_test.py
@@ -21,6 +21,11 @@ import base_unittest
# Maximum length of text diffs to show when tests fail
MAX_DIFF_LENGTH = 30000
+EXPECTED_HEADER_CONTENTS = {
+ "type" : "ChecksummedImages",
+ "revision" : 1,
+}
+
class RenderPicturesTest(base_unittest.TestCase):
@@ -38,9 +43,9 @@ class RenderPicturesTest(base_unittest.TestCase):
output_json_path = os.path.join(self._temp_dir, 'output.json')
self._generate_skps()
# TODO(epoger): I noticed that when this is run without --writePath being
- # specified, this test writes red.png and green.png to the current working
+ # specified, this test writes red_skp.png and green_skp.png to the current
# directory. We should fix that... if --writePath is not specified, this
- # probably shouldn't write out red.png and green.png at all!
+ # probably shouldn't write out red_skp.png and green_skp.png at all!
self._run_render_pictures(['-r', self._input_skp_dir,
'--bbh', 'grid', '256', '256',
'--mode', 'tile', '256', '256',
@@ -48,18 +53,27 @@ class RenderPicturesTest(base_unittest.TestCase):
'--writePath', self._temp_dir,
'--writeWholeImage'])
expected_summary_dict = {
+ "header" : EXPECTED_HEADER_CONTENTS,
"actual-results" : {
"no-comparison" : {
# Manually verified: 640x400 red rectangle with black border
- "red.png" : [ "bitmap-64bitMD5", 11092453015575919668 ],
+ "red.skp" : {
+ "checksumAlgorithm" : "bitmap-64bitMD5",
+ "checksumValue" : 11092453015575919668,
+ "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.
+ },
# Manually verified: 640x400 green rectangle with black border
- "green.png" : [ "bitmap-64bitMD5", 8891695120562235492 ],
+ "green.skp" : {
+ "checksumAlgorithm" : "bitmap-64bitMD5",
+ "checksumValue" : 8891695120562235492,
+ "filepath" : "green_skp.png",
+ },
}
}
}
self._assert_json_contents(output_json_path, expected_summary_dict)
self._assert_directory_contents(
- self._temp_dir, ['red.png', 'green.png', 'output.json'])
+ self._temp_dir, ['red_skp.png', 'green_skp.png', 'output.json'])
def test_untiled(self):
"""Run without tiles."""
@@ -69,18 +83,27 @@ class RenderPicturesTest(base_unittest.TestCase):
'--writePath', self._temp_dir,
'--writeJsonSummaryPath', output_json_path])
expected_summary_dict = {
+ "header" : EXPECTED_HEADER_CONTENTS,
"actual-results" : {
"no-comparison" : {
# Manually verified: 640x400 red rectangle with black border
- "red.png" : ["bitmap-64bitMD5", 11092453015575919668],
+ "red.skp" : {
+ "checksumAlgorithm" : "bitmap-64bitMD5",
+ "checksumValue" : 11092453015575919668,
+ "filepath" : "red_skp.png",
+ },
# Manually verified: 640x400 green rectangle with black border
- "green.png" : ["bitmap-64bitMD5", 8891695120562235492],
+ "green.skp" : {
+ "checksumAlgorithm" : "bitmap-64bitMD5",
+ "checksumValue" : 8891695120562235492,
+ "filepath" : "green_skp.png",
+ },
}
}
}
self._assert_json_contents(output_json_path, expected_summary_dict)
self._assert_directory_contents(
- self._temp_dir, ['red.png', 'green.png', 'output.json'])
+ self._temp_dir, ['red_skp.png', 'green_skp.png', 'output.json'])
def test_untiled_writeChecksumBasedFilenames(self):
"""Same as test_untiled, but with --writeChecksumBasedFilenames."""
@@ -91,20 +114,32 @@ class RenderPicturesTest(base_unittest.TestCase):
'--writePath', self._temp_dir,
'--writeJsonSummaryPath', output_json_path])
expected_summary_dict = {
+ "header" : EXPECTED_HEADER_CONTENTS,
"actual-results" : {
"no-comparison" : {
# Manually verified: 640x400 red rectangle with black border
- "red.png" : ["bitmap-64bitMD5", 11092453015575919668],
+ "red.skp" : {
+ "checksumAlgorithm" : "bitmap-64bitMD5",
+ "checksumValue" : 11092453015575919668,
+ "filepath" : "red_skp/bitmap-64bitMD5_11092453015575919668.png",
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.
+ },
# Manually verified: 640x400 green rectangle with black border
- "green.png" : ["bitmap-64bitMD5", 8891695120562235492],
+ "green.skp" : {
+ "checksumAlgorithm" : "bitmap-64bitMD5",
+ "checksumValue" : 8891695120562235492,
+ "filepath" : "green_skp/bitmap-64bitMD5_8891695120562235492.png",
+ },
}
}
}
self._assert_json_contents(output_json_path, expected_summary_dict)
+ self._assert_directory_contents(self._temp_dir, ['red_skp', 'green_skp', 'output.json'])
+ self._assert_directory_contents(
+ os.path.join(self._temp_dir, 'red_skp'),
+ ['bitmap-64bitMD5_11092453015575919668.png'])
self._assert_directory_contents(
- self._temp_dir, ['bitmap-64bitMD5_11092453015575919668.png',
- 'bitmap-64bitMD5_8891695120562235492.png',
- 'output.json'])
+ os.path.join(self._temp_dir, 'green_skp'),
+ ['bitmap-64bitMD5_8891695120562235492.png'])
def test_untiled_validate(self):
"""Same as test_untiled, but with --validate.
@@ -135,6 +170,7 @@ class RenderPicturesTest(base_unittest.TestCase):
self._run_render_pictures(['-r', self._input_skp_dir,
'--writeJsonSummaryPath', output_json_path])
expected_summary_dict = {
+ "header" : EXPECTED_HEADER_CONTENTS,
"actual-results" : {
"no-comparison" : None,
}
@@ -151,35 +187,86 @@ class RenderPicturesTest(base_unittest.TestCase):
'--writePath', self._temp_dir,
'--writeJsonSummaryPath', output_json_path])
expected_summary_dict = {
+ "header" : EXPECTED_HEADER_CONTENTS,
"actual-results" : {
"no-comparison" : {
# Manually verified these 6 images, all 256x256 tiles,
# consistent with a tiled version of the 640x400 red rect
# with black borders.
- "red0.png" : ["bitmap-64bitMD5", 5815827069051002745],
- "red1.png" : ["bitmap-64bitMD5", 9323613075234140270],
- "red2.png" : ["bitmap-64bitMD5", 16670399404877552232],
- "red3.png" : ["bitmap-64bitMD5", 2507897274083364964],
- "red4.png" : ["bitmap-64bitMD5", 7325267995523877959],
- "red5.png" : ["bitmap-64bitMD5", 2181381724594493116],
+ "red.skp-tile0" : {
+ "checksumAlgorithm" : "bitmap-64bitMD5",
+ "checksumValue" : 5815827069051002745,
+ "filepath" : "red_skp-tile0.png",
+ },
+ "red.skp-tile1" : {
+ "checksumAlgorithm" : "bitmap-64bitMD5",
+ "checksumValue" : 9323613075234140270,
+ "filepath" : "red_skp-tile1.png",
+ },
+ "red.skp-tile2" : {
+ "checksumAlgorithm" : "bitmap-64bitMD5",
+ "checksumValue" : 16670399404877552232,
+ "filepath" : "red_skp-tile2.png",
+ },
+ "red.skp-tile3" : {
+ "checksumAlgorithm" : "bitmap-64bitMD5",
+ "checksumValue" : 2507897274083364964,
+ "filepath" : "red_skp-tile3.png",
+ },
+ "red.skp-tile4" : {
+ "checksumAlgorithm" : "bitmap-64bitMD5",
+ "checksumValue" : 7325267995523877959,
+ "filepath" : "red_skp-tile4.png",
+ },
+ "red.skp-tile5" : {
+ "checksumAlgorithm" : "bitmap-64bitMD5",
+ "checksumValue" : 2181381724594493116,
+ "filepath" : "red_skp-tile5.png",
+ },
# Manually verified these 6 images, all 256x256 tiles,
# consistent with a tiled version of the 640x400 green rect
# with black borders.
- "green0.png" : ["bitmap-64bitMD5", 12587324416545178013],
- "green1.png" : ["bitmap-64bitMD5", 7624374914829746293],
- "green2.png" : ["bitmap-64bitMD5", 5686489729535631913],
- "green3.png" : ["bitmap-64bitMD5", 7980646035555096146],
- "green4.png" : ["bitmap-64bitMD5", 17817086664365875131],
- "green5.png" : ["bitmap-64bitMD5", 10673669813016809363],
+ "green.skp-tile0" : {
+ "checksumAlgorithm" : "bitmap-64bitMD5",
+ "checksumValue" : 12587324416545178013,
+ "filepath" : "green_skp-tile0.png",
+ },
+ "green.skp-tile1" : {
+ "checksumAlgorithm" : "bitmap-64bitMD5",
+ "checksumValue" : 7624374914829746293,
+ "filepath" : "green_skp-tile1.png",
+ },
+ "green.skp-tile2" : {
+ "checksumAlgorithm" : "bitmap-64bitMD5",
+ "checksumValue" : 5686489729535631913,
+ "filepath" : "green_skp-tile2.png",
+ },
+ "green.skp-tile3" : {
+ "checksumAlgorithm" : "bitmap-64bitMD5",
+ "checksumValue" : 7980646035555096146,
+ "filepath" : "green_skp-tile3.png",
+ },
+ "green.skp-tile4" : {
+ "checksumAlgorithm" : "bitmap-64bitMD5",
+ "checksumValue" : 17817086664365875131,
+ "filepath" : "green_skp-tile4.png",
+ },
+ "green.skp-tile5" : {
+ "checksumAlgorithm" : "bitmap-64bitMD5",
+ "checksumValue" : 10673669813016809363,
+ "filepath" : "green_skp-tile5.png",
+ },
}
}
}
self._assert_json_contents(output_json_path, expected_summary_dict)
self._assert_directory_contents(
self._temp_dir,
- ['red0.png', 'red1.png', 'red2.png', 'red3.png', 'red4.png', 'red5.png',
- 'green0.png', 'green1.png', 'green2.png', 'green3.png', 'green4.png',
- 'green5.png', 'output.json'])
+ ['red_skp-tile0.png', 'red_skp-tile1.png', 'red_skp-tile2.png',
+ 'red_skp-tile3.png', 'red_skp-tile4.png', 'red_skp-tile5.png',
+ 'green_skp-tile0.png', 'green_skp-tile1.png', 'green_skp-tile2.png',
+ 'green_skp-tile3.png', 'green_skp-tile4.png', 'green_skp-tile5.png',
+ 'output.json'])
def test_tiled_writeChecksumBasedFilenames(self):
"""Same as test_tiled, but with --writeChecksumBasedFilenames."""
@@ -192,45 +279,95 @@ class RenderPicturesTest(base_unittest.TestCase):
'--writePath', self._temp_dir,
'--writeJsonSummaryPath', output_json_path])
expected_summary_dict = {
+ "header" : EXPECTED_HEADER_CONTENTS,
"actual-results" : {
"no-comparison" : {
# Manually verified these 6 images, all 256x256 tiles,
# consistent with a tiled version of the 640x400 red rect
# with black borders.
- "red0.png" : ["bitmap-64bitMD5", 5815827069051002745],
- "red1.png" : ["bitmap-64bitMD5", 9323613075234140270],
- "red2.png" : ["bitmap-64bitMD5", 16670399404877552232],
- "red3.png" : ["bitmap-64bitMD5", 2507897274083364964],
- "red4.png" : ["bitmap-64bitMD5", 7325267995523877959],
- "red5.png" : ["bitmap-64bitMD5", 2181381724594493116],
+ "red.skp-tile0" : {
+ "checksumAlgorithm" : "bitmap-64bitMD5",
+ "checksumValue" : 5815827069051002745,
+ "filepath" : "red_skp-tile0/bitmap-64bitMD5_5815827069051002745.png",
+ },
+ "red.skp-tile1" : {
+ "checksumAlgorithm" : "bitmap-64bitMD5",
+ "checksumValue" : 9323613075234140270,
+ "filepath" : "red_skp-tile1/bitmap-64bitMD5_9323613075234140270.png",
+ },
+ "red.skp-tile2" : {
+ "checksumAlgorithm" : "bitmap-64bitMD5",
+ "checksumValue" : 16670399404877552232,
+ "filepath" : "red_skp-tile2/bitmap-64bitMD5_16670399404877552232.png",
+ },
+ "red.skp-tile3" : {
+ "checksumAlgorithm" : "bitmap-64bitMD5",
+ "checksumValue" : 2507897274083364964,
+ "filepath" : "red_skp-tile3/bitmap-64bitMD5_2507897274083364964.png",
+ },
+ "red.skp-tile4" : {
+ "checksumAlgorithm" : "bitmap-64bitMD5",
+ "checksumValue" : 7325267995523877959,
+ "filepath" : "red_skp-tile4/bitmap-64bitMD5_7325267995523877959.png",
+ },
+ "red.skp-tile5" : {
+ "checksumAlgorithm" : "bitmap-64bitMD5",
+ "checksumValue" : 2181381724594493116,
+ "filepath" : "red_skp-tile5/bitmap-64bitMD5_2181381724594493116.png",
+ },
# Manually verified these 6 images, all 256x256 tiles,
# consistent with a tiled version of the 640x400 green rect
# with black borders.
- "green0.png" : ["bitmap-64bitMD5", 12587324416545178013],
- "green1.png" : ["bitmap-64bitMD5", 7624374914829746293],
- "green2.png" : ["bitmap-64bitMD5", 5686489729535631913],
- "green3.png" : ["bitmap-64bitMD5", 7980646035555096146],
- "green4.png" : ["bitmap-64bitMD5", 17817086664365875131],
- "green5.png" : ["bitmap-64bitMD5", 10673669813016809363],
+ "green.skp-tile0" : {
+ "checksumAlgorithm" : "bitmap-64bitMD5",
+ "checksumValue" : 12587324416545178013,
+ "filepath" : "green_skp-tile0/bitmap-64bitMD5_12587324416545178013.png",
+ },
+ "green.skp-tile1" : {
+ "checksumAlgorithm" : "bitmap-64bitMD5",
+ "checksumValue" : 7624374914829746293,
+ "filepath" : "green_skp-tile1/bitmap-64bitMD5_7624374914829746293.png",
+ },
+ "green.skp-tile2" : {
+ "checksumAlgorithm" : "bitmap-64bitMD5",
+ "checksumValue" : 5686489729535631913,
+ "filepath" : "green_skp-tile2/bitmap-64bitMD5_5686489729535631913.png",
+ },
+ "green.skp-tile3" : {
+ "checksumAlgorithm" : "bitmap-64bitMD5",
+ "checksumValue" : 7980646035555096146,
+ "filepath" : "green_skp-tile3/bitmap-64bitMD5_7980646035555096146.png",
+ },
+ "green.skp-tile4" : {
+ "checksumAlgorithm" : "bitmap-64bitMD5",
+ "checksumValue" : 17817086664365875131,
+ "filepath" : "green_skp-tile4/bitmap-64bitMD5_17817086664365875131.png",
+ },
+ "green.skp-tile5" : {
+ "checksumAlgorithm" : "bitmap-64bitMD5",
+ "checksumValue" : 10673669813016809363,
+ "filepath" : "green_skp-tile5/bitmap-64bitMD5_10673669813016809363.png",
+ },
}
}
}
self._assert_json_contents(output_json_path, expected_summary_dict)
+ self._assert_directory_contents(self._temp_dir, [
+ 'red_skp-tile0', 'red_skp-tile1', 'red_skp-tile2',
+ 'red_skp-tile3', 'red_skp-tile4', 'red_skp-tile5',
+ 'green_skp-tile0', 'green_skp-tile1', 'green_skp-tile2',
+ 'green_skp-tile3', 'green_skp-tile4', 'green_skp-tile5',
+ 'output.json'])
+ # Just check a few of the subdirectories...
self._assert_directory_contents(
- self._temp_dir,
- ['bitmap-64bitMD5_5815827069051002745.png',
- 'bitmap-64bitMD5_9323613075234140270.png',
- 'bitmap-64bitMD5_16670399404877552232.png',
- 'bitmap-64bitMD5_2507897274083364964.png',
- 'bitmap-64bitMD5_7325267995523877959.png',
- 'bitmap-64bitMD5_2181381724594493116.png',
- 'bitmap-64bitMD5_12587324416545178013.png',
- 'bitmap-64bitMD5_7624374914829746293.png',
- 'bitmap-64bitMD5_5686489729535631913.png',
- 'bitmap-64bitMD5_7980646035555096146.png',
- 'bitmap-64bitMD5_17817086664365875131.png',
- 'bitmap-64bitMD5_10673669813016809363.png',
- 'output.json'])
+ os.path.join(self._temp_dir, 'red_skp-tile0'),
+ ['bitmap-64bitMD5_5815827069051002745.png'])
+ self._assert_directory_contents(
+ os.path.join(self._temp_dir, 'red_skp-tile1'),
+ ['bitmap-64bitMD5_9323613075234140270.png'])
+ self._assert_directory_contents(
+ os.path.join(self._temp_dir, 'green_skp-tile0'),
+ ['bitmap-64bitMD5_12587324416545178013.png'])
def _run_render_pictures(self, args):
binary = self.find_path_to_program('render_pictures')
« no previous file with comments | « tools/skimage_main.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698