From 44500b9a7109bd2dfa3a473a520e99fbee4903cf Mon Sep 17 00:00:00 2001 From: Robert Coup Date: Mon, 8 Dec 2014 09:10:58 +1300 Subject: [PATCH] Test for 2px png8 encoding bug (hextree & octree) --- .../support/encoding-opts/png8-2px.A.png | Bin 0 -> 351 bytes .../images/support/encoding-opts/png8-2px.png | Bin 0 -> 351 bytes tests/python_tests/png_encoding_test.py | 20 ++++++++++++++++++ 3 files changed, 20 insertions(+) create mode 100644 tests/python_tests/images/support/encoding-opts/png8-2px.A.png create mode 100644 tests/python_tests/images/support/encoding-opts/png8-2px.png diff --git a/tests/python_tests/images/support/encoding-opts/png8-2px.A.png b/tests/python_tests/images/support/encoding-opts/png8-2px.A.png new file mode 100644 index 0000000000000000000000000000000000000000..f047b08044a83fc8874e1b43995c4a2774cdd9cb GIT binary patch literal 351 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K5893O0R7}x|G$2RK)5S5QV$R#khKvjb97h~j z%2xB6ec5g_@1dXLv=ET`K@BR6zb}<;Xn2=gM?+^e^x7HLvZVM_M?`{b@pScbS?83{ F1OUyY9FhP4 literal 0 HcmV?d00001 diff --git a/tests/python_tests/images/support/encoding-opts/png8-2px.png b/tests/python_tests/images/support/encoding-opts/png8-2px.png new file mode 100644 index 0000000000000000000000000000000000000000..f047b08044a83fc8874e1b43995c4a2774cdd9cb GIT binary patch literal 351 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K5893O0R7}x|G$2RK)5S5QV$R#khKvjb97h~j z%2xB6ec5g_@1dXLv=ET`K@BR6zb}<;Xn2=gM?+^e^x7HLvZVM_M?`{b@pScbS?83{ F1OUyY9FhP4 literal 0 HcmV?d00001 diff --git a/tests/python_tests/png_encoding_test.py b/tests/python_tests/png_encoding_test.py index 82adf1e3f..de94f35eb 100644 --- a/tests/python_tests/png_encoding_test.py +++ b/tests/python_tests/png_encoding_test.py @@ -159,6 +159,26 @@ if mapnik.has_png(): eq_(len(im.tostring('png8:t=0')) == len(im_in.tostring('png8')), True) eq_(len(im.tostring('png8:t=0:m=o')) == len(im_in.tostring('png8:m=o')), True) + def test_2px_regression_hextree(): + im = mapnik.Image.open('./images/support/encoding-opts/png8-2px.A.png') + expected = './images/support/encoding-opts/png8-2px.png' + + t0 = tmp_dir + 'png-encoding-2px.result-hextree.png' + im.save(t0, 'png8:m=h') + eq_(mapnik.Image.open(t0).tostring(), + mapnik.Image.open(expected).tostring(), + '%s (actual) not == to %s (expected)' % (t0, expected)) + + def test_2px_regression_octree(): + im = mapnik.Image.open('./images/support/encoding-opts/png8-2px.A.png') + expected = './images/support/encoding-opts/png8-2px.png' + t0 = tmp_dir + 'png-encoding-2px.result-octree.png' + im.save(t0, 'png8:m=o') + eq_(mapnik.Image.open(t0).tostring(), + mapnik.Image.open(expected).tostring(), + '%s (actual) not == to %s (expected)' % (t0, expected)) + + if __name__ == "__main__": setup() exit(run_all(eval(x) for x in dir() if x.startswith("test_")))