|
@@ 175-187 (lines=13) @@
|
| 172 |
|
thumbnail_path = os.path.join(IMG_DIR, 'image.progressive.png') |
| 173 |
|
assert not os.path.exists(thumbnail_path) |
| 174 |
|
|
| 175 |
|
def test_progressive_jpeg_from_gif(self): |
| 176 |
|
source_file = os.path.join(FIXTURE_DIR, '600x400.gif') |
| 177 |
|
target_file = os.path.join(IMG_DIR, 'image.progressive.jpg') |
| 178 |
|
os.mkdir(IMG_DIR) |
| 179 |
|
shutil.copyfile(source_file, target_file) |
| 180 |
|
ProgressiveJpegModel.objects.create( |
| 181 |
|
image=self.fixtures['600x400.gif'] |
| 182 |
|
) |
| 183 |
|
thumbnail_path = os.path.join(IMG_DIR, 'image.progressive.jpg') |
| 184 |
|
assert os.path.exists(thumbnail_path) |
| 185 |
|
|
| 186 |
|
thumbnail_path = os.path.join(IMG_DIR, 'image.progressive.gif') |
| 187 |
|
assert not os.path.exists(thumbnail_path) |
| 188 |
|
|
| 189 |
|
def test_thumbnail_save_without_directory(self): |
| 190 |
|
obj = ThumbnailWithoutDirectoryModel.objects.create( |
|
@@ 161-173 (lines=13) @@
|
| 158 |
|
thumbnail_path = os.path.join(IMG_DIR, 'image.progressive.jpg') |
| 159 |
|
assert os.path.exists(thumbnail_path) |
| 160 |
|
|
| 161 |
|
def test_progressive_jpeg_from_png(self): |
| 162 |
|
source_file = os.path.join(FIXTURE_DIR, '600x400.png') |
| 163 |
|
target_file = os.path.join(IMG_DIR, 'image.progressive.jpg') |
| 164 |
|
os.mkdir(IMG_DIR) |
| 165 |
|
shutil.copyfile(source_file, target_file) |
| 166 |
|
ProgressiveJpegModel.objects.create( |
| 167 |
|
image=self.fixtures['600x400.png'] |
| 168 |
|
) |
| 169 |
|
thumbnail_path = os.path.join(IMG_DIR, 'image.progressive.jpg') |
| 170 |
|
assert os.path.exists(thumbnail_path) |
| 171 |
|
|
| 172 |
|
thumbnail_path = os.path.join(IMG_DIR, 'image.progressive.png') |
| 173 |
|
assert not os.path.exists(thumbnail_path) |
| 174 |
|
|
| 175 |
|
def test_progressive_jpeg_from_gif(self): |
| 176 |
|
source_file = os.path.join(FIXTURE_DIR, '600x400.gif') |
|
@@ 118-129 (lines=12) @@
|
| 115 |
|
self.assertEqual(instance.image.thumbnail.width, 150) |
| 116 |
|
self.assertEqual(instance.image.thumbnail.height, 150) |
| 117 |
|
|
| 118 |
|
def test_variations_override(self): |
| 119 |
|
source_file = os.path.join(FIXTURE_DIR, '600x400.jpg') |
| 120 |
|
target_file = os.path.join(IMG_DIR, 'image.thumbnail.jpg') |
| 121 |
|
os.mkdir(IMG_DIR) |
| 122 |
|
shutil.copyfile(source_file, target_file) |
| 123 |
|
ResizeModel.objects.create( |
| 124 |
|
image=self.fixtures['600x400.jpg'] |
| 125 |
|
) |
| 126 |
|
thumbnail_path = os.path.join(IMG_DIR, 'image.thumbnail.jpg') |
| 127 |
|
assert os.path.exists(thumbnail_path) |
| 128 |
|
thumbnail_path = os.path.join(IMG_DIR, 'image.thumbnail_1.jpg') |
| 129 |
|
assert not os.path.exists(thumbnail_path) |
| 130 |
|
|
| 131 |
|
def test_delete_thumbnail(self): |
| 132 |
|
"""Delete an image with thumbnail""" |