aboutsummaryrefslogtreecommitdiffstats
path: root/solo-tool-project/test/handlers_integrationtest.py
blob: 85050d63a729cbb2bc5c93c59af31769a05af3fd (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
import pytest

from fixtures import soloTool, testSongs, mockPlayer, songPool

from solo_tool.handlers import keyPointRelative

testCases = [
    ([0.1, 0.3], 0.0, +1, 0.1, "Start +1"),
    ([0.1, 0.3], 0.1, +1, 0.3, "First +1"),
    ([0.1, 0.3], 0.2, +1, 0.3, "Between +1"),
    ([0.1, 0.3], 0.3, +1, 0.3, "Second +1"),
    ([0.1, 0.3], 0.4, +1, 0.4, "End +1"),

    ([0.1, 0.3], 0.0, -1, 0.0, "Start -1"),
    ([0.1, 0.3], 0.1, -1, 0.1, "First -1"),
    ([0.1, 0.3], 0.2, -1, 0.1, "Between -1"),
    ([0.1, 0.3], 0.3, -1, 0.1, "Second -1"),
    ([0.1, 0.3], 0.4, -1, 0.3, "End -1"),

    ([0.0, 0.3], 0.0, -1, 0.0, "0.0 -1"),
]

@pytest.mark.parametrize("keyPoints,current,delta,expected,description", testCases)
def test_keyPointRelativeEdgeCases(soloTool, testSongs, keyPoints, current, delta, expected, description):
    soloTool.addSong(testSongs[0])
    soloTool.keyPoints = keyPoints
    soloTool.keyPoint = current

    handler = keyPointRelative(soloTool, delta)
    handler()

    assert soloTool.keyPoint == expected, description