From a12be862e22bdec6a243a3f0b5f4f28d69084a2a Mon Sep 17 00:00:00 2001 From: Brianna Rainey Date: Thu, 22 Jan 2026 16:29:46 -0500 Subject: fix #89 with Image component v2.0 + 23 tests (#90) * qtbot is needed in any test that uses a QObject previously these tests would fail if they ran before qtbot was initialized by another test. I'm now running tests in a random order * add tests for drawBars, readAudioFile, BlankFrame * replace numpy.seterr with numpy.errstate * fix incorrect comment * add MockVideoWorker and imageDataSum * test further into visualization (less likely to be a false positive) * test FloodFrame function * add failing test for Image component one step towards fixing #89 * test component name CLI parsing * prevent log warning when 1 setting changed * correct tests to use widgets when needed * test undo and blockSignals * remove stretch_scale (use scale only) * image ignores scale if stretch checkbox checked fixes #89 * test Title Text component, ffmpeg command * Image v2: replace stretched setting with resizeMode 3 resize modes are scale, cover, and stretch. Scale only applies when resizeMode is set to scale. Cover uses ImageOps.fit() to stretch while maintaining aspect ratio. Also, spinBox_scale was moved to be underneath comboBox_resizeMode. * change transformData into staticmethod the purpose is to allow easier reuse in other components * add respondToAudio option to Image component this causes the image to scale up and down slightly based on the input audio file * cache static portion of image when animating increases rendering speed of a 1-minute video by 12 seconds (based on two manual tests anyway)--- tests/test_toolkit_ffmpeg.py | 64 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 tests/test_toolkit_ffmpeg.py (limited to 'tests/test_toolkit_ffmpeg.py') diff --git a/tests/test_toolkit_ffmpeg.py b/tests/test_toolkit_ffmpeg.py new file mode 100644 index 0000000..b015470 --- /dev/null +++ b/tests/test_toolkit_ffmpeg.py @@ -0,0 +1,64 @@ +import pytest +from avp.command import Command +from avp.toolkit.ffmpeg import createFfmpegCommand +from . import audioData + + +def test_readAudioFile_data(audioData): + assert len(audioData[0]) == 218453 + + +def test_readAudioFile_duration(audioData): + assert audioData[1] == 3.95 + + +@pytest.mark.parametrize("width, height", ((1920, 1080), (1280, 720))) +def test_createFfmpegCommand(width, height): + command = Command() + command.settings.setValue("outputWidth", width) + command.settings.setValue("outputHeight", height) + ffmpegCmd = createFfmpegCommand("test.ogg", "/tmp", command.core.selectedComponents) + assert ffmpegCmd == [ + "ffmpeg", + "-thread_queue_size", + "512", + "-y", + "-f", + "rawvideo", + "-vcodec", + "rawvideo", + "-s", + "%sx%s" % (width, height), + "-pix_fmt", + "rgba", + "-r", + "30", + "-t", + "0.100", + "-an", + "-i", + "-", + "-t", + "0.100", + "-i", + "test.ogg", + "-map", + "0:v", + "-map", + "1:a", + "-vcodec", + "libx264", + "-acodec", + "aac", + "-b:v", + "2500k", + "-b:a", + "192k", + "-pix_fmt", + "yuv420p", + "-preset", + "medium", + "-f", + "mp4", + "/tmp", + ] -- cgit v1.2.3