Add (failing) test for GIMP 1.3 gradient files and .ggr by me

This commit is contained in:
hugovk 2014-08-26 12:04:04 +03:00
parent 674fd9744d
commit dbf0ee3631
2 changed files with 24 additions and 3 deletions

View File

@ -0,0 +1,7 @@
GIMP Gradient
Name: A GIMP 1.3 gradient file
4
0.000000 0.351923 0.534893 1.000000 1.000000 1.000000 0.910000 0.730303 0.510606 1.000000 0.480000 1 0
0.501504 0.611002 0.637730 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 1.000000 1 0
0.931891 0.951264 1.000000 0.531255 0.316078 1.031173 1.000000 0.000000 0.000000 0.000000 1.000000 0 0
0.810551 0.881217 0.921883 0.717576 0.441331 0.081217 1.000000 0.751576 0.410331 0.081217 1.000000 0 0

View File

@ -2,8 +2,6 @@ from helper import unittest, PillowTestCase
from PIL import GimpGradientFile
TEST_FILE = "Tests/images/gimp_gradient.ggr"
class TestImage(PillowTestCase):
@ -87,9 +85,25 @@ class TestImage(PillowTestCase):
def test_load_via_imagepalette(self):
# Arrange
from PIL import ImagePalette
test_file = "Tests/images/gimp_gradient.ggr"
# Act
palette = ImagePalette.load(TEST_FILE)
palette = ImagePalette.load(test_file)
# Assert
# load returns raw palette information
self.assertEqual(len(palette[0]), 1024)
self.assertEqual(palette[1], "RGBA")
def test_load_1_3_via_imagepalette(self):
# Arrange
from PIL import ImagePalette
# GIMP 1.3 gradient files contain a name field
test_file = "Tests/images/gimp_gradient_with_name.ggr"
# Act
palette = ImagePalette.load(test_file)
# Assert
# load returns raw palette information