Test no change with identity matrix

This commit is contained in:
Hugo 2017-01-30 14:28:00 +02:00
parent 7fba16b074
commit 04e3f585b0

View File

@ -187,6 +187,23 @@ class TestImageConvert(PillowTestCase):
matrix_convert('RGB')
matrix_convert('L')
def test_matrix_identity(self):
# Arrange
im = hopper('RGB')
identity_matrix = (
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0)
self.assertEqual(im.mode, 'RGB')
# Act
# Convert with an identity matrix
converted_im = im.convert(mode='RGB', matrix=identity_matrix)
# Assert
# No change
self.assert_image_equal(converted_im, im)
if __name__ == '__main__':
unittest.main()