aboutsummaryrefslogtreecommitdiff
path: root/tests/test_text_comp.py
blob: 23dd1fdab6ced54b0c51a5b800ec08341e580011 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from avp.command import Command
from PyQt6.QtGui import QFont
from pytestqt import qtbot
from pytest import fixture
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 test_comp_text_renderFrame_resize(coreWithTextComp):
    """Call renderFrame of Title Text component added to Command object."""
    comp = coreWithTextComp.selectedComponents[0]
    comp.parent.settings.setValue("outputWidth", 1920)
    comp.parent.settings.setValue("outputHeight", 1080)
    comp.parent.core.updateComponent(0)
    comp.titleFont = QFont("Noto Sans")
    image = comp.frameRender(0)
    assert imageDataSum(image) == 2957069


def test_comp_text_renderFrame(coreWithTextComp):
    """Call renderFrame of Title Text component added to Command object."""
    comp = coreWithTextComp.selectedComponents[0]
    comp.parent.settings.setValue("outputWidth", 1280)
    comp.parent.settings.setValue("outputHeight", 720)
    comp.parent.core.updateComponent(0)
    image = comp.frameRender(0)
    assert imageDataSum(image) == 1412293 or 1379298