Skip to content

Commit

Permalink
Updated channel_dict regression test for IM7 support
Browse files Browse the repository at this point in the history
  • Loading branch information
emcconville committed Oct 5, 2017
1 parent 2cf9d4a commit 921a9f7
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions tests/image_test.py
Expand Up @@ -1128,6 +1128,8 @@ def test_metadata(fx_asset):
assert img.metadata.get('exif:UnknownValue', "IDK") == "IDK"


@mark.xfail(MAGICK_VERSION_NUMBER >= 0x700,
reason="Channel traits are not implemented in IM7.")
def test_channel_depths(fx_asset):
with Image(filename=str(fx_asset.join('beach.jpg'))) as i:
assert dict(i.channel_depths) == {
Expand All @@ -1151,10 +1153,22 @@ def test_channel_depths(fx_asset):
def test_channel_images(fx_asset):
with Image(filename=str(fx_asset.join('sasha.jpg'))) as i:
i.format = 'png'
for name in 'opacity', 'alpha', 'true_alpha':
channels = ('opacity', 'alpha',)
# Only include TrueAlphaChannel if IM6, as its deprecated & unused
# in IM7.
if MAGICK_VERSION_NUMBER < 0x700:
channels = channels + ('true_alpha',)
for name in channels:
expected_path = str(fx_asset.join('channel_images', name + '.png'))
with Image(filename=expected_path) as expected:
assert i.channel_images[name] == expected
if MAGICK_VERSION_NUMBER >= 0x700:
# With IM7, channels are dynamic & influence signatures.
# We'll need to compare the first channel of the expected
# PNG with the extracted channel.
first_channel = expected.channel_images['red']
assert i.channel_images[name] == first_channel
else:
assert i.channel_images[name] == expected


def test_composite(fx_asset):
Expand Down

0 comments on commit 921a9f7

Please sign in to comment.