From 3e69c337d289840694e1607daa32551c80baedeb Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Fri, 22 Nov 2013 16:41:46 -0800 Subject: [PATCH] tests: prefer testing png encoded bytes --- tests/python_tests/compositing_test.py | 8 ++++---- tests/python_tests/image_filters_test.py | 2 +- tests/python_tests/layer_buffer_size_test.py | 2 +- tests/python_tests/markers_complex_rendering_test.py | 4 ++-- tests/python_tests/png_encoding_test.py | 8 ++++---- tests/python_tests/python_plugin_test.py | 4 ++-- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/python_tests/compositing_test.py b/tests/python_tests/compositing_test.py index 8d91e9569..c52e78671 100644 --- a/tests/python_tests/compositing_test.py +++ b/tests/python_tests/compositing_test.py @@ -98,7 +98,7 @@ def test_compare_images(): a.save(expected) expected_im = mapnik.Image.open(expected) # compare them - if a.tostring() == expected_im.tostring(): + if a.tostring('png32') == expected_im.tostring('png32'): successes.append(name) else: fails.append('failed comparing actual (%s) and expected(%s)' % (actual,'tests/python_tests/'+ expected)) @@ -110,7 +110,7 @@ def test_compare_images(): # TODO - write test to ensure the image is 99% the same. #expected_b = mapnik.Image.open('./images/support/b.png') #b.save('/tmp/mapnik-comp-op-test-original-mask.png') - #eq_(b.tostring(),expected_b.tostring(), '/tmp/mapnik-comp-op-test-original-mask.png is no longer equivalent to original mask: ./images/support/b.png') + #eq_(b.tostring('png32'),expected_b.tostring('png32'), '/tmp/mapnik-comp-op-test-original-mask.png is no longer equivalent to original mask: ./images/support/b.png') def test_pre_multiply_status(): b = mapnik.Image.open('./images/support/b.png') @@ -172,7 +172,7 @@ if 'shape' in mapnik.DatasourceCache.plugin_names(): im.save(expected) expected_im = mapnik.Image.open(expected) # compare them - if im.tostring() == expected_im.tostring(): + if im.tostring('png32') == expected_im.tostring('png32'): successes.append(name) else: fails.append('failed comparing actual (%s) and expected(%s)' % (actual,'tests/python_tests/'+ expected)) @@ -190,7 +190,7 @@ if 'shape' in mapnik.DatasourceCache.plugin_names(): expected = 'images/support/mapnik-style-level-opacity.png' im.save(actual) expected_im = mapnik.Image.open(expected) - eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected (%s)' % (actual,'tests/python_tests/'+ expected)) + eq_(im.tostring('png32'),expected_im.tostring('png32'), 'failed comparing actual (%s) and expected (%s)' % (actual,'tests/python_tests/'+ expected)) def test_rounding_and_color_expectations(): m = mapnik.Map(1,1) diff --git a/tests/python_tests/image_filters_test.py b/tests/python_tests/image_filters_test.py index 219629423..710d85731 100644 --- a/tests/python_tests/image_filters_test.py +++ b/tests/python_tests/image_filters_test.py @@ -55,7 +55,7 @@ if 'shape' in mapnik.DatasourceCache.plugin_names(): im.save(expected) expected_im = mapnik.Image.open(expected) # compare them - if im.tostring() == expected_im.tostring(): + if im.tostring('png32') == expected_im.tostring('png32'): successes.append(name) else: fails.append('failed comparing actual (%s) and expected(%s)' % (actual,'tests/python_tests/'+ expected)) diff --git a/tests/python_tests/layer_buffer_size_test.py b/tests/python_tests/layer_buffer_size_test.py index 164f6ba32..904c4fb72 100644 --- a/tests/python_tests/layer_buffer_size_test.py +++ b/tests/python_tests/layer_buffer_size_test.py @@ -27,7 +27,7 @@ if 'sqlite' in mapnik.DatasourceCache.plugin_names(): expected = 'images/support/mapnik-layer-buffer-size.png' im.save(actual) expected_im = mapnik.Image.open(expected) - eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected (%s)' % (actual,'tests/python_tests/'+ expected)) + eq_(im.tostring('png32'),expected_im.tostring('png32'), 'failed comparing actual (%s) and expected (%s)' % (actual,'tests/python_tests/'+ expected)) if __name__ == "__main__": diff --git a/tests/python_tests/markers_complex_rendering_test.py b/tests/python_tests/markers_complex_rendering_test.py index c8e6c827d..756b65073 100644 --- a/tests/python_tests/markers_complex_rendering_test.py +++ b/tests/python_tests/markers_complex_rendering_test.py @@ -20,7 +20,7 @@ if 'csv' in mapnik.DatasourceCache.plugin_names(): expected = 'images/support/mapnik-marker-ellipse-render1.png' im.save(actual) expected_im = mapnik.Image.open(expected) - eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected (%s)' % (actual,'tests/python_tests/'+ expected)) + eq_(im.tostring('png32'),expected_im.tostring('png32'), 'failed comparing actual (%s) and expected (%s)' % (actual,'tests/python_tests/'+ expected)) def test_marker_ellipse_render2(): # currently crashes https://github.com/mapnik/mapnik/issues/1365 @@ -33,7 +33,7 @@ if 'csv' in mapnik.DatasourceCache.plugin_names(): expected = 'images/support/mapnik-marker-ellipse-render2.png' im.save(actual) expected_im = mapnik.Image.open(expected) - eq_(im.tostring(),expected_im.tostring(), 'failed comparing actual (%s) and expected (%s)' % (actual,'tests/python_tests/'+ expected)) + eq_(im.tostring('png32'),expected_im.tostring('png32'), 'failed comparing actual (%s) and expected (%s)' % (actual,'tests/python_tests/'+ expected)) if __name__ == "__main__": setup() diff --git a/tests/python_tests/png_encoding_test.py b/tests/python_tests/png_encoding_test.py index 902e10341..50fb5fc0c 100644 --- a/tests/python_tests/png_encoding_test.py +++ b/tests/python_tests/png_encoding_test.py @@ -53,8 +53,8 @@ if mapnik.has_png(): im.save(expected,opt) else: im.save(actual,opt) - eq_(mapnik.Image.open(actual).tostring(), - mapnik.Image.open(expected).tostring(), + eq_(mapnik.Image.open(actual).tostring('png32'), + mapnik.Image.open(expected).tostring('png32'), '%s (actual) not == to %s (expected)' % (actual,expected)) for opt in opts: @@ -65,8 +65,8 @@ if mapnik.has_png(): im.save(expected,opt) else: im.save(actual,opt) - eq_(mapnik.Image.open(actual).tostring(), - mapnik.Image.open(expected).tostring(), + eq_(mapnik.Image.open(actual).tostring('png32'), + mapnik.Image.open(expected).tostring('png32'), '%s (actual) not == to %s (expected)' % (actual,expected)) def test_transparency_levels(): diff --git a/tests/python_tests/python_plugin_test.py b/tests/python_tests/python_plugin_test.py index 52703f527..076a3f2e9 100644 --- a/tests/python_tests/python_plugin_test.py +++ b/tests/python_tests/python_plugin_test.py @@ -139,7 +139,7 @@ if 'python' in mapnik.DatasourceCache.plugin_names(): expected = 'images/support/mapnik-python-point-render1.png' im.save(actual) expected_im = mapnik.Image.open(expected) - eq_(im.tostring(),expected_im.tostring(), + eq_(im.tostring('png32'),expected_im.tostring('png32'), 'failed comparing actual (%s) and expected (%s)' % (actual,'tests/python_tests/'+ expected)) def test_python_circle_rendering(): @@ -152,7 +152,7 @@ if 'python' in mapnik.DatasourceCache.plugin_names(): expected = 'images/support/mapnik-python-circle-render1.png' im.save(actual) expected_im = mapnik.Image.open(expected) - eq_(im.tostring(),expected_im.tostring(), + eq_(im.tostring('png32'),expected_im.tostring('png32'), 'failed comparing actual (%s) and expected (%s)' % (actual,'tests/python_tests/'+ expected)) if __name__ == "__main__":