Add test case on TestSceneNowPlayingOverlay

This commit is contained in:
Ganendra Afrasya
2019-10-11 01:24:03 +07:00
parent d7fc904381
commit b07c477aad

View File

@ -5,6 +5,7 @@ using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Overlays;
namespace osu.Game.Tests.Visual.UserInterface
@ -15,6 +16,8 @@ namespace osu.Game.Tests.Visual.UserInterface
[Cached]
private MusicController musicController = new MusicController();
private WorkingBeatmap currentTrack;
public TestSceneNowPlayingOverlay()
{
Clock = new FramedClock();
@ -30,7 +33,25 @@ namespace osu.Game.Tests.Visual.UserInterface
AddStep(@"show", () => np.Show());
AddToggleStep(@"toggle beatmap lock", state => Beatmap.Disabled = state);
AddStep(@"show", () => np.Hide());
AddStep(@"hide", () => np.Hide());
}
[Test]
public void TestPrevTrackBehavior()
{
AddStep(@"Play track", () =>
{
musicController.NextTrack();
currentTrack = Beatmap.Value;
});
AddStep(@"Seek track to 6 second", () => musicController.SeekTo(6000));
AddStep(@"Call PrevTrack", () => musicController.PrevTrack());
AddAssert(@"Check if it restarted", () => currentTrack == Beatmap.Value);
AddStep(@"Seek track to 1 second", () => musicController.SeekTo(1000));
AddStep(@"Call PrevTrack", () => musicController.PrevTrack());
AddAssert(@"Check if it changed to prev track'", () => currentTrack != Beatmap.Value);
}
}
}