Skip to content
Permalink
Browse files

Continued test cases for image-pixel-color-setter #105

  • Loading branch information...
emcconville committed Jan 7, 2019
1 parent e2bfa7c commit 97b0e06af84c2396355cf6f83bbf31be838260cc
Showing with 17 additions and 1 deletion.
  1. +16 −0 tests/image_test.py
  2. +1 −1 wand/image.py
@@ -628,6 +628,22 @@ def test_index_pixel_set(fx_asset):
with Color('black') as dot:
img[0, 0] = dot
assert img[0, 0] == dot
img.colorspace = 'gray'
with Color('gray50') as dot:
img[0, 0] = dot
assert img[0, 0] == dot
img.colorspace = 'cmyk'
with Color('cmyk(255, 0, 0, 0') as dot:
img[0, 0] = dot
assert img[0, 0] == dot
with raises(TypeError):
img[0, 0] = 1
with raises(TypeError):
img[0xDEADBEEF] = Color('black')
with raises(ValueError):
img[1, 2, 3] = Color('black')
with raises(TypeError):
img[0.5, "d"] = Color('black')


def test_index_row(fx_asset):
@@ -1014,7 +1014,7 @@ def __setitem__(self, idx, color):
pixel[0] = color.red
elif colorspace == 'cmyk':
channel_map = b'CMYK'
pixel = (ctypes.c_double * 4)()
pixel = (ctypes.c_double * 5)()
pixel[0] = color.red
pixel[1] = color.green
pixel[2] = color.blue

0 comments on commit 97b0e06

Please sign in to comment.
You can’t perform that action at this time.