mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Add test case on TestSceneNowPlayingOverlay
This commit is contained in:
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user