mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-10 23:34:44 +03:00
Merge 9acbaa4aee
into c22c8eefcc
This commit is contained in:
commit
d5d20121d4
|
@ -33,6 +33,7 @@ i32 = _binary.i32le
|
||||||
def _accept(prefix):
|
def _accept(prefix):
|
||||||
return prefix[:4] == b"\0\0\2\0"
|
return prefix[:4] == b"\0\0\2\0"
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Image plugin for Windows Cursor files.
|
# Image plugin for Windows Cursor files.
|
||||||
|
|
||||||
|
@ -48,7 +49,7 @@ class CurImageFile(BmpImagePlugin.BmpImageFile):
|
||||||
# check magic
|
# check magic
|
||||||
s = self.fp.read(6)
|
s = self.fp.read(6)
|
||||||
if not _accept(s):
|
if not _accept(s):
|
||||||
raise SyntaxError("not an CUR file")
|
raise SyntaxError("not a CUR file")
|
||||||
|
|
||||||
# pick the largest cursor in the file
|
# pick the largest cursor in the file
|
||||||
m = b""
|
m = b""
|
||||||
|
|
BIN
Tests/images/deerstalker.cur
Normal file
BIN
Tests/images/deerstalker.cur
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
23
Tests/test_file_cur.py
Normal file
23
Tests/test_file_cur.py
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
from helper import unittest, PillowTestCase
|
||||||
|
|
||||||
|
from PIL import Image, CurImagePlugin
|
||||||
|
|
||||||
|
|
||||||
|
class TestFileCur(PillowTestCase):
|
||||||
|
|
||||||
|
def test_sanity(self):
|
||||||
|
# Arrange
|
||||||
|
test_file = "Tests/images/deerstalker.cur"
|
||||||
|
|
||||||
|
# Act
|
||||||
|
im = Image.open(test_file)
|
||||||
|
|
||||||
|
# Assert
|
||||||
|
self.assertEqual(im.size, (32, 32))
|
||||||
|
self.assertIsInstance(im, CurImagePlugin.CurImageFile)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
|
|
||||||
|
# End of file
|
Loading…
Reference in New Issue
Block a user