File: test_comp_spectrum.py

package info (click to toggle)
audio-visualizer-python 2.2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 948 kB
  • sloc: python: 6,683; sh: 15; makefile: 10
file content (37 lines) | stat: -rw-r--r-- 1,107 bytes parent folder | download
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
35
36
37
import platform
import pytest
from avp.command import Command
from pytestqt import qtbot
from . import (
    imageDataSum,
    command,
    preFrameRender,
    audioData,
)


@pytest.fixture
def coreWithSpectrumComp(qtbot, command):
    """Fixture providing a Command object with Spectrum component added"""
    command.settings.setValue("outputHeight", 1080)
    command.settings.setValue("outputWidth", 1920)
    command.core.insertComponent(0, command.core.moduleIndexFor("Spectrum"), command)
    yield command.core


@pytest.mark.skipif(
    platform.machine() == 'i386' or platform.machine() == 'i686',
    reason="Skipping test on i386 architecture"
)
def test_comp_spectrum_previewRender(coreWithSpectrumComp):
    comp = coreWithSpectrumComp.selectedComponents[0]
    image = comp.previewRender()
    assert imageDataSum(image) == 71992628


def test_comp_spectrum_renderFrame(coreWithSpectrumComp, audioData):
    comp = coreWithSpectrumComp.selectedComponents[0]
    preFrameRender(audioData, comp)
    image = comp.frameRender(0)
    comp.postFrameRender()
    assert imageDataSum(image) == 117