1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-20 01:32:56 +08:00
osu-lazer/osu.Game.Tests/Visual/Multiplayer/TestSceneRoomStatus.cs

82 lines
3.4 KiB
C#
Raw Normal View History

// 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.
2018-12-27 12:30:36 +08:00
2020-12-18 14:18:06 +08:00
using System;
using System.Linq;
using NUnit.Framework;
2018-12-27 12:30:36 +08:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Framework.Utils;
2020-12-25 12:38:11 +08:00
using osu.Game.Online.Rooms;
using osu.Game.Online.Rooms.RoomStatuses;
using osu.Game.Screens.OnlinePlay.Lounge.Components;
2018-12-27 12:30:36 +08:00
2019-03-25 00:02:36 +08:00
namespace osu.Game.Tests.Visual.Multiplayer
2018-12-27 12:30:36 +08:00
{
public class TestSceneRoomStatus : OsuTestScene
2018-12-27 12:30:36 +08:00
{
2021-07-19 21:31:53 +08:00
[Test]
public void TestMultipleStatuses()
2018-12-27 12:30:36 +08:00
{
2021-07-19 21:31:53 +08:00
AddStep("create rooms", () =>
2018-12-27 12:30:36 +08:00
{
2021-07-19 21:31:53 +08:00
Child = new FillFlowContainer
2018-12-27 12:30:36 +08:00
{
2021-07-19 21:31:53 +08:00
RelativeSizeAxes = Axes.Both,
Width = 0.5f,
Children = new Drawable[]
2020-12-21 15:18:39 +08:00
{
2021-07-19 21:31:53 +08:00
new DrawableRoom(new Room
{
Name = { Value = "Open - ending in 1 day" },
Status = { Value = new RoomStatusOpen() },
EndDate = { Value = DateTimeOffset.Now.AddDays(1) }
}) { MatchingFilter = true },
new DrawableRoom(new Room
{
Name = { Value = "Playing - ending in 1 day" },
Status = { Value = new RoomStatusPlaying() },
EndDate = { Value = DateTimeOffset.Now.AddDays(1) }
}) { MatchingFilter = true },
new DrawableRoom(new Room
{
Name = { Value = "Ended" },
Status = { Value = new RoomStatusEnded() },
EndDate = { Value = DateTimeOffset.Now }
}) { MatchingFilter = true },
new DrawableRoom(new Room
{
Name = { Value = "Open" },
Status = { Value = new RoomStatusOpen() },
Category = { Value = RoomCategory.Realtime }
}) { MatchingFilter = true },
}
};
});
2018-12-27 12:30:36 +08:00
}
[Test]
public void TestEnableAndDisablePassword()
{
DrawableRoom drawableRoom = null;
Room room = null;
AddStep("create room", () => Child = drawableRoom = new DrawableRoom(room = new Room
{
Name = { Value = "Room with password" },
Status = { Value = new RoomStatusOpen() },
Category = { Value = RoomCategory.Realtime },
}) { MatchingFilter = true });
AddAssert("password icon hidden", () => Precision.AlmostEquals(0, drawableRoom.ChildrenOfType<DrawableRoom.PasswordProtectedIcon>().Single().Alpha));
AddStep("set password", () => room.Password.Value = "password");
AddAssert("password icon visible", () => Precision.AlmostEquals(1, drawableRoom.ChildrenOfType<DrawableRoom.PasswordProtectedIcon>().Single().Alpha));
AddStep("unset password", () => room.Password.Value = string.Empty);
AddAssert("password icon hidden", () => Precision.AlmostEquals(0, drawableRoom.ChildrenOfType<DrawableRoom.PasswordProtectedIcon>().Single().Alpha));
}
2018-12-27 12:30:36 +08:00
}
}