1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-12 09:37:24 +08:00
osu-lazer/osu.Desktop.VisualTests/Tests/TestCaseRoomInspector.cs

132 lines
5.6 KiB
C#
Raw Normal View History

2017-05-30 16:12:11 +08:00
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Testing;
using osu.Framework.Graphics;
using osu.Game.Screens.Multiplayer;
using osu.Game.Database;
using osu.Game.Online.Multiplayer;
using osu.Game.Users;
using osu.Framework.Allocation;
namespace osu.Desktop.VisualTests.Tests
{
internal class TestCaseRoomInspector : TestCase
{
public override string Description => @"from the multiplayer lobby";
private RulesetDatabase rulesets;
protected override void LoadComplete()
2017-05-30 16:12:11 +08:00
{
base.LoadComplete();
2017-05-30 16:12:11 +08:00
2017-06-23 21:34:36 +08:00
var room = new Room
2017-05-30 16:12:11 +08:00
{
2017-06-23 21:34:36 +08:00
Name = { Value = @"My Awesome Room" },
Host = { Value = new User { Username = @"flyte", Id = 3103765, Country = new Country { FlagName = @"JP" } } },
Status = { Value = new RoomStatusOpen() },
Type = { Value = new GameTypeTeamVersus() },
Beatmap =
2017-05-30 16:12:11 +08:00
{
2017-06-23 21:34:36 +08:00
Value = new BeatmapInfo
{
StarDifficulty = 3.7,
Ruleset = rulesets.GetRuleset(3),
Metadata = new BeatmapMetadata
{
Title = @"Platina",
Artist = @"Maaya Sakamoto",
Author = @"uwutm8",
},
OnlineInfo = new BeatmapOnlineInfo
{
Covers = new[] { @"https://assets.ppy.sh//beatmaps/560573/covers/cover.jpg?1492722343" },
},
}
2017-05-30 16:12:11 +08:00
},
2017-06-23 21:34:36 +08:00
MaxParticipants = { Value = 200 },
Participants =
2017-05-31 06:35:37 +08:00
{
2017-06-23 21:34:36 +08:00
Value = new[]
{
new User { Username = @"flyte", Id = 3103765, GlobalRank = 1425 },
new User { Username = @"Cookiezi", Id = 124493, GlobalRank = 5466 },
new User { Username = @"Angelsim", Id = 1777162, GlobalRank = 2873 },
new User { Username = @"Rafis", Id = 2558286, GlobalRank = 4687 },
new User { Username = @"hvick225", Id = 50265, GlobalRank = 3258 },
new User { Username = @"peppy", Id = 2, GlobalRank = 6251 }
}
}
2017-06-23 21:14:56 +08:00
};
2017-05-30 16:12:11 +08:00
RoomInspector inspector;
Add(inspector = new RoomInspector
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Room = room,
});
AddStep(@"change title", () => room.Name.Value = @"A Better Room Than The Above");
2017-06-23 21:14:56 +08:00
AddStep(@"change host", () => room.Host.Value = new User { Username = @"DrabWeb", Id = 6946022, Country = new Country { FlagName = @"CA" } });
2017-05-30 16:12:11 +08:00
AddStep(@"change status", () => room.Status.Value = new RoomStatusPlaying());
2017-05-31 08:41:20 +08:00
AddStep(@"change type", () => room.Type.Value = new GameTypeTag());
2017-05-30 16:12:11 +08:00
AddStep(@"change beatmap", () => room.Beatmap.Value = null);
AddStep(@"change max participants", () => room.MaxParticipants.Value = null);
AddStep(@"change participants", () => room.Participants.Value = new[]
{
new User { Username = @"filsdelama", Id = 2831793, GlobalRank = 8542 },
new User { Username = @"_index", Id = 652457, GlobalRank = 15024 }
});
AddStep(@"change room", () =>
{
2017-06-23 21:34:36 +08:00
var newRoom = new Room
2017-05-30 16:12:11 +08:00
{
2017-06-23 21:34:36 +08:00
Name = { Value = @"My New, Better Than Ever Room" },
Host = { Value = new User { Username = @"Angelsim", Id = 1777162, Country = new Country { FlagName = @"KR" } } },
Status = { Value = new RoomStatusOpen() },
Type = { Value = new GameTypeTagTeam() },
Beatmap =
2017-05-30 16:12:11 +08:00
{
2017-06-23 21:34:36 +08:00
Value = new BeatmapInfo
{
StarDifficulty = 7.07,
Ruleset = rulesets.GetRuleset(0),
Metadata = new BeatmapMetadata
{
Title = @"xi",
Artist = @"FREEDOM DIVE",
Author = @"Nakagawa-Kanon",
},
OnlineInfo = new BeatmapOnlineInfo
{
Covers = new[] { @"https://assets.ppy.sh//beatmaps/39804/covers/cover.jpg?1456506845" },
},
}
2017-05-30 16:12:11 +08:00
},
2017-06-23 21:34:36 +08:00
MaxParticipants = { Value = 10 },
Participants =
2017-05-31 06:35:37 +08:00
{
2017-06-23 21:34:36 +08:00
Value = new[]
{
new User { Username = @"Angelsim", Id = 1777162, GlobalRank = 4 },
new User { Username = @"HappyStick", Id = 256802, GlobalRank = 752 },
new User { Username = @"-Konpaku-", Id = 2258797, GlobalRank = 571 }
}
}
2017-05-30 16:12:11 +08:00
};
inspector.Room = newRoom;
});
}
[BackgroundDependencyLoader]
private void load(RulesetDatabase rulesets)
{
this.rulesets = rulesets;
}
}
}