From f7480bb96323b8466ad8e097475db2a7135c88e0 Mon Sep 17 00:00:00 2001 From: Eddy Pedroni Date: Sat, 1 Jan 2022 19:09:01 +0100 Subject: Added next/previous AB limit functionality --- solo_tool_integrationtest.py | 44 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) (limited to 'solo_tool_integrationtest.py') diff --git a/solo_tool_integrationtest.py b/solo_tool_integrationtest.py index d0123d5..6022454 100644 --- a/solo_tool_integrationtest.py +++ b/solo_tool_integrationtest.py @@ -96,8 +96,8 @@ def test_addAndSetAbLimits(uut, mockPlayer): uut.addSong(song) uut.setSong(0) - uut.storeAbLimits(abLimits[0][0], abLimits[0][1]) - uut.storeAbLimits(abLimits[1][0], abLimits[1][1]) + for ab in abLimits: + uut.storeAbLimits(ab[0], ab[1]) mockPlayer.position = 0.0 uut.tick() @@ -206,6 +206,46 @@ def test_storeAbLimitsWithoutSong(uut, mockPlayer): uut.tick() assert mockPlayer.position == abLimit[0] +def test_nextAndPreviousAbLimit(uut, mockPlayer): + song = "test.flac" + abLimits = [ + [0.2, 0.4], + [0.1, 0.3] + ] + + def checkLimit(aLimit, bLimit): + mockPlayer.position = bLimit - 0.1 + uut.tick() + assert mockPlayer.position == bLimit - 0.1 + + mockPlayer.position = bLimit + 0.1 + uut.tick() + assert mockPlayer.position == aLimit + + uut.addSong(song) + uut.setSong(0) + uut.setAbLimitEnable(True) + + for ab in abLimits: + uut.storeAbLimits(ab[0], ab[1]) + + checkLimit(0.0, 0.0) # default limits + + uut.nextStoredAbLimits() + checkLimit(abLimits[0][0], abLimits[0][1]) + + uut.nextStoredAbLimits() + checkLimit(abLimits[1][0], abLimits[1][1]) + + uut.nextStoredAbLimits() + checkLimit(abLimits[1][0], abLimits[1][1]) + + uut.previousStoredAbLimits() + checkLimit(abLimits[0][0], abLimits[0][1]) + + uut.previousStoredAbLimits() + checkLimit(abLimits[0][0], abLimits[0][1]) + def test_loadAndSaveSession(prepared_tmp_path): mockPlayer = MockPlayer() uut = SoloTool(mockPlayer) -- cgit v1.2.3