2020-07-09 17:07:34 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
using System.Linq;
|
|
|
|
using NUnit.Framework;
|
|
|
|
using osu.Framework.Screens;
|
|
|
|
using osu.Framework.Testing;
|
|
|
|
using osu.Game.Graphics.Containers;
|
2020-12-25 23:50:00 +08:00
|
|
|
using osu.Game.Screens.OnlinePlay.Lounge;
|
|
|
|
using osu.Game.Screens.OnlinePlay.Lounge.Components;
|
|
|
|
using osu.Game.Screens.OnlinePlay.Playlists;
|
2021-06-24 18:09:31 +08:00
|
|
|
using osu.Game.Tests.Visual.OnlinePlay;
|
2020-07-09 17:07:34 +08:00
|
|
|
|
2020-12-25 12:20:37 +08:00
|
|
|
namespace osu.Game.Tests.Visual.Playlists
|
2020-07-09 17:07:34 +08:00
|
|
|
{
|
2021-06-25 12:02:19 +08:00
|
|
|
public class TestScenePlaylistsLoungeSubScreen : OnlinePlayTestScene
|
2020-07-09 17:07:34 +08:00
|
|
|
{
|
2021-06-25 12:02:19 +08:00
|
|
|
protected new BasicTestRoomManager RoomManager => (BasicTestRoomManager)base.RoomManager;
|
2021-06-24 18:13:50 +08:00
|
|
|
|
2020-07-09 17:07:34 +08:00
|
|
|
private LoungeSubScreen loungeScreen;
|
|
|
|
|
|
|
|
public override void SetUpSteps()
|
|
|
|
{
|
|
|
|
base.SetUpSteps();
|
|
|
|
|
2021-02-02 15:04:42 +08:00
|
|
|
AddStep("push screen", () => LoadScreen(loungeScreen = new PlaylistsLoungeSubScreen()));
|
2020-07-09 17:25:07 +08:00
|
|
|
|
|
|
|
AddUntilStep("wait for present", () => loungeScreen.IsCurrentScreen());
|
2020-07-09 17:07:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
private RoomsContainer roomsContainer => loungeScreen.ChildrenOfType<RoomsContainer>().First();
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestScrollSelectedIntoView()
|
|
|
|
{
|
2021-06-24 18:09:31 +08:00
|
|
|
AddStep("add rooms", () => RoomManager.AddRooms(30));
|
2020-07-09 17:07:34 +08:00
|
|
|
|
|
|
|
AddUntilStep("first room is not masked", () => checkRoomVisible(roomsContainer.Rooms.First()));
|
|
|
|
|
2021-07-12 13:35:08 +08:00
|
|
|
AddStep("select last room", () => roomsContainer.Rooms.Last().Click());
|
2020-07-09 17:07:34 +08:00
|
|
|
|
|
|
|
AddUntilStep("first room is masked", () => !checkRoomVisible(roomsContainer.Rooms.First()));
|
|
|
|
AddUntilStep("last room is not masked", () => checkRoomVisible(roomsContainer.Rooms.Last()));
|
|
|
|
}
|
|
|
|
|
|
|
|
private bool checkRoomVisible(DrawableRoom room) =>
|
|
|
|
loungeScreen.ChildrenOfType<OsuScrollContainer>().First().ScreenSpaceDrawQuad
|
|
|
|
.Contains(room.ScreenSpaceDrawQuad.Centre);
|
|
|
|
}
|
|
|
|
}
|