Linear and radial gradient: only need one target image

This commit is contained in:
hugovk 2017-02-06 22:03:17 +02:00
parent 05aa252f9f
commit d7fe8d1eb7
5 changed files with 6 additions and 6 deletions

View File

Before

Width:  |  Height:  |  Size: 516 B

After

Width:  |  Height:  |  Size: 516 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

View File

@ -328,6 +328,7 @@ class TestImage(PillowTestCase):
def test_linear_gradient(self):
# Arrange
target_file = "Tests/images/linear_gradient.png"
for mode in ["L", "P"]:
# Act
@ -338,9 +339,8 @@ class TestImage(PillowTestCase):
self.assertEqual(im.mode, mode)
self.assertEqual(im.getpixel((0, 0)), 0)
self.assertEqual(im.getpixel((255, 255)), 255)
im2 = Image.open('Tests/images/linear_gradient_{}.png'.format(
mode))
self.assert_image_equal(im, im2)
target = Image.open(target_file).convert(mode)
self.assert_image_equal(im, target)
def test_radial_gradient_wrong_mode(self):
# Arrange
@ -354,6 +354,7 @@ class TestImage(PillowTestCase):
def test_radial_gradient(self):
# Arrange
target_file = "Tests/images/radial_gradient.png"
for mode in ["L", "P"]:
# Act
@ -364,9 +365,8 @@ class TestImage(PillowTestCase):
self.assertEqual(im.mode, mode)
self.assertEqual(im.getpixel((0, 0)), 255)
self.assertEqual(im.getpixel((128, 128)), 0)
im2 = Image.open('Tests/images/radial_gradient_{}.png'.format(
mode))
self.assert_image_equal(im, im2)
target = Image.open(target_file).convert(mode)
self.assert_image_equal(im, target)
if __name__ == '__main__':