summaryrefslogtreecommitdiff
path: root/tests/regressiontests/file_storage/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/regressiontests/file_storage/tests.py')
-rw-r--r--tests/regressiontests/file_storage/tests.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/regressiontests/file_storage/tests.py b/tests/regressiontests/file_storage/tests.py
index 2c5f0f4551..a1470f9f05 100644
--- a/tests/regressiontests/file_storage/tests.py
+++ b/tests/regressiontests/file_storage/tests.py
@@ -230,3 +230,19 @@ if Image is not None:
finally:
del images.open
self.assert_(FileWrapper._closed)
+
+ class InconsistentGetImageDimensionsBug(TestCase):
+ """
+ Test that get_image_dimensions() works properly after various calls using a file handler (#11158)
+ """
+ def test_multiple_calls(self):
+ """
+ Multiple calls of get_image_dimensions() should return the same size.
+ """
+ from django.core.files.images import ImageFile
+ img_path = os.path.join(os.path.dirname(__file__), "test.png")
+ image = ImageFile(open(img_path))
+ image_pil = Image.open(img_path)
+ size_1, size_2 = get_image_dimensions(image), get_image_dimensions(image)
+ self.assertEqual(image_pil.size, size_1)
+ self.assertEqual(size_1, size_2)