diff options
Diffstat (limited to 'solo-tool-project/test')
| -rw-r--r-- | solo-tool-project/test/notifier_unittest.py | 1 | ||||
| -rw-r--r-- | solo-tool-project/test/solo_tool_integrationtest.py | 34 | 
2 files changed, 35 insertions, 0 deletions
| diff --git a/solo-tool-project/test/notifier_unittest.py b/solo-tool-project/test/notifier_unittest.py index 115d21a..51d3e48 100644 --- a/solo-tool-project/test/notifier_unittest.py +++ b/solo-tool-project/test/notifier_unittest.py @@ -38,6 +38,7 @@ def test_allEvents(uut):      checkEvent(uut, Notifier.PLAYBACK_RATE_EVENT)      checkEvent(uut, Notifier.CURRENT_SONG_EVENT)      checkEvent(uut, Notifier.CURRENT_KEY_POINT_EVENT) +    checkEvent(uut, Notifier.KEY_POINTS_EVENT)  def test_eventWithoutRegisteredCallbacks(uut):      uut.notify(Notifier.PLAYING_STATE_EVENT, 0) diff --git a/solo-tool-project/test/solo_tool_integrationtest.py b/solo-tool-project/test/solo_tool_integrationtest.py index 2a55df9..3d7d20f 100644 --- a/solo-tool-project/test/solo_tool_integrationtest.py +++ b/solo-tool-project/test/solo_tool_integrationtest.py @@ -405,3 +405,37 @@ def test_currentKeyPointNotification(uut):      uut.keyPoint = 0.5      assert not called +def test_keyPointsNotification(uut): +    called = False +    receivedValue = None +    def callback(value): +        nonlocal called, receivedValue +        called = True +        receivedValue = value + +    uut.registerKeyPointsCallback(callback) +    assert not called + +    song = "test.flac" +    uut.addSong(song) +    uut.song = 0 +    assert not called + +    # Adding list of key points triggers a notification +    uut.keyPoints = [0.2, 0.4] +    assert called +    assert receivedValue == [0.2, 0.4] +    called = False + +    # Same list does trigger a notification again +    uut.keyPoints = [0.2, 0.4] +    assert called +    assert receivedValue == [0.2, 0.4] +    called = False + +    # Incrementing list of key points triggers a notification after sanitization +    uut.keyPoints += [0.2, None, 0.1] +    assert called +    assert receivedValue == [0.1, 0.2, 0.4] +    called = False + | 
