mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Linear and radial gradient: only need one target image
This commit is contained in:
parent
05aa252f9f
commit
d7fe8d1eb7
Before Width: | Height: | Size: 516 B After Width: | Height: | Size: 516 B |
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
Binary file not shown.
Before Width: | Height: | Size: 12 KiB |
|
@ -328,6 +328,7 @@ class TestImage(PillowTestCase):
|
||||||
def test_linear_gradient(self):
|
def test_linear_gradient(self):
|
||||||
|
|
||||||
# Arrange
|
# Arrange
|
||||||
|
target_file = "Tests/images/linear_gradient.png"
|
||||||
for mode in ["L", "P"]:
|
for mode in ["L", "P"]:
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
|
@ -338,9 +339,8 @@ class TestImage(PillowTestCase):
|
||||||
self.assertEqual(im.mode, mode)
|
self.assertEqual(im.mode, mode)
|
||||||
self.assertEqual(im.getpixel((0, 0)), 0)
|
self.assertEqual(im.getpixel((0, 0)), 0)
|
||||||
self.assertEqual(im.getpixel((255, 255)), 255)
|
self.assertEqual(im.getpixel((255, 255)), 255)
|
||||||
im2 = Image.open('Tests/images/linear_gradient_{}.png'.format(
|
target = Image.open(target_file).convert(mode)
|
||||||
mode))
|
self.assert_image_equal(im, target)
|
||||||
self.assert_image_equal(im, im2)
|
|
||||||
|
|
||||||
def test_radial_gradient_wrong_mode(self):
|
def test_radial_gradient_wrong_mode(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
|
@ -354,6 +354,7 @@ class TestImage(PillowTestCase):
|
||||||
def test_radial_gradient(self):
|
def test_radial_gradient(self):
|
||||||
|
|
||||||
# Arrange
|
# Arrange
|
||||||
|
target_file = "Tests/images/radial_gradient.png"
|
||||||
for mode in ["L", "P"]:
|
for mode in ["L", "P"]:
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
|
@ -364,9 +365,8 @@ class TestImage(PillowTestCase):
|
||||||
self.assertEqual(im.mode, mode)
|
self.assertEqual(im.mode, mode)
|
||||||
self.assertEqual(im.getpixel((0, 0)), 255)
|
self.assertEqual(im.getpixel((0, 0)), 255)
|
||||||
self.assertEqual(im.getpixel((128, 128)), 0)
|
self.assertEqual(im.getpixel((128, 128)), 0)
|
||||||
im2 = Image.open('Tests/images/radial_gradient_{}.png'.format(
|
target = Image.open(target_file).convert(mode)
|
||||||
mode))
|
self.assert_image_equal(im, target)
|
||||||
self.assert_image_equal(im, im2)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in New Issue
Block a user