mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Add tests
This commit is contained in:
@ -14,6 +14,7 @@ using osu.Framework.Extensions;
|
|||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
@ -25,6 +26,7 @@ using osu.Game.Rulesets.Taiko;
|
|||||||
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
|
||||||
{
|
{
|
||||||
@ -95,6 +97,115 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
AddAssert("filter count is 1", () => songSelect.FilterCount == 1);
|
AddAssert("filter count is 1", () => songSelect.FilterCount == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestChangeBeatmapBeforeEnter()
|
||||||
|
{
|
||||||
|
addRulesetImportStep(0);
|
||||||
|
|
||||||
|
createSongSelect();
|
||||||
|
|
||||||
|
WorkingBeatmap selected = null;
|
||||||
|
|
||||||
|
AddStep("store selected beatmap", () => selected = Beatmap.Value);
|
||||||
|
|
||||||
|
AddStep("select next and enter", () =>
|
||||||
|
{
|
||||||
|
InputManager.PressKey(Key.Down);
|
||||||
|
InputManager.ReleaseKey(Key.Down);
|
||||||
|
InputManager.PressKey(Key.Enter);
|
||||||
|
InputManager.ReleaseKey(Key.Enter);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("ensure selection changed", () => selected != Beatmap.Value);
|
||||||
|
|
||||||
|
AddUntilStep("wait for return to song select", () => songSelect.IsCurrentScreen());
|
||||||
|
AddUntilStep("bindable lease returned", () => !Beatmap.Disabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestChangeBeatmapAfterEnter()
|
||||||
|
{
|
||||||
|
addRulesetImportStep(0);
|
||||||
|
|
||||||
|
createSongSelect();
|
||||||
|
|
||||||
|
WorkingBeatmap selected = null;
|
||||||
|
|
||||||
|
AddStep("store selected beatmap", () => selected = Beatmap.Value);
|
||||||
|
|
||||||
|
AddStep("select next and enter", () =>
|
||||||
|
{
|
||||||
|
InputManager.PressKey(Key.Enter);
|
||||||
|
InputManager.ReleaseKey(Key.Enter);
|
||||||
|
InputManager.PressKey(Key.Down);
|
||||||
|
InputManager.ReleaseKey(Key.Down);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("ensure selection didn't change", () => selected == Beatmap.Value);
|
||||||
|
|
||||||
|
AddUntilStep("wait for return to song select", () => songSelect.IsCurrentScreen());
|
||||||
|
AddUntilStep("bindable lease returned", () => !Beatmap.Disabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestChangeBeatmapViaMouseBeforeEnter()
|
||||||
|
{
|
||||||
|
addRulesetImportStep(0);
|
||||||
|
|
||||||
|
createSongSelect();
|
||||||
|
|
||||||
|
WorkingBeatmap selected = null;
|
||||||
|
|
||||||
|
AddStep("store selected beatmap", () => selected = Beatmap.Value);
|
||||||
|
|
||||||
|
AddStep("select next and enter", () =>
|
||||||
|
{
|
||||||
|
InputManager.MoveMouseTo(songSelect.Carousel.ChildrenOfType<DrawableCarouselBeatmap>()
|
||||||
|
.First(b => ((CarouselBeatmap)b.Item).Beatmap != songSelect.Carousel.SelectedBeatmap));
|
||||||
|
|
||||||
|
InputManager.PressButton(MouseButton.Left);
|
||||||
|
InputManager.ReleaseButton(MouseButton.Left);
|
||||||
|
|
||||||
|
InputManager.PressKey(Key.Enter);
|
||||||
|
InputManager.ReleaseKey(Key.Enter);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("ensure selection changed", () => selected != Beatmap.Value);
|
||||||
|
|
||||||
|
AddUntilStep("wait for return to song select", () => songSelect.IsCurrentScreen());
|
||||||
|
AddUntilStep("bindable lease returned", () => !Beatmap.Disabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestChangeBeatmapViaMouseAfterEnter()
|
||||||
|
{
|
||||||
|
addRulesetImportStep(0);
|
||||||
|
|
||||||
|
createSongSelect();
|
||||||
|
|
||||||
|
WorkingBeatmap selected = null;
|
||||||
|
|
||||||
|
AddStep("store selected beatmap", () => selected = Beatmap.Value);
|
||||||
|
|
||||||
|
AddStep("select next and enter", () =>
|
||||||
|
{
|
||||||
|
InputManager.MoveMouseTo(songSelect.Carousel.ChildrenOfType<DrawableCarouselBeatmap>()
|
||||||
|
.First(b => ((CarouselBeatmap)b.Item).Beatmap != songSelect.Carousel.SelectedBeatmap));
|
||||||
|
|
||||||
|
InputManager.PressButton(MouseButton.Left);
|
||||||
|
|
||||||
|
InputManager.PressKey(Key.Enter);
|
||||||
|
InputManager.ReleaseKey(Key.Enter);
|
||||||
|
|
||||||
|
InputManager.ReleaseButton(MouseButton.Left);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("ensure selection didn't change", () => selected == Beatmap.Value);
|
||||||
|
|
||||||
|
AddUntilStep("wait for return to song select", () => songSelect.IsCurrentScreen());
|
||||||
|
AddUntilStep("bindable lease returned", () => !Beatmap.Disabled);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestNoFilterOnSimpleResume()
|
public void TestNoFilterOnSimpleResume()
|
||||||
{
|
{
|
||||||
|
@ -8,6 +8,7 @@ using osu.Framework.Testing.Input;
|
|||||||
using osu.Game.Graphics.Cursor;
|
using osu.Game.Graphics.Cursor;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Input.Bindings;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
@ -30,7 +31,11 @@ namespace osu.Game.Tests.Visual
|
|||||||
InputManager = new ManualInputManager
|
InputManager = new ManualInputManager
|
||||||
{
|
{
|
||||||
UseParentInput = true,
|
UseParentInput = true,
|
||||||
Child = content = new MenuCursorContainer { RelativeSizeAxes = Axes.Both },
|
Child = new GlobalActionContainer(null)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Child = content = new MenuCursorContainer { RelativeSizeAxes = Axes.Both }
|
||||||
|
},
|
||||||
},
|
},
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user