From 91cbf23d3acc3e44b333cac95d45575bc7bacb1c Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Mon, 3 Jan 2022 18:49:09 +0100 Subject: Added basic event notification capabilities, first event --- solo_tool_integrationtest.py | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'solo_tool_integrationtest.py') diff --git a/solo_tool_integrationtest.py b/solo_tool_integrationtest.py index 6022454..117e539 100644 --- a/solo_tool_integrationtest.py +++ b/solo_tool_integrationtest.py @@ -311,7 +311,6 @@ def test_setTemporaryLimits(uut, mockPlayer): assert mockPlayer.position == abLimits[1][0] def test_jumpToA(uut, mockPlayer): - song = "test.flac" abLimits = (0.2, 0.4) initialPosition = 0.8 @@ -324,3 +323,39 @@ def test_jumpToA(uut, mockPlayer): uut.jumpToA() assert mockPlayer.position == abLimits[0] +def test_playingStateNotification(uut, mockPlayer): + song = "test.flac" + uut.addSong(song) + uut.setSong(0) + + called = False + def callback(): + nonlocal called + called = True + + uut.registerPlayingStateCallback(callback) + + assert mockPlayer.state == MockPlayer.STOPPED + assert not called + + uut.play() + assert called + called = False + uut.play() + assert not called + + uut.pause() + assert called + called = False + uut.pause() + assert not called + + uut.play() + assert called + called = False + + uut.stop() + assert called + called = False + uut.stop() + assert not called -- cgit v1.2.3