From 6bdde28f33b3e27349731291ee94c043ec238e4d Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Tue, 21 Dec 2021 22:56:14 +0100 Subject: AB controller integration test added --- solo_tool_integrationtest.py | 48 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 39 insertions(+), 9 deletions(-) (limited to 'solo_tool_integrationtest.py') diff --git a/solo_tool_integrationtest.py b/solo_tool_integrationtest.py index 561778b..b3a0978 100644 --- a/solo_tool_integrationtest.py +++ b/solo_tool_integrationtest.py @@ -43,15 +43,6 @@ class MockPlayer(): def setCurrentSong(self, path): self.currentSong = path -def test_addAndSetSong(): - song = "/path/to/song" - mockPlayer = MockPlayer() - - uut = SoloTool(mockPlayer) - - uut.addSong(song) - uut.setSong(0) - def test_playerControls(): mockPlayer = MockPlayer() uut = SoloTool(mockPlayer) @@ -75,3 +66,42 @@ def test_playerControls(): assert mockPlayer.volume == 1.0 uut.setPlaybackVolume(0.5) assert mockPlayer.volume == 0.5 + +def test_addAndSetSong(): + song = "test.flac" + mockPlayer = MockPlayer() + uut = SoloTool(mockPlayer) + + uut.addSong(song) + assert mockPlayer.currentSong == "" + + uut.setSong(0) + assert mockPlayer.currentSong == song + +def test_addAndSetAbLimit(): + song = "test.flac" + abLimit = [0.2, 0.4] + mockPlayer = MockPlayer() + uut = SoloTool(mockPlayer) + + uut.addSong(song) + uut.setSong(0) + + uut.addAbLimit(abLimit[0], abLimit[1]) + + mockPlayer.position = 0.0 + uut.tick() + assert mockPlayer.position == 0.0 + + mockPlayer.position = 0.5 + uut.tick() + assert mockPlayer.position == 0.5 + + uut.setAbLimit(0) + + uut.tick() + assert mockPlayer.position == 0.2 + + uut.tick() + assert mockPlayer.position == 0.2 + -- cgit v1.2.3