mirror of
https://github.com/beetbox/beets.git
synced 2026-01-02 14:03:12 +01:00
Add tests to check deinterlace functionality.
This commit is contained in:
parent
cf31dbf6da
commit
c6e05e8ab7
1 changed files with 42 additions and 1 deletions
|
|
@ -23,12 +23,15 @@ import os
|
|||
|
||||
from test import _common
|
||||
from test.helper import TestHelper
|
||||
from beets.util import syspath
|
||||
from beets.util import command_output, syspath
|
||||
from beets.util.artresizer import (
|
||||
pil_resize,
|
||||
im_resize,
|
||||
get_im_version,
|
||||
get_pil_version,
|
||||
pil_deinterlace,
|
||||
im_deinterlace,
|
||||
ArtResizer,
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -90,6 +93,18 @@ class ArtResizerFileSizeTest(_common.TestCase, TestHelper):
|
|||
self.assertLess(os.stat(syspath(im_b)).st_size,
|
||||
os.stat(syspath(im_75_qual)).st_size)
|
||||
|
||||
# check if new deinterlace parameter breaks resize
|
||||
im_di = resize_func(
|
||||
225,
|
||||
self.IMG_225x225,
|
||||
quality=95,
|
||||
max_filesize=0,
|
||||
deinterlace=True,
|
||||
)
|
||||
# check valid path returned - deinterlace hasn't broken resize command
|
||||
self.assertExists(im_di)
|
||||
|
||||
|
||||
@unittest.skipUnless(get_pil_version(), "PIL not available")
|
||||
def test_pil_file_resize(self):
|
||||
"""Test PIL resize function is lowering file size."""
|
||||
|
|
@ -100,6 +115,32 @@ class ArtResizerFileSizeTest(_common.TestCase, TestHelper):
|
|||
"""Test IM resize function is lowering file size."""
|
||||
self._test_img_resize(im_resize)
|
||||
|
||||
@unittest.skipUnless(get_pil_version(), "PIL not available")
|
||||
def test_pil_file_deinterlace(self):
|
||||
"""Test PIL deinterlace function.
|
||||
|
||||
Check if pil_deinterlace function returns images
|
||||
that are non-progressive
|
||||
"""
|
||||
path = pil_deinterlace(self.IMG_225x225)
|
||||
from PIL import Image
|
||||
with Image.open(path) as img:
|
||||
self.assertFalse('progression' in img.info)
|
||||
|
||||
@unittest.skipUnless(get_im_version(), "ImageMagick not available")
|
||||
def test_im_file_deinterlace(self):
|
||||
"""Test ImageMagick deinterlace function.
|
||||
|
||||
Check if im_deinterlace function returns images
|
||||
that are non-progressive.
|
||||
"""
|
||||
path = im_deinterlace(self.IMG_225x225)
|
||||
cmd = ArtResizer.shared.im_identify_cmd + [
|
||||
'-format', '%[interlace]', syspath(path, prefix=False),
|
||||
]
|
||||
out = command_output(cmd).stdout
|
||||
self.assertTrue(out == b'None')
|
||||
|
||||
|
||||
def suite():
|
||||
"""Run this suite of tests."""
|
||||
|
|
|
|||
Loading…
Reference in a new issue