aboutsummaryrefslogtreecommitdiff
path: root/tests/test_comp_text.py
diff options
context:
space:
mode:
authorBrianna Rainey2026-01-28 17:49:58 -0500
committerGitHub2026-01-28 17:49:58 -0500
commitf66eb99465c61232a7f649e66bee59504bb0e52c (patch)
tree40d4f2e4e7cea033e4a68da025c7d91295e71cfb /tests/test_comp_text.py
parent864898419e810055b51e3a32fccb00a62aab9a6b (diff)
v2.2.1 - fix #74, fix #92, add optional 64th bar to Classic Visualizer, improve Conway default (#93)
* update gitignore ignore profiling and coverage data * F1 opens help window, create appName variable, move undostack class * fix kaleidoscope effect, increase default Y values by +4 the increased y values allow the cells to continue animating for more than 60 minutes instead of 30 (at default 60f/t) * update version number * add minimumWidth to undo history window * Classic Visualizer: option to include 64th bar * Waveform component: fix #74 - new animation speed option * move shared visualizer code into toolkit * Waveform component: compress audio by default * Waveform component: fix 100% animation speed * new components receive random color * update to Qt 6 * fix pushbutton stylesheet * fix #92: replace ok/cancel with save/discard/cancel * remove obsolete PaintColor subclass * mv common shadow code into addShadow func * add 3rd option of ok/cancel back to showMessage the 3 options are: - ok - ok/cancel - save/discard/cancel * Image component: add shadow option * small test of rgbFromString * fix color tuple string * test another way to get comp names from CLI * rename component tests, add some more * Image component: scale shadow based on resolution * catch AttributeError if previewRender returns None * Text component: fix blur radius only able to increase the relativeWidgets system causes QDoubleSpinbox to only allow increases, because it really only works with integeres, so I changed the blur radius into a normal QSpinBox. I noted where the problem exists within component.py for future reference. This commit also removes an unneeded VerticalLayout from the ui file * remove unnecessary QVBoxLayout * paste shadow at x,y instead of using offset method * fix tests due to shadow change * don't print warning in connectWidget due to QFontComboBox
Diffstat (limited to 'tests/test_comp_text.py')
-rw-r--r--tests/test_comp_text.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/test_comp_text.py b/tests/test_comp_text.py
new file mode 100644
index 0000000..e389ff9
--- /dev/null
+++ b/tests/test_comp_text.py
@@ -0,0 +1,45 @@
+from avp.command import Command
+from PyQt6.QtGui import QFont
+from pytestqt import qtbot
+from pytest import fixture, mark
+from . import audioData, MockSignal, imageDataSum
+
+
+@fixture
+def coreWithTextComp(qtbot):
+ """Fixture providing a Command object with Title Text component added"""
+ command = Command()
+ command.core.insertComponent(0, command.core.moduleIndexFor("Title Text"), command)
+ yield command.core
+
+
+def setTextSettings(comp):
+ comp.page.spinBox_fontSize.setValue(40)
+ comp.page.checkBox_shadow.setChecked(True)
+ comp.page.spinBox_shadBlur.setValue(0)
+ comp.page.spinBox_shadX.setValue(2)
+ comp.page.spinBox_shadY.setValue(-2)
+ comp.page.fontComboBox_titleFont.setCurrentFont(QFont("Noto Sans"))
+ comp.page.lineEdit_textColor.setText("255,255,255")
+
+
+@mark.parametrize(
+ "width, height",
+ ((1920, 1080), (1280, 720)),
+)
+def test_comp_text_renderFrame(coreWithTextComp, width, height):
+ """Call renderFrame of Title Text component added to Command object."""
+ comp = coreWithTextComp.selectedComponents[0]
+ comp.parent.settings.setValue("outputWidth", width)
+ comp.parent.settings.setValue("outputHeight", height)
+ setTextSettings(comp)
+ comp.centerXY()
+ image = comp.frameRender(0)
+ assert comp.titleFont.family() == "Noto Sans"
+ assert comp.xPosition == width / 2
+ assert image.width == width
+ assert comp.fontSize == 40
+ assert comp.shadX == 2
+ assert comp.shadY == -2
+ assert comp.shadBlur == 0
+ assert imageDataSum(image) == 727403 or 738586