From 31b05ce82c810bd76b3c4259e0db4af6bba81bed Mon Sep 17 00:00:00 2001 From: hugovk Date: Thu, 21 Apr 2016 17:40:20 +0300 Subject: [PATCH] Test TGA RLE file --- Tests/test_file_tga.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/Tests/test_file_tga.py b/Tests/test_file_tga.py index 459e766d5..ef3acfe65 100644 --- a/Tests/test_file_tga.py +++ b/Tests/test_file_tga.py @@ -15,6 +15,16 @@ class TestFileTga(PillowTestCase): # Assert self.assertEqual(im.size, (100, 100)) + def test_id_field_rle(self): + # tga file with id field + test_file = "Tests/images/rgb32rle.tga" + + # Act + im = Image.open(test_file) + + # Assert + self.assertEqual(im.size, (199, 199)) + def test_save(self): test_file = "Tests/images/tga_id_field.tga" im = Image.open(test_file) @@ -34,6 +44,25 @@ class TestFileTga(PillowTestCase): # Unsupported mode save self.assertRaises(IOError, lambda: im.convert("LA").save(test_file)) + def test_save_rle(self): + test_file = "Tests/images/rgb32rle.tga" + im = Image.open(test_file) + + test_file = self.tempfile("temp.tga") + + # Save + im.save(test_file) + test_im = Image.open(test_file) + self.assertEqual(test_im.size, (199, 199)) + + # RGBA save + im.convert("RGBA").save(test_file) + test_im = Image.open(test_file) + self.assertEqual(test_im.size, (199, 199)) + + # Unsupported mode save + self.assertRaises(IOError, lambda: im.convert("LA").save(test_file)) + if __name__ == '__main__': unittest.main()