mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-11 04:07:21 +03:00
Test matrix convert
This commit is contained in:
parent
6d11fa23dd
commit
cea36587ab
|
@ -137,6 +137,37 @@ class TestImageConvert(PillowTestCase):
|
|||
|
||||
self.assert_image_similar(alpha, comparable, 5)
|
||||
|
||||
def test_matrix_illegal_conversion(self):
|
||||
# Arrange
|
||||
im = hopper('CMYK')
|
||||
matrix = (
|
||||
0.412453, 0.357580, 0.180423, 0,
|
||||
0.212671, 0.715160, 0.072169, 0,
|
||||
0.019334, 0.119193, 0.950227, 0)
|
||||
self.assertNotEqual(im.mode, 'RGB')
|
||||
|
||||
# Act / Assert
|
||||
self.assertRaises(ValueError,
|
||||
lambda: im.convert(mode='CMYK', matrix=matrix))
|
||||
|
||||
def test_matrix(self):
|
||||
# Arrange
|
||||
im = hopper('RGB')
|
||||
matrix = (
|
||||
0.412453, 0.357580, 0.180423, 0,
|
||||
0.212671, 0.715160, 0.072169, 0,
|
||||
0.019334, 0.119193, 0.950227, 0)
|
||||
self.assertEqual(im.mode, 'RGB')
|
||||
|
||||
# Act
|
||||
# Convert an RGB image to the CIE XYZ colour space
|
||||
converted_im = im.convert(mode='RGB', matrix=matrix)
|
||||
|
||||
# Assert
|
||||
self.assertEqual(converted_im.mode, 'RGB')
|
||||
self.assertEqual(converted_im.size, im.size)
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
Loading…
Reference in New Issue
Block a user