mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 01:47:47 +03:00 
			
		
		
		
	Add (failing) test for GIMP 1.3 gradient files and .ggr by me
This commit is contained in:
		
							parent
							
								
									674fd9744d
								
							
						
					
					
						commit
						dbf0ee3631
					
				
							
								
								
									
										7
									
								
								Tests/images/gimp_gradient_with_name.ggr
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								Tests/images/gimp_gradient_with_name.ggr
									
									
									
									
									
										Normal 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
 | 
				
			||||||
| 
						 | 
					@ -2,8 +2,6 @@ from helper import unittest, PillowTestCase
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from PIL import GimpGradientFile
 | 
					from PIL import GimpGradientFile
 | 
				
			||||||
 | 
					
 | 
				
			||||||
TEST_FILE = "Tests/images/gimp_gradient.ggr"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TestImage(PillowTestCase):
 | 
					class TestImage(PillowTestCase):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -87,9 +85,25 @@ class TestImage(PillowTestCase):
 | 
				
			||||||
    def test_load_via_imagepalette(self):
 | 
					    def test_load_via_imagepalette(self):
 | 
				
			||||||
        # Arrange
 | 
					        # Arrange
 | 
				
			||||||
        from PIL import ImagePalette
 | 
					        from PIL import ImagePalette
 | 
				
			||||||
 | 
					        test_file = "Tests/images/gimp_gradient.ggr"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Act
 | 
					        # 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
 | 
					        # Assert
 | 
				
			||||||
        # load returns raw palette information
 | 
					        # load returns raw palette information
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user