RGBA and CMYK thumb creation tests

This commit is contained in:
z4r 2014-01-10 12:16:08 +01:00
parent c1f278bb84
commit 3b3bdd8df4
3 changed files with 14 additions and 0 deletions

BIN
tests/data/django.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -2,6 +2,7 @@ import os.path
from django.test import TestCase
from django.core.urlresolvers import reverse
from django.test.utils import override_settings
from avatar.conf import settings
from avatar.util import get_primary_avatar, get_user_model
@ -126,3 +127,16 @@ class AvatarUploadTests(TestCase):
# def testChangePrimaryAvatar
# def testDeleteThumbnailAndRecreation
# def testAutomaticThumbnailCreation
@override_settings(AVATAR_THUMB_FORMAT='png')
def testAutomaticThumbnailCreationRGBA(self):
upload_helper(self, "django.png")
avatar = get_primary_avatar(self.user)
image = Image.open(avatar.avatar.storage.open(avatar.avatar_name(settings.AVATAR_DEFAULT_SIZE), 'rb'))
self.assertEqual(image.mode, 'RGBA')
def testAutomaticThumbnailCreationCMYK(self):
upload_helper(self, "django_pony_cmyk.jpg")
avatar = get_primary_avatar(self.user)
image = Image.open(avatar.avatar.storage.open(avatar.avatar_name(settings.AVATAR_DEFAULT_SIZE), 'rb'))
self.assertEqual(image.mode, 'RGB')