From bf232d2f3fa94f374d82464eb66bcc7d72adc3ed Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Sun, 26 Dec 2021 23:05:46 +0100 Subject: Added temporary AB limit functionality to back end --- solo_tool_integrationtest.py | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'solo_tool_integrationtest.py') diff --git a/solo_tool_integrationtest.py b/solo_tool_integrationtest.py index 9321e89..cd635d4 100644 --- a/solo_tool_integrationtest.py +++ b/solo_tool_integrationtest.py @@ -107,7 +107,7 @@ def test_addAndSetAbLimits(): uut.tick() assert mockPlayer.position == 0.5 - uut.setAbLimit(0) + uut.loadAbLimits(0) uut.tick() assert mockPlayer.position == 0.5 @@ -120,7 +120,7 @@ def test_addAndSetAbLimits(): uut.tick() assert mockPlayer.position == 0.2 - uut.setAbLimit(1) + uut.loadAbLimits(1) uut.tick() assert mockPlayer.position == 0.2 @@ -151,7 +151,7 @@ def test_multipleSongsAndAbLimits(): for i, l in enumerate(abLimits): uut.setSong(i) - uut.setAbLimit(0) + uut.loadAbLimits(0) mockPlayer.position = l[0] uut.tick() @@ -176,7 +176,7 @@ def test_storeAbLimitsWithoutSong(): assert mockPlayer.position == default mockPlayer.position = overflow - uut.setAbLimit(0) + uut.loadAbLimits(0) uut.tick() assert mockPlayer.position == default mockPlayer.position = overflow @@ -186,7 +186,7 @@ def test_storeAbLimitsWithoutSong(): assert mockPlayer.position == default mockPlayer.position = overflow - uut.setAbLimit(0) + uut.loadAbLimits(0) uut.tick() assert mockPlayer.position == default mockPlayer.position = overflow @@ -196,7 +196,7 @@ def test_storeAbLimitsWithoutSong(): assert mockPlayer.position == default mockPlayer.position = overflow - uut.setAbLimit(0) + uut.loadAbLimits(0) uut.tick() assert mockPlayer.position == default mockPlayer.position = overflow @@ -206,7 +206,7 @@ def test_storeAbLimitsWithoutSong(): assert mockPlayer.position == default mockPlayer.position = overflow - uut.setAbLimit(0) + uut.loadAbLimits(0) uut.tick() assert mockPlayer.position == abLimit[0] @@ -270,4 +270,24 @@ def test_getters(): mockPlayer.position = 0.8 assert uut.getPlaybackPosition() == 0.8 - +def test_setTemporaryLimits(): + song = "test.flac" + abLimits = [ + [0.2, 0.4], + [0.1, 0.4] + ] + overflow = 0.5 + mockPlayer = MockPlayer() + uut = SoloTool(mockPlayer) + + uut.setAbLimitEnable(True) + mockPlayer.position = overflow + uut.addSong(song) + uut.setSong(0) + uut.storeAbLimits(abLimits[0][0], abLimits[0][1]) + uut.loadAbLimits(0) + + uut.setAbLimits(abLimits[1][0], abLimits[1][1]) + uut.tick() + assert mockPlayer.position == abLimits[1][0] + -- cgit v1.2.3