From 965928c63f246b1351134580db4fbbcd533ecde5 Mon Sep 17 00:00:00 2001 From: Brian Crowell Date: Thu, 25 Oct 2012 17:00:19 -0500 Subject: [PATCH] py3k: Add Windows icon sanity test --- Images/lena.ico | Bin 0 -> 1406 bytes PIL/IcoImagePlugin.py | 2 +- Tests/test_file_ico.py | 14 ++++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 Images/lena.ico create mode 100644 Tests/test_file_ico.py diff --git a/Images/lena.ico b/Images/lena.ico new file mode 100644 index 0000000000000000000000000000000000000000..6fadbe29edcd3b4b4986b2a1cb020443a1515099 GIT binary patch literal 1406 zcma)*`A-uD6vsaf)RpT3Uo$q7_hzoI$aOKj#4 zQsXq*tYH$f1_{m_Cn~oG^_f9Zb9&I78bh8nP2`zTlvz_4@;i~Ann9m8Om5*#lm)}Y z7MOiGza!0_C!ufv_1O_3^QH(bctTMAEV^P7DWwC16-{xx#DunG{3wew`m5| zh1aAv&7*C4P2R<)BwhH6=$5y{x4fb9$^^QLZ^^zqOX1ZC^q2l7x$PNc*TyMspQf^7 zlIo6G&bKeq*f~ks%_WSTFRAOErm4%U>t3Su-V8VHO>u7M6~)8L6q?>r^WY7A<4ZJ* z|3lxS1zI2e`>wZsZ$4t+!*ySNBFe6+?43R0w{x@Yh{YPq&$k3u)jl6~ed1_k`)Kv2 zmNu)@MT5&R`L}C?o5$8$dat*zKG%C}zuxubcbg}_wTxQ3*172HN~_D6OUqlv4t?{3 z|Hs+2JzKXn<0S$LQ$n z!u%^@E(uz9OG1nV3yZJQell6C>X6;qD~=64^LSBjjIU4lVB@W8g5c!zf@VXUv9*3~ c--;VIofPRO)6-9A&$ZvJNj&`ChkA$bKR(j;ssI20 literal 0 HcmV?d00001 diff --git a/PIL/IcoImagePlugin.py b/PIL/IcoImagePlugin.py index 0068db47f..c484a6774 100644 --- a/PIL/IcoImagePlugin.py +++ b/PIL/IcoImagePlugin.py @@ -49,7 +49,7 @@ class IcoImageFile(BmpImagePlugin.BmpImageFile): raise SyntaxError("not an ICO file") # pick the largest icon in the file - m = "" + m = b"" for i in range(i16(s[4:])): s = self.fp.read(16) if not m: diff --git a/Tests/test_file_ico.py b/Tests/test_file_ico.py new file mode 100644 index 000000000..f741cd663 --- /dev/null +++ b/Tests/test_file_ico.py @@ -0,0 +1,14 @@ +from tester import * + +from PIL import Image + +# sample ppm stream +file = "Images/lena.ico" +data = open(file, "rb").read() + +def test_sanity(): + im = Image.open(file) + im.load() + assert_equal(im.mode, "P") + assert_equal(im.size, (16, 16)) + assert_equal(im.format, "ICO")