[Python-modules-commits] [sorl-thumbnail] 09/15: update/simplify orientation.patch
Wolfgang Borgert
debacle at moszumanska.debian.org
Wed Oct 5 01:39:42 UTC 2016
This is an automated email from the git hooks/post-receive script.
debacle pushed a commit to branch master
in repository sorl-thumbnail.
commit b7e969492e7b15e475d6e140d74f4ecdd500887e
Author: W. Martin Borgert <debacle at debian.org>
Date: Wed Oct 5 02:50:31 2016 +0200
update/simplify orientation.patch
---
debian/patches/orientation.patch | 86 ++++++----------------------------------
1 file changed, 12 insertions(+), 74 deletions(-)
diff --git a/debian/patches/orientation.patch b/debian/patches/orientation.patch
index 3edd44a..1c3f499 100644
--- a/debian/patches/orientation.patch
+++ b/debian/patches/orientation.patch
@@ -1,89 +1,27 @@
-From 59611f8187b383c8692cf3ffb94be9b2ec505534 Mon Sep 17 00:00:00 2001
From: Michael Fladischer <FladischerMichael at fladi.at>
Date: Thu, 8 Oct 2015 13:53:15 -0700
-Subject: Split orientation test into pixel and EXIF comparison.
-
- Skip these tests if graphicsmagick or pgmagick is used as the engine. Both
+Subject: do not test EXIF orientation with graphicsmagick or pgmagick engine
+ Skip the assertion if graphicsmagick or pgmagick is used as the engine. Both
don't synchronize the EXIF orientation with the actual orientation of the
image.
-Last-Update: 2015-01-27
+Last-Update: 2016-10-05
Forwarded: no
-
Patch-Name: orientation.patch
---
- tests/thumbnail_tests/test_templatetags.py | 39 +++++++++++++++++++++++++++---
- 1 file changed, 36 insertions(+), 3 deletions(-)
-
-diff --git a/tests/thumbnail_tests/test_templatetags.py b/tests/thumbnail_tests/test_templatetags.py
-index c774dea..d545519 100644
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/tests/thumbnail_tests/test_templatetags.py
+++ b/tests/thumbnail_tests/test_templatetags.py
-@@ -1,6 +1,8 @@
- # -*- coding: utf-8 -*-
- import os
- import re
-+import shutil
-+import unittest
- from subprocess import Popen, PIPE
- from PIL import Image
-
-@@ -76,8 +78,10 @@ class TemplateTestCaseA(BaseTestCase):
- m = re.search('Interlace: None', str(p.stdout.read()))
- self.assertEqual(bool(m), True)
-
-- def test_orientation(self):
-- ref = Image.open(os.path.join(DATA_DIR, '1_topleft.jpg'))
-+ def test_orientation_pixels(self):
-+ data_dir = os.path.join(settings.MEDIA_ROOT, 'data_pixels')
-+ shutil.copytree(settings.DATA_ROOT, data_dir)
-+ ref = Image.open(os.path.join(data_dir, '1_topleft.jpg'))
- top = ref.getpixel((14, 7))
- left = ref.getpixel((7, 14))
- engine = PILEngine()
-@@ -101,16 +105,45 @@ class TemplateTestCaseA(BaseTestCase):
- )
-
- for name in data_images:
-- th = self.BACKEND.get_thumbnail('data/%s' % name, '30x30')
-+ th = self.BACKEND.get_thumbnail('data_pixels/%s' % name, '30x30')
- im = engine.get_image(th)
-
- self.assertLess(epsilon(top, im.getpixel((14, 7))), 10)
+@@ -108,6 +108,13 @@ class TemplateTestCaseA(BaseTestCase):
self.assertLess(epsilon(left, im.getpixel((7, 14))), 10)
-+
-+ shutil.rmtree(data_dir)
-+
-+ @unittest.skipIf(settings.THUMBNAIL_ENGINE in (
-+ "sorl.thumbnail.engines.pgmagick_engine.Engine",
-+ "sorl.thumbnail.engines.convert_engine.Engine",
-+ ),
-+ "graphicsmagick and pgmagick do not correct the orientation in the EXIF tag")
-+ def test_orientation_exif(self):
-+ data_dir = os.path.join(settings.MEDIA_ROOT, 'data_exif')
-+ shutil.copytree(settings.DATA_ROOT, data_dir)
-+ engine = PILEngine()
-+
-+ data_images = (
-+ '1_topleft.jpg',
-+ '2_topright.jpg',
-+ '3_bottomright.jpg',
-+ '4_bottomleft.jpg',
-+ '5_lefttop.jpg',
-+ '6_righttop.jpg',
-+ '7_rightbottom.jpg',
-+ '8_leftbottom.jpg'
-+ )
-+
-+ for name in sorted(os.listdir(data_dir)):
-+ th = self.BACKEND.get_thumbnail('data_exif/%s' % name, '30x30')
-+ im = engine.get_image(th)
exif = im._getexif()
++ if settings.THUMBNAIL_ENGINE == "sorl.thumbnail.engines.pgmagick_engine.Engine":
++ return
++
++ if settings.THUMBNAIL_ENGINE == "sorl.thumbnail.engines.convert_engine.Engine" \
++ and settings.THUMBNAIL_CONVERT == "gm convert":
++ return
++
if exif:
self.assertEqual(exif.get(0x0112), 1)
-+ shutil.rmtree(data_dir)
-+
-
- class TemplateTestCaseB(BaseTestCase):
- def test_url(self):
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/sorl-thumbnail.git
More information about the Python-modules-commits
mailing list