mirror of https://github.com/ppy/osu
Add failing test case
This commit is contained in:
parent
17eed2f427
commit
5141bf66eb
|
@ -10,6 +10,7 @@
|
|||
using osu.Game.Screens.OnlinePlay.Lounge.Components;
|
||||
using osu.Game.Screens.OnlinePlay.Playlists;
|
||||
using osu.Game.Tests.Visual.OnlinePlay;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Playlists
|
||||
{
|
||||
|
@ -30,17 +31,35 @@ public override void SetUpSteps()
|
|||
|
||||
private RoomsContainer roomsContainer => loungeScreen.ChildrenOfType<RoomsContainer>().First();
|
||||
|
||||
[Test]
|
||||
public void TestScrollByDraggingRooms()
|
||||
{
|
||||
AddStep("reset mouse", () => InputManager.ReleaseButton(MouseButton.Left));
|
||||
|
||||
AddStep("add rooms", () => RoomManager.AddRooms(30));
|
||||
|
||||
AddUntilStep("first room is not masked", () => checkRoomVisible(roomsContainer.Rooms[0]));
|
||||
|
||||
AddStep("move mouse to third room", () => InputManager.MoveMouseTo(roomsContainer.Rooms[2]));
|
||||
AddStep("hold down", () => InputManager.PressButton(MouseButton.Left));
|
||||
AddStep("drag to top", () => InputManager.MoveMouseTo(roomsContainer.Rooms[0]));
|
||||
|
||||
AddAssert("first and second room masked", ()
|
||||
=> !checkRoomVisible(roomsContainer.Rooms[0]) &&
|
||||
!checkRoomVisible(roomsContainer.Rooms[1]));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestScrollSelectedIntoView()
|
||||
{
|
||||
AddStep("add rooms", () => RoomManager.AddRooms(30));
|
||||
|
||||
AddUntilStep("first room is not masked", () => checkRoomVisible(roomsContainer.Rooms.First()));
|
||||
AddUntilStep("first room is not masked", () => checkRoomVisible(roomsContainer.Rooms[0]));
|
||||
|
||||
AddStep("select last room", () => roomsContainer.Rooms.Last().Click());
|
||||
AddStep("select last room", () => roomsContainer.Rooms[^1].Click());
|
||||
|
||||
AddUntilStep("first room is masked", () => !checkRoomVisible(roomsContainer.Rooms.First()));
|
||||
AddUntilStep("last room is not masked", () => checkRoomVisible(roomsContainer.Rooms.Last()));
|
||||
AddUntilStep("first room is masked", () => !checkRoomVisible(roomsContainer.Rooms[0]));
|
||||
AddUntilStep("last room is not masked", () => checkRoomVisible(roomsContainer.Rooms[^1]));
|
||||
}
|
||||
|
||||
private bool checkRoomVisible(DrawableRoom room) =>
|
||||
|
|
Loading…
Reference in New Issue