From 02135991edac1f26fcc249a737866dc1c311ddd9 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 3 Dec 2014 13:53:04 -0500 Subject: [PATCH] convert raster_symbolizer_test to use full image comparisons --- .../images/support/dataraster_coloring.png | Bin 0 -> 2879 bytes .../images/support/raster_warping.png | Bin 0 -> 1515 bytes ...aster_warping_does_not_overclip_source.png | Bin 0 -> 1099 bytes tests/python_tests/raster_symbolizer_test.py | 30 ++++++++++++++---- 4 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 tests/python_tests/images/support/dataraster_coloring.png create mode 100644 tests/python_tests/images/support/raster_warping.png create mode 100644 tests/python_tests/images/support/raster_warping_does_not_overclip_source.png diff --git a/tests/python_tests/images/support/dataraster_coloring.png b/tests/python_tests/images/support/dataraster_coloring.png new file mode 100644 index 0000000000000000000000000000000000000000..da3cac4b1701c32ca263d289f5bb5d281dbc362b GIT binary patch literal 2879 zcmaJ@`#;nBAAf&7HfD2~nrk_mj@4))I#FS3rG#n-p9`f2@FT^4oU-XQb`}0qxDsh*?P7)NkTqEQiN)9q+5zdaiG;%v z9n=Dk6XfWHs?(~gUqtSJ>XtU_|JpyW*`R9$BcKLB4P1U#Lc^yz+0yFh63{!R>)G`| zWn~uV6|2cZAi9RYS&J*SLsLEAQ~nFUFU-Fvd^NU_CaG#Q%{LpzilUa67v)MWP>54d+>GxMa46^0 z&?c-nNe(##6EW;SO7<@BO$Z|aTQ~FUT14<*)^a`_gcSM_PHMesP!~TYNTZ7tMD`;>+Bjx|{&N<96%i zzF){+z5+u=*Ee%!1hX^U{99IWC;*fptYsyj|qY4h1jk##jFs={YD9_u@Ji zzT%!{+T+rM7Lij;>MAsrG7BXWCh4Vis)6!hMFTD-NfjcKEEbG?ZGSeEBGkJ^P2Jjz zrmJl32p!*?3NmuT2JO3((%=X#9VQ2SoIEXM?t$+50O&^5b7OND9qD=+1cvcsjZNJ4OEy!2P7=^V z;g+vE2P|)`P;!=}pbcc(h!GbK7}S6}*T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_8H~q4U3KC&3#+P&+|-0w ziHcU3X|njh@T!R)y87+KjJdu79+=$TeInjRKp|PMwuOO zgNNAB;ll&DsDs(`y!Y0J%0VvE;&VP?2L<>!9d=E5a7kAiK)6nhyNe_nuUb;?6$`!T-39fwo!BS*G$`ErUf9yGG7*;ftLksh>!h2|A*VGPdTTw U^dg;+$yW(ackiQBM^0V(8y%(pMF0Q* literal 0 HcmV?d00001 diff --git a/tests/python_tests/images/support/raster_warping_does_not_overclip_source.png b/tests/python_tests/images/support/raster_warping_does_not_overclip_source.png new file mode 100644 index 0000000000000000000000000000000000000000..0d6ccc5ab1b67a4147c536a985aca3594c601b62 GIT binary patch literal 1099 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K5893O0R7}x|GzJD1Ax{^_kcv5PuX%Spb`WrI zy#N1_T$SMkgB!_z*Q}}%T+n*ZW2LLz)yJGEw(sN^cJwni%os(3AOvpAX0WM?Jmxem57{tQPN z3>XC%53xA#0IgwE@L|xgOJquT$qD7y135pT92SsLrb8?b-cE|Hxu(V--^y@Jg+U3J zPB|D7nG}E_(!d~KR={wt$L5HP!G1>O4+l>;pJo0mrNJQWCYL5Q&@cB{o;ix=5h5~h9K+I-h=y6~GIthf{oMvQj zQ(_QM1EX(Gf#K8R0+WO&fhueRNjV`&y;%klftd8>7()lso!kWs4EKR1nI$l^Fz!oT zz+jQi6KXoL10?|Lkq*UC<9=G z%ohSj4lsToC|ZNzKv*{m!wqL7>mkm{nFw^m8%3B0fR=w_w{-Y>c7k$VEU=JZ@O1Ta JS?83{1OQK9MaKXD literal 0 HcmV?d00001 diff --git a/tests/python_tests/raster_symbolizer_test.py b/tests/python_tests/raster_symbolizer_test.py index 2c7ba1d19..b81e7c145 100644 --- a/tests/python_tests/raster_symbolizer_test.py +++ b/tests/python_tests/raster_symbolizer_test.py @@ -52,9 +52,14 @@ def test_dataraster_coloring(): im = mapnik.Image(_map.width,_map.height) mapnik.render(_map, im) - imdata = im.tostring() - # we have some values in the [20,30) interval so check that they're colored - assert contains_word('\xff\xff\x00\xff', imdata) + expected_file = './images/support/dataraster_coloring.png' + actual_file = '/tmp/' + os.path.basename(expected_file) + im.save(actual_file,'png32') + if not os.path.exists(expected_file) or os.environ.get('UPDATE'): + im.save(expected_file,'png32') + actual = mapnik.Image.open(actual_file) + expected = mapnik.Image.open(expected_file) + eq_(actual.tostring('png32'),expected.tostring('png32'), 'failed comparing actual (%s) and expected (%s)' % (actual_file,expected_file)) def test_dataraster_query_point(): srs = '+init=epsg:32630' @@ -165,8 +170,14 @@ def test_raster_warping(): im = mapnik.Image(_map.width,_map.height) mapnik.render(_map, im) - imdata = im.tostring() - assert contains_word('\xff\xff\x00\xff', imdata) + expected_file = './images/support/raster_warping.png' + actual_file = '/tmp/' + os.path.basename(expected_file) + im.save(actual_file,'png32') + if not os.path.exists(expected_file) or os.environ.get('UPDATE'): + im.save(expected_file,'png32') + actual = mapnik.Image.open(actual_file) + expected = mapnik.Image.open(expected_file) + eq_(actual.tostring('png32'),expected.tostring('png32'), 'failed comparing actual (%s) and expected (%s)' % (actual_file,expected_file)) def test_raster_warping_does_not_overclip_source(): lyrSrs = "+init=epsg:32630" @@ -192,7 +203,14 @@ def test_raster_warping_does_not_overclip_source(): im = mapnik.Image(_map.width,_map.height) mapnik.render(_map, im) - assert im.view(0,200,1,1).tostring()=='\xff\xff\x00\xff' + expected_file = './images/support/raster_warping_does_not_overclip_source.png' + actual_file = '/tmp/' + os.path.basename(expected_file) + im.save(actual_file,'png32') + if not os.path.exists(expected_file) or os.environ.get('UPDATE'): + im.save(expected_file,'png32') + actual = mapnik.Image.open(actual_file) + expected = mapnik.Image.open(expected_file) + eq_(actual.tostring('png32'),expected.tostring('png32'), 'failed comparing actual (%s) and expected (%s)' % (actual_file,expected_file)) if __name__ == "__main__": setup()