mirror of
https://github.com/jazzband/django-avatar.git
synced 2026-03-16 22:20:30 +00:00
RGBA and CMYK thumb creation tests
This commit is contained in:
parent
c1f278bb84
commit
3b3bdd8df4
3 changed files with 14 additions and 0 deletions
BIN
tests/data/django.png
Normal file
BIN
tests/data/django.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
BIN
tests/data/django_pony_cmyk.jpg
Normal file
BIN
tests/data/django_pony_cmyk.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
|
|
@ -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')
|
||||
|
|
|
|||
Loading…
Reference in a new issue