From a852c6186f887f97849ff29fd1ebc8b7d953d090 Mon Sep 17 00:00:00 2001 From: Hugo Date: Mon, 29 Jan 2018 17:18:06 +0200 Subject: [PATCH] Basic WAL test --- Tests/test_file_wal.py | 23 +++++++++++++++++++++++ src/PIL/WalImageFile.py | 1 + 2 files changed, 24 insertions(+) create mode 100644 Tests/test_file_wal.py diff --git a/Tests/test_file_wal.py b/Tests/test_file_wal.py new file mode 100644 index 000000000..13b1e3a2f --- /dev/null +++ b/Tests/test_file_wal.py @@ -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() diff --git a/src/PIL/WalImageFile.py b/src/PIL/WalImageFile.py index 69964f7be..6602cc86b 100644 --- a/src/PIL/WalImageFile.py +++ b/src/PIL/WalImageFile.py @@ -74,6 +74,7 @@ def open(filename): with builtins.open(filename, "rb") as fp: return imopen(fp) + quake2palette = ( # 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"