diff options
Diffstat (limited to 'tests/test_comp_image.py')
| -rw-r--r-- | tests/test_comp_image.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/tests/test_comp_image.py b/tests/test_comp_image.py index c580d5a..b221df4 100644 --- a/tests/test_comp_image.py +++ b/tests/test_comp_image.py @@ -1,3 +1,4 @@ +import os from avp.command import Command from pytestqt import qtbot from pytest import fixture @@ -5,6 +6,7 @@ from . import audioData, command, MockSignal, imageDataSum, getTestDataPath sampleSize = 1470 # 44100 / 30 = 1470 +testFile = "inputfiles/test.jpg" @fixture @@ -19,7 +21,7 @@ def coreWithImageComp(qtbot, command): def test_comp_image_set_path(coreWithImageComp): "Set imagePath of Image component" comp = coreWithImageComp.selectedComponents[0] - comp.imagePath = getTestDataPath("inputfiles/test.jpg") + comp.imagePath = getTestDataPath(testFile) image = comp.previewRender() assert imageDataSum(image) == 463711601 @@ -27,7 +29,7 @@ def test_comp_image_set_path(coreWithImageComp): def test_comp_image_scale_50_1080p(coreWithImageComp): """Image component stretches image to 50% at 1080p""" comp = coreWithImageComp.selectedComponents[0] - comp.imagePath = getTestDataPath("inputfiles/test.jpg") + comp.imagePath = getTestDataPath(testFile) image = comp.previewRender() sum = imageDataSum(image) comp.page.spinBox_scale.setValue(50) @@ -37,7 +39,7 @@ def test_comp_image_scale_50_1080p(coreWithImageComp): def test_comp_image_scale_50_720p(coreWithImageComp): """Image component stretches image to 50% at 720p""" comp = coreWithImageComp.selectedComponents[0] - comp.imagePath = getTestDataPath("inputfiles/test.jpg") + comp.imagePath = getTestDataPath(testFile) comp.page.spinBox_scale.setValue(50) image = comp.previewRender() sum = imageDataSum(image) @@ -47,3 +49,12 @@ def test_comp_image_scale_50_720p(coreWithImageComp): assert image.width == 1920 assert newImage.width == 1280 assert imageDataSum(comp.previewRender()) == sum + + +def test_comp_image_command_path(coreWithImageComp): + """Image component accepts commandline argument: + `path=test.jpg`""" + imgPath = os.path.realpath(getTestDataPath(testFile)) + comp = coreWithImageComp.selectedComponents[0] + comp.command(f"path={imgPath}") + assert comp.imagePath == imgPath |
