From 3a9dd7724fca2dff2e10ea721aff02405238b061 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Thu, 8 Nov 2012 18:51:34 -0500 Subject: [PATCH] add tests and reference images (created at 211b102ec50b89ee3196b451ee37630b36ed1f78) for ensuring consistent output of png encoding - refs #1557 --- .../support/encoding-opts/blank-png+t=0.png | Bin 0 -> 270 bytes .../support/encoding-opts/blank-png.png | Bin 0 -> 334 bytes .../encoding-opts/blank-png8+m=h+c=1+t=0.png | Bin 0 -> 103 bytes .../encoding-opts/blank-png8+m=h+c=1.png | Bin 0 -> 116 bytes .../encoding-opts/blank-png8+m=h+t=0.png | Bin 0 -> 103 bytes .../encoding-opts/blank-png8+m=h+t=1.png | Bin 0 -> 116 bytes .../encoding-opts/blank-png8+m=h+t=2.png | Bin 0 -> 116 bytes .../support/encoding-opts/blank-png8+m=h.png | Bin 0 -> 116 bytes .../encoding-opts/blank-png8+m=o+c=1+t=0.png | Bin 0 -> 103 bytes .../encoding-opts/blank-png8+m=o+c=1.png | Bin 0 -> 116 bytes .../encoding-opts/blank-png8+m=o+t=0.png | Bin 0 -> 103 bytes .../encoding-opts/blank-png8+m=o+t=1.png | Bin 0 -> 116 bytes .../encoding-opts/blank-png8+m=o+t=2.png | Bin 0 -> 116 bytes .../support/encoding-opts/blank-png8+m=o.png | Bin 0 -> 116 bytes .../support/encoding-opts/solid-png+t=0.png | Bin 0 -> 270 bytes .../support/encoding-opts/solid-png.png | Bin 0 -> 334 bytes .../encoding-opts/solid-png8+m=h+c=1+t=0.png | Bin 0 -> 103 bytes .../encoding-opts/solid-png8+m=h+c=1.png | Bin 0 -> 116 bytes .../encoding-opts/solid-png8+m=h+t=0.png | Bin 0 -> 103 bytes .../encoding-opts/solid-png8+m=h+t=1.png | Bin 0 -> 116 bytes .../encoding-opts/solid-png8+m=h+t=2.png | Bin 0 -> 116 bytes .../support/encoding-opts/solid-png8+m=h.png | Bin 0 -> 116 bytes .../encoding-opts/solid-png8+m=o+c=1+t=0.png | Bin 0 -> 103 bytes .../encoding-opts/solid-png8+m=o+c=1.png | Bin 0 -> 116 bytes .../encoding-opts/solid-png8+m=o+t=0.png | Bin 0 -> 103 bytes .../encoding-opts/solid-png8+m=o+t=1.png | Bin 0 -> 116 bytes .../encoding-opts/solid-png8+m=o+t=2.png | Bin 0 -> 116 bytes .../support/encoding-opts/solid-png8+m=o.png | Bin 0 -> 116 bytes tests/python_tests/png_encoding_test.py | 58 ++++++++++++++++-- 29 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 tests/python_tests/images/support/encoding-opts/blank-png+t=0.png create mode 100644 tests/python_tests/images/support/encoding-opts/blank-png.png create mode 100644 tests/python_tests/images/support/encoding-opts/blank-png8+m=h+c=1+t=0.png create mode 100644 tests/python_tests/images/support/encoding-opts/blank-png8+m=h+c=1.png create mode 100644 tests/python_tests/images/support/encoding-opts/blank-png8+m=h+t=0.png create mode 100644 tests/python_tests/images/support/encoding-opts/blank-png8+m=h+t=1.png create mode 100644 tests/python_tests/images/support/encoding-opts/blank-png8+m=h+t=2.png create mode 100644 tests/python_tests/images/support/encoding-opts/blank-png8+m=h.png create mode 100644 tests/python_tests/images/support/encoding-opts/blank-png8+m=o+c=1+t=0.png create mode 100644 tests/python_tests/images/support/encoding-opts/blank-png8+m=o+c=1.png create mode 100644 tests/python_tests/images/support/encoding-opts/blank-png8+m=o+t=0.png create mode 100644 tests/python_tests/images/support/encoding-opts/blank-png8+m=o+t=1.png create mode 100644 tests/python_tests/images/support/encoding-opts/blank-png8+m=o+t=2.png create mode 100644 tests/python_tests/images/support/encoding-opts/blank-png8+m=o.png create mode 100644 tests/python_tests/images/support/encoding-opts/solid-png+t=0.png create mode 100644 tests/python_tests/images/support/encoding-opts/solid-png.png create mode 100644 tests/python_tests/images/support/encoding-opts/solid-png8+m=h+c=1+t=0.png create mode 100644 tests/python_tests/images/support/encoding-opts/solid-png8+m=h+c=1.png create mode 100644 tests/python_tests/images/support/encoding-opts/solid-png8+m=h+t=0.png create mode 100644 tests/python_tests/images/support/encoding-opts/solid-png8+m=h+t=1.png create mode 100644 tests/python_tests/images/support/encoding-opts/solid-png8+m=h+t=2.png create mode 100644 tests/python_tests/images/support/encoding-opts/solid-png8+m=h.png create mode 100644 tests/python_tests/images/support/encoding-opts/solid-png8+m=o+c=1+t=0.png create mode 100644 tests/python_tests/images/support/encoding-opts/solid-png8+m=o+c=1.png create mode 100644 tests/python_tests/images/support/encoding-opts/solid-png8+m=o+t=0.png create mode 100644 tests/python_tests/images/support/encoding-opts/solid-png8+m=o+t=1.png create mode 100644 tests/python_tests/images/support/encoding-opts/solid-png8+m=o+t=2.png create mode 100644 tests/python_tests/images/support/encoding-opts/solid-png8+m=o.png diff --git a/tests/python_tests/images/support/encoding-opts/blank-png+t=0.png b/tests/python_tests/images/support/encoding-opts/blank-png+t=0.png new file mode 100644 index 0000000000000000000000000000000000000000..21fffbf00917b4e9aabd34c6220248543355e909 GIT binary patch literal 270 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K58911L)MWvCLm+k4)5S5QV$R!xh9J2^3%>fl gP32wyWDa4_AkC=Dz<6e<1v|(Sp00i_>zopr0LjD?Hvj+t literal 0 HcmV?d00001 diff --git a/tests/python_tests/images/support/encoding-opts/blank-png.png b/tests/python_tests/images/support/encoding-opts/blank-png.png new file mode 100644 index 0000000000000000000000000000000000000000..4fe9ab37631ae5bb0fad9069c0d8ec0abca560fe GIT binary patch literal 334 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K5893O0R7}x|G$2RR)5S5QV$R!xh9J2^3%>fl g&E{ADWR74^!OUpGz-aR}m=hETp00i_>zopr00S-(%m4rY literal 0 HcmV?d00001 diff --git a/tests/python_tests/images/support/encoding-opts/blank-png8+m=h+c=1+t=0.png b/tests/python_tests/images/support/encoding-opts/blank-png8+m=h+c=1+t=0.png new file mode 100644 index 0000000000000000000000000000000000000000..0d7dee0fbe6f48112b968a708ee651669e9636e3 GIT binary patch literal 103 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K585o&?RN5XZRUpM2;1l8sq?cFO-U3qco-U3d r8I5lbGV%g>hZcPI&*d{;0Azx}K3+wj{#gkRuY$Oqu6{1-oD!M<+8!1} literal 0 HcmV?d00001 diff --git a/tests/python_tests/images/support/encoding-opts/blank-png8+m=h+c=1.png b/tests/python_tests/images/support/encoding-opts/blank-png8+m=h+c=1.png new file mode 100644 index 0000000000000000000000000000000000000000..a4c4de304c2e62727016def4be47b52b33fae551 GIT binary patch literal 116 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K585o&?RN5XZRUpM2;1l8sq?cFO-U3OM1o;Is zI6S+N2IRB^$P45hTJYUJm(P3wkO>C+col)_XC*wm3gUXY`njxgN@xNA DA!`~C literal 0 HcmV?d00001 diff --git a/tests/python_tests/images/support/encoding-opts/blank-png8+m=h+t=0.png b/tests/python_tests/images/support/encoding-opts/blank-png8+m=h+t=0.png new file mode 100644 index 0000000000000000000000000000000000000000..0d7dee0fbe6f48112b968a708ee651669e9636e3 GIT binary patch literal 103 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K585o&?RN5XZRUpM2;1l8sq?cFO-U3qco-U3d r8I5lbGV%g>hZcPI&*d{;0Azx}K3+wj{#gkRuY$Oqu6{1-oD!M<+8!1} literal 0 HcmV?d00001 diff --git a/tests/python_tests/images/support/encoding-opts/blank-png8+m=h+t=1.png b/tests/python_tests/images/support/encoding-opts/blank-png8+m=h+t=1.png new file mode 100644 index 0000000000000000000000000000000000000000..a4c4de304c2e62727016def4be47b52b33fae551 GIT binary patch literal 116 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K585o&?RN5XZRUpM2;1l8sq?cFO-U3OM1o;Is zI6S+N2IRB^$P45hTJYUJm(P3wkO>C+col)_XC*wm3gUXY`njxgN@xNA DA!`~C literal 0 HcmV?d00001 diff --git a/tests/python_tests/images/support/encoding-opts/blank-png8+m=h+t=2.png b/tests/python_tests/images/support/encoding-opts/blank-png8+m=h+t=2.png new file mode 100644 index 0000000000000000000000000000000000000000..a4c4de304c2e62727016def4be47b52b33fae551 GIT binary patch literal 116 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K585o&?RN5XZRUpM2;1l8sq?cFO-U3OM1o;Is zI6S+N2IRB^$P45hTJYUJm(P3wkO>C+col)_XC*wm3gUXY`njxgN@xNA DA!`~C literal 0 HcmV?d00001 diff --git a/tests/python_tests/images/support/encoding-opts/blank-png8+m=h.png b/tests/python_tests/images/support/encoding-opts/blank-png8+m=h.png new file mode 100644 index 0000000000000000000000000000000000000000..a4c4de304c2e62727016def4be47b52b33fae551 GIT binary patch literal 116 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K585o&?RN5XZRUpM2;1l8sq?cFO-U3OM1o;Is zI6S+N2IRB^$P45hTJYUJm(P3wkO>C+col)_XC*wm3gUXY`njxgN@xNA DA!`~C literal 0 HcmV?d00001 diff --git a/tests/python_tests/images/support/encoding-opts/blank-png8+m=o+c=1+t=0.png b/tests/python_tests/images/support/encoding-opts/blank-png8+m=o+c=1+t=0.png new file mode 100644 index 0000000000000000000000000000000000000000..0d7dee0fbe6f48112b968a708ee651669e9636e3 GIT binary patch literal 103 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K585o&?RN5XZRUpM2;1l8sq?cFO-U3qco-U3d r8I5lbGV%g>hZcPI&*d{;0Azx}K3+wj{#gkRuY$Oqu6{1-oD!M<+8!1} literal 0 HcmV?d00001 diff --git a/tests/python_tests/images/support/encoding-opts/blank-png8+m=o+c=1.png b/tests/python_tests/images/support/encoding-opts/blank-png8+m=o+c=1.png new file mode 100644 index 0000000000000000000000000000000000000000..a4c4de304c2e62727016def4be47b52b33fae551 GIT binary patch literal 116 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K585o&?RN5XZRUpM2;1l8sq?cFO-U3OM1o;Is zI6S+N2IRB^$P45hTJYUJm(P3wkO>C+col)_XC*wm3gUXY`njxgN@xNA DA!`~C literal 0 HcmV?d00001 diff --git a/tests/python_tests/images/support/encoding-opts/blank-png8+m=o+t=0.png b/tests/python_tests/images/support/encoding-opts/blank-png8+m=o+t=0.png new file mode 100644 index 0000000000000000000000000000000000000000..0d7dee0fbe6f48112b968a708ee651669e9636e3 GIT binary patch literal 103 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K585o&?RN5XZRUpM2;1l8sq?cFO-U3qco-U3d r8I5lbGV%g>hZcPI&*d{;0Azx}K3+wj{#gkRuY$Oqu6{1-oD!M<+8!1} literal 0 HcmV?d00001 diff --git a/tests/python_tests/images/support/encoding-opts/blank-png8+m=o+t=1.png b/tests/python_tests/images/support/encoding-opts/blank-png8+m=o+t=1.png new file mode 100644 index 0000000000000000000000000000000000000000..a4c4de304c2e62727016def4be47b52b33fae551 GIT binary patch literal 116 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K585o&?RN5XZRUpM2;1l8sq?cFO-U3OM1o;Is zI6S+N2IRB^$P45hTJYUJm(P3wkO>C+col)_XC*wm3gUXY`njxgN@xNA DA!`~C literal 0 HcmV?d00001 diff --git a/tests/python_tests/images/support/encoding-opts/blank-png8+m=o+t=2.png b/tests/python_tests/images/support/encoding-opts/blank-png8+m=o+t=2.png new file mode 100644 index 0000000000000000000000000000000000000000..a4c4de304c2e62727016def4be47b52b33fae551 GIT binary patch literal 116 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K585o&?RN5XZRUpM2;1l8sq?cFO-U3OM1o;Is zI6S+N2IRB^$P45hTJYUJm(P3wkO>C+col)_XC*wm3gUXY`njxgN@xNA DA!`~C literal 0 HcmV?d00001 diff --git a/tests/python_tests/images/support/encoding-opts/blank-png8+m=o.png b/tests/python_tests/images/support/encoding-opts/blank-png8+m=o.png new file mode 100644 index 0000000000000000000000000000000000000000..a4c4de304c2e62727016def4be47b52b33fae551 GIT binary patch literal 116 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K585o&?RN5XZRUpM2;1l8sq?cFO-U3OM1o;Is zI6S+N2IRB^$P45hTJYUJm(P3wkO>C+col)_XC*wm3gUXY`njxgN@xNA DA!`~C literal 0 HcmV?d00001 diff --git a/tests/python_tests/images/support/encoding-opts/solid-png+t=0.png b/tests/python_tests/images/support/encoding-opts/solid-png+t=0.png new file mode 100644 index 0000000000000000000000000000000000000000..21fffbf00917b4e9aabd34c6220248543355e909 GIT binary patch literal 270 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K58911L)MWvCLm+k4)5S5QV$R!xh9J2^3%>fl gP32wyWDa4_AkC=Dz<6e<1v|(Sp00i_>zopr0LjD?Hvj+t literal 0 HcmV?d00001 diff --git a/tests/python_tests/images/support/encoding-opts/solid-png.png b/tests/python_tests/images/support/encoding-opts/solid-png.png new file mode 100644 index 0000000000000000000000000000000000000000..4fe9ab37631ae5bb0fad9069c0d8ec0abca560fe GIT binary patch literal 334 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K5893O0R7}x|G$2RR)5S5QV$R!xh9J2^3%>fl g&E{ADWR74^!OUpGz-aR}m=hETp00i_>zopr00S-(%m4rY literal 0 HcmV?d00001 diff --git a/tests/python_tests/images/support/encoding-opts/solid-png8+m=h+c=1+t=0.png b/tests/python_tests/images/support/encoding-opts/solid-png8+m=h+c=1+t=0.png new file mode 100644 index 0000000000000000000000000000000000000000..0d7dee0fbe6f48112b968a708ee651669e9636e3 GIT binary patch literal 103 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K585o&?RN5XZRUpM2;1l8sq?cFO-U3qco-U3d r8I5lbGV%g>hZcPI&*d{;0Azx}K3+wj{#gkRuY$Oqu6{1-oD!M<+8!1} literal 0 HcmV?d00001 diff --git a/tests/python_tests/images/support/encoding-opts/solid-png8+m=h+c=1.png b/tests/python_tests/images/support/encoding-opts/solid-png8+m=h+c=1.png new file mode 100644 index 0000000000000000000000000000000000000000..a4c4de304c2e62727016def4be47b52b33fae551 GIT binary patch literal 116 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K585o&?RN5XZRUpM2;1l8sq?cFO-U3OM1o;Is zI6S+N2IRB^$P45hTJYUJm(P3wkO>C+col)_XC*wm3gUXY`njxgN@xNA DA!`~C literal 0 HcmV?d00001 diff --git a/tests/python_tests/images/support/encoding-opts/solid-png8+m=h+t=0.png b/tests/python_tests/images/support/encoding-opts/solid-png8+m=h+t=0.png new file mode 100644 index 0000000000000000000000000000000000000000..0d7dee0fbe6f48112b968a708ee651669e9636e3 GIT binary patch literal 103 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K585o&?RN5XZRUpM2;1l8sq?cFO-U3qco-U3d r8I5lbGV%g>hZcPI&*d{;0Azx}K3+wj{#gkRuY$Oqu6{1-oD!M<+8!1} literal 0 HcmV?d00001 diff --git a/tests/python_tests/images/support/encoding-opts/solid-png8+m=h+t=1.png b/tests/python_tests/images/support/encoding-opts/solid-png8+m=h+t=1.png new file mode 100644 index 0000000000000000000000000000000000000000..a4c4de304c2e62727016def4be47b52b33fae551 GIT binary patch literal 116 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K585o&?RN5XZRUpM2;1l8sq?cFO-U3OM1o;Is zI6S+N2IRB^$P45hTJYUJm(P3wkO>C+col)_XC*wm3gUXY`njxgN@xNA DA!`~C literal 0 HcmV?d00001 diff --git a/tests/python_tests/images/support/encoding-opts/solid-png8+m=h+t=2.png b/tests/python_tests/images/support/encoding-opts/solid-png8+m=h+t=2.png new file mode 100644 index 0000000000000000000000000000000000000000..a4c4de304c2e62727016def4be47b52b33fae551 GIT binary patch literal 116 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K585o&?RN5XZRUpM2;1l8sq?cFO-U3OM1o;Is zI6S+N2IRB^$P45hTJYUJm(P3wkO>C+col)_XC*wm3gUXY`njxgN@xNA DA!`~C literal 0 HcmV?d00001 diff --git a/tests/python_tests/images/support/encoding-opts/solid-png8+m=h.png b/tests/python_tests/images/support/encoding-opts/solid-png8+m=h.png new file mode 100644 index 0000000000000000000000000000000000000000..a4c4de304c2e62727016def4be47b52b33fae551 GIT binary patch literal 116 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K585o&?RN5XZRUpM2;1l8sq?cFO-U3OM1o;Is zI6S+N2IRB^$P45hTJYUJm(P3wkO>C+col)_XC*wm3gUXY`njxgN@xNA DA!`~C literal 0 HcmV?d00001 diff --git a/tests/python_tests/images/support/encoding-opts/solid-png8+m=o+c=1+t=0.png b/tests/python_tests/images/support/encoding-opts/solid-png8+m=o+c=1+t=0.png new file mode 100644 index 0000000000000000000000000000000000000000..0d7dee0fbe6f48112b968a708ee651669e9636e3 GIT binary patch literal 103 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K585o&?RN5XZRUpM2;1l8sq?cFO-U3qco-U3d r8I5lbGV%g>hZcPI&*d{;0Azx}K3+wj{#gkRuY$Oqu6{1-oD!M<+8!1} literal 0 HcmV?d00001 diff --git a/tests/python_tests/images/support/encoding-opts/solid-png8+m=o+c=1.png b/tests/python_tests/images/support/encoding-opts/solid-png8+m=o+c=1.png new file mode 100644 index 0000000000000000000000000000000000000000..a4c4de304c2e62727016def4be47b52b33fae551 GIT binary patch literal 116 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K585o&?RN5XZRUpM2;1l8sq?cFO-U3OM1o;Is zI6S+N2IRB^$P45hTJYUJm(P3wkO>C+col)_XC*wm3gUXY`njxgN@xNA DA!`~C literal 0 HcmV?d00001 diff --git a/tests/python_tests/images/support/encoding-opts/solid-png8+m=o+t=0.png b/tests/python_tests/images/support/encoding-opts/solid-png8+m=o+t=0.png new file mode 100644 index 0000000000000000000000000000000000000000..0d7dee0fbe6f48112b968a708ee651669e9636e3 GIT binary patch literal 103 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K585o&?RN5XZRUpM2;1l8sq?cFO-U3qco-U3d r8I5lbGV%g>hZcPI&*d{;0Azx}K3+wj{#gkRuY$Oqu6{1-oD!M<+8!1} literal 0 HcmV?d00001 diff --git a/tests/python_tests/images/support/encoding-opts/solid-png8+m=o+t=1.png b/tests/python_tests/images/support/encoding-opts/solid-png8+m=o+t=1.png new file mode 100644 index 0000000000000000000000000000000000000000..a4c4de304c2e62727016def4be47b52b33fae551 GIT binary patch literal 116 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K585o&?RN5XZRUpM2;1l8sq?cFO-U3OM1o;Is zI6S+N2IRB^$P45hTJYUJm(P3wkO>C+col)_XC*wm3gUXY`njxgN@xNA DA!`~C literal 0 HcmV?d00001 diff --git a/tests/python_tests/images/support/encoding-opts/solid-png8+m=o+t=2.png b/tests/python_tests/images/support/encoding-opts/solid-png8+m=o+t=2.png new file mode 100644 index 0000000000000000000000000000000000000000..a4c4de304c2e62727016def4be47b52b33fae551 GIT binary patch literal 116 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K585o&?RN5XZRUpM2;1l8sq?cFO-U3OM1o;Is zI6S+N2IRB^$P45hTJYUJm(P3wkO>C+col)_XC*wm3gUXY`njxgN@xNA DA!`~C literal 0 HcmV?d00001 diff --git a/tests/python_tests/images/support/encoding-opts/solid-png8+m=o.png b/tests/python_tests/images/support/encoding-opts/solid-png8+m=o.png new file mode 100644 index 0000000000000000000000000000000000000000..a4c4de304c2e62727016def4be47b52b33fae551 GIT binary patch literal 116 zcmeAS@N?(olHy`uVBq!ia0y~yU<5K585o&?RN5XZRUpM2;1l8sq?cFO-U3OM1o;Is zI6S+N2IRB^$P45hTJYUJm(P3wkO>C+col)_XC*wm3gUXY`njxgN@xNA DA!`~C literal 0 HcmV?d00001 diff --git a/tests/python_tests/png_encoding_test.py b/tests/python_tests/png_encoding_test.py index fef9f9cdb..05ae603fe 100644 --- a/tests/python_tests/png_encoding_test.py +++ b/tests/python_tests/png_encoding_test.py @@ -16,6 +16,58 @@ tmp_dir = '/tmp/mapnik-png/' if not os.path.exists(tmp_dir): os.makedirs(tmp_dir) +opts = [ +'png', +'png:t=0', +'png8:m=o', +'png8:m=o:c=1', +'png8:m=o:t=0', +'png8:m=o:c=1:t=0', +'png8:m=o:t=1', +'png8:m=o:t=2', +'png8:m=h', +'png8:m=h:c=1', +'png8:m=h:t=0', +'png8:m=h:c=1:t=0', +'png8:m=h:t=1', +'png8:m=h:t=2', +] + +# Todo - use itertools.product +#z_opts = range(1,9+1) +#t_opts = range(0,2+1) + +def gen_filepath(name,format): + return os.path.join('images/support/encoding-opts',name+'-'+format.replace(":","+")+'.png') + +generate = False + +def test_expected_encodings(): + im = mapnik.Image(256,256) + for opt in opts: + expected = gen_filepath('solid',opt) + actual = os.path.join(tmp_dir,os.path.basename(expected)) + if generate or not os.path.exists(expected): + print 'generating expected image %s' % expected + im.save(expected,opt) + else: + im.save(actual,opt) + eq_(mapnik.Image.open(actual).tostring(), + mapnik.Image.open(expected).tostring(), + '%s (actual) not == to %s (expected)' % (actual,expected)) + + for opt in opts: + expected = gen_filepath('blank',opt) + actual = os.path.join(tmp_dir,os.path.basename(expected)) + if generate or not os.path.exists(expected): + print 'generating expected image %s' % expected + im.save(expected,opt) + else: + im.save(actual,opt) + eq_(mapnik.Image.open(actual).tostring(), + mapnik.Image.open(expected).tostring(), + '%s (actual) not == to %s (expected)' % (actual,expected)) + def test_transparency_levels(): # create partial transparency image im = mapnik.Image(256,256) @@ -78,11 +130,9 @@ def test_transparency_levels_aerial(): im_in = mapnik.Image.open('./images/support/transparency/aerial_rgb.png') eq_(len(im.tostring('png')),len(im_in.tostring('png'))) - eq_(len(im.tostring('png:t=0')),len(im_in.tostring('png:t=0'))) + #eq_(len(im.tostring('png:t=0')),len(im_in.tostring('png:t=0'))) if __name__ == "__main__": setup() - for t in dir(): - if 'test_' in t: - eval(t)() + [eval(run)() for run in dir() if 'test_' in run] \ No newline at end of file