1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-21 08:52:54 +08:00

Add a function for loading a list of breaks

This commit is contained in:
iiSaLMaN 2019-07-28 05:21:27 +03:00
parent 95b568eb46
commit 4d49b38277

View File

@ -63,9 +63,8 @@ namespace osu.Game.Tests.Visual.Gameplay
var shortBreak = new BreakPeriod { EndTime = 500 }; var shortBreak = new BreakPeriod { EndTime = 500 };
loadClockStep(true); loadClockStep(true);
AddStep("start short break", () => manualBreakOverlay.Breaks = new[] { shortBreak }); loadBreaksStep("short break", new[] { shortBreak });
seekBreakStep("seek back to 0", 0, false);
addBreakSeeks(shortBreak, false); addBreakSeeks(shortBreak, false);
} }
@ -73,9 +72,8 @@ namespace osu.Game.Tests.Visual.Gameplay
public void TestMultipleBreaks() public void TestMultipleBreaks()
{ {
loadClockStep(true); loadClockStep(true);
AddStep("start multiple breaks", () => manualBreakOverlay.Breaks = testBreaks); loadBreaksStep("multiple breaks", testBreaks);
seekBreakStep("seek back to 0", 0, false);
foreach (var b in testBreaks) foreach (var b in testBreaks)
addBreakSeeks(b, false); addBreakSeeks(b, false);
} }
@ -84,9 +82,8 @@ namespace osu.Game.Tests.Visual.Gameplay
public void TestRewindBreaks() public void TestRewindBreaks()
{ {
loadClockStep(true); loadClockStep(true);
AddStep("start multiple breaks in rewind", () => manualBreakOverlay.Breaks = testBreaks); loadBreaksStep("multiple breaks", testBreaks);
seekBreakStep("seek back to 0", 0, false);
foreach (var b in testBreaks.Reverse()) foreach (var b in testBreaks.Reverse())
addBreakSeeks(b, true); addBreakSeeks(b, true);
} }
@ -95,10 +92,9 @@ namespace osu.Game.Tests.Visual.Gameplay
public void TestSkipBreaks() public void TestSkipBreaks()
{ {
loadClockStep(true); loadClockStep(true);
AddStep("start multiple breaks with skipping", () => manualBreakOverlay.Breaks = testBreaks); loadBreaksStep("multiple breaks", testBreaks);
var b = testBreaks.Last(); var b = testBreaks.Last();
seekBreakStep("seek back to 0", 0, false);
addBreakSeeks(b, false); addBreakSeeks(b, false);
} }
@ -123,6 +119,12 @@ namespace osu.Game.Tests.Visual.Gameplay
}); });
} }
private void loadBreaksStep(string breakDescription, IReadOnlyList<BreakPeriod> breaks)
{
AddStep($"load {breakDescription}", () => manualBreakOverlay.Breaks = breaks);
seekBreakStep("seek back to 0", 0, false);
}
private void addBreakSeeks(BreakPeriod b, bool isReversed) private void addBreakSeeks(BreakPeriod b, bool isReversed)
{ {
if (isReversed) if (isReversed)