Basic WAL test

This commit is contained in:
Hugo 2018-01-29 17:18:06 +02:00
parent 8674f71907
commit a852c6186f
2 changed files with 24 additions and 0 deletions

23
Tests/test_file_wal.py Normal file
View File

@ -0,0 +1,23 @@
from helper import unittest, PillowTestCase
from PIL import WalImageFile
class TestFileWal(PillowTestCase):
def test_open(self):
# Arrange
TEST_FILE = "Tests/images/hopper.wal"
# Act
im = WalImageFile.open(TEST_FILE)
# Assert
self.assertEqual(im.format, "WAL")
self.assertEqual(im.format_description, "Quake2 Texture")
self.assertEqual(im.mode, "P")
self.assertEqual(im.size, (128, 128))
if __name__ == '__main__':
unittest.main()

View File

@ -74,6 +74,7 @@ def open(filename):
with builtins.open(filename, "rb") as fp: with builtins.open(filename, "rb") as fp:
return imopen(fp) return imopen(fp)
quake2palette = ( quake2palette = (
# default palette taken from piffo 0.93 by Hans Häggström # default palette taken from piffo 0.93 by Hans Häggström
b"\x01\x01\x01\x0b\x0b\x0b\x12\x12\x12\x17\x17\x17\x1b\x1b\x1b\x1e" b"\x01\x01\x01\x0b\x0b\x0b\x12\x12\x12\x17\x17\x17\x1b\x1b\x1b\x1e"