Replace example ogv file to avoid issues with ffmpeg

This commit is contained in:
Simon Conseil
2023-04-20 20:07:12 +02:00
parent eec4c3fd02
commit 0923a56a56
3 changed files with 5 additions and 22 deletions

View File

@@ -50,5 +50,5 @@ tests:
``should_be_ignored.jpg`` : from the apollo 7 mission, public domain:
https://www.flickr.com/photos/projectapolloarchive/21756099278/in/album-72157657129869694/
(https://github.com/saimn/sigal/pull/233#issuecomment-275430083)
- ``example video.ogv`` : https://commons.wikimedia.org/wiki/File:I-15bis.ogv
(GFDL)
- ``example video.ogv`` : https://commons.wikimedia.org/wiki/File:Examplevideo.ogv
(Public domain)

View File

@@ -16,7 +16,7 @@ SRCFILE = os.path.join(SRCDIR, "video", TEST_VIDEO)
def test_video_size():
size_src = video_size(SRCFILE)
assert size_src == (320, 240)
assert size_src == (240, 98)
size_src = video_size("missing/file.mp4")
assert size_src == (0, 0)
@@ -65,29 +65,12 @@ def test_metadata(tmpdir):
@pytest.mark.parametrize("fmt", ["webm", "mp4"])
def test_generate_video_fit_height(tmpdir, fmt):
"""largest fitting dimension is height"""
base, ext = os.path.splitext(TEST_VIDEO)
dstfile = str(tmpdir.join(base + "." + fmt))
settings = create_settings(video_size=(80, 100), video_format=fmt)
generate_video(SRCFILE, dstfile, settings)
size_src = video_size(SRCFILE)
size_dst = video_size(dstfile)
assert size_dst[0] == 80
# less than 2% error on ratio
assert abs(size_dst[0] / size_dst[1] - size_src[0] / size_src[1]) < 2e-2
@pytest.mark.parametrize("fmt", ["webm", "mp4"])
def test_generate_video_fit_width(tmpdir, fmt):
def test_generate_video_fit(tmpdir, fmt):
"""largest fitting dimension is width"""
base, ext = os.path.splitext(TEST_VIDEO)
dstfile = str(tmpdir.join(base + "." + fmt))
settings = create_settings(video_size=(100, 50), video_format=fmt)
settings = create_settings(video_size=(125, 50), video_format=fmt)
generate_video(SRCFILE, dstfile, settings)
size_src = video_size(SRCFILE)