mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 18:07:27 +09:00
Add test coverage
This commit is contained in:
parent
d7742766d0
commit
c36d9d4fc3
@ -17,11 +17,12 @@ using osu.Game.Rulesets;
|
|||||||
using osu.Game.Screens.Select;
|
using osu.Game.Screens.Select;
|
||||||
using osu.Game.Screens.Select.Carousel;
|
using osu.Game.Screens.Select.Carousel;
|
||||||
using osu.Game.Screens.Select.Filter;
|
using osu.Game.Screens.Select.Filter;
|
||||||
|
using osuTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.SongSelect
|
namespace osu.Game.Tests.Visual.SongSelect
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestSceneBeatmapCarousel : OsuTestScene
|
public class TestSceneBeatmapCarousel : OsuManualInputManagerTestScene
|
||||||
{
|
{
|
||||||
private TestBeatmapCarousel carousel;
|
private TestBeatmapCarousel carousel;
|
||||||
private RulesetStore rulesets;
|
private RulesetStore rulesets;
|
||||||
@ -39,6 +40,43 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
this.rulesets = rulesets;
|
this.rulesets = rulesets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestKeyRepeat()
|
||||||
|
{
|
||||||
|
loadBeatmaps();
|
||||||
|
advanceSelection(false);
|
||||||
|
|
||||||
|
AddStep("press down arrow", () => InputManager.PressKey(Key.Down));
|
||||||
|
|
||||||
|
BeatmapInfo selection = null;
|
||||||
|
|
||||||
|
checkSelectionIterating(true);
|
||||||
|
|
||||||
|
AddStep("press up arrow", () => InputManager.PressKey(Key.Up));
|
||||||
|
|
||||||
|
checkSelectionIterating(true);
|
||||||
|
|
||||||
|
AddStep("release down arrow", () => InputManager.ReleaseKey(Key.Down));
|
||||||
|
|
||||||
|
checkSelectionIterating(true);
|
||||||
|
|
||||||
|
AddStep("release up arrow", () => InputManager.ReleaseKey(Key.Up));
|
||||||
|
|
||||||
|
checkSelectionIterating(false);
|
||||||
|
|
||||||
|
void checkSelectionIterating(bool isIterating)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
AddStep("store selection", () => selection = carousel.SelectedBeatmap);
|
||||||
|
if (isIterating)
|
||||||
|
AddUntilStep("selection changed", () => carousel.SelectedBeatmap != selection);
|
||||||
|
else
|
||||||
|
AddUntilStep("selection not changed", () => carousel.SelectedBeatmap == selection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestRecommendedSelection()
|
public void TestRecommendedSelection()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user