1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-09 00:07:32 +08:00
osu-lazer/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs

121 lines
5.2 KiB
C#
Raw Normal View History

2017-05-22 11:07:15 +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.Graphics.Containers;
2017-05-22 12:29:39 +08:00
using osu.Framework.Graphics;
2017-05-22 11:07:15 +08:00
using osu.Framework.Testing;
2017-05-22 12:29:39 +08:00
using osu.Game.Screens.Multiplayer;
2017-05-22 11:07:15 +08:00
using osu.Game.Online.Multiplayer;
using osu.Game.Users;
using osu.Game.Database;
2017-06-24 16:05:48 +08:00
using osu.Framework.Allocation;
2017-05-22 11:07:15 +08:00
namespace osu.Desktop.VisualTests.Tests
{
2017-05-22 23:44:58 +08:00
internal class TestCaseDrawableRoom : TestCase
2017-05-22 11:07:15 +08:00
{
public override string Description => @"Select your favourite room";
2017-06-24 16:05:48 +08:00
private RulesetDatabase rulesets;
2017-05-22 11:07:15 +08:00
public override void Reset()
{
base.Reset();
2017-05-23 00:05:18 +08:00
DrawableRoom first;
2017-05-22 11:07:15 +08:00
Add(new FillFlowContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
AutoSizeAxes = Axes.Y,
2017-06-24 16:05:48 +08:00
Width = 580f,
2017-05-22 11:07:15 +08:00
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
2017-06-24 16:05:48 +08:00
first = new DrawableRoom(new Room
{
Name = { Value = @"Great Room Right Here" },
Host = { Value = new User { Username = @"Naeferith", Id = 9492835, Country = new Country { FlagName = @"FR" } } },
Status = { Value = new RoomStatusOpen() },
Type = { Value = new GameTypeTeamVersus() },
Beatmap =
{
Value = new BeatmapInfo
{
StarDifficulty = 4.65,
Ruleset = rulesets.GetRuleset(3),
Metadata = new BeatmapMetadata
{
Title = @"Critical Crystal",
Artist = @"Seiryu",
},
OnlineInfo = new BeatmapOnlineInfo
{
Covers = new[] { @"https://assets.ppy.sh//beatmaps/376340/covers/cover.jpg?1456478455" },
},
},
},
Participants =
{
Value = new[]
{
new User { GlobalRank = 1355 },
new User { GlobalRank = 8756 },
},
},
}),
new DrawableRoom(new Room
{
Name = { Value = @"Relax It's The Weekend" },
Host = { Value = new User { Username = @"peppy", Id = 2, Country = new Country { FlagName = @"AU" } } },
Status = { Value = new RoomStatusPlaying() },
Type = { Value = new GameTypeTagTeam() },
Beatmap =
{
Value = new BeatmapInfo
{
StarDifficulty = 1.96,
Ruleset = rulesets.GetRuleset(0),
Metadata = new BeatmapMetadata
{
Title = @"Serendipity",
Artist = @"ZAQ",
},
OnlineInfo = new BeatmapOnlineInfo
{
Covers = new[] { @"https://assets.ppy.sh//beatmaps/526839/covers/cover.jpg?1493815706" },
},
},
},
Participants =
{
Value = new[]
{
new User { GlobalRank = 578975 },
new User { GlobalRank = 24554 },
},
},
}),
2017-05-22 11:07:15 +08:00
}
});
2017-06-24 16:05:48 +08:00
AddStep(@"change title", () => first.Room.Name.Value = @"I Changed Name");
AddStep(@"change host", () => first.Room.Host.Value = new User { Username = @"DrabWeb", Id = 6946022, Country = new Country { FlagName = @"CA" } });
AddStep(@"change status", () => first.Room.Status.Value = new RoomStatusPlaying());
AddStep(@"change type", () => first.Room.Type.Value = new GameTypeVersus());
AddStep(@"change beatmap", () => first.Room.Beatmap.Value = null);
AddStep(@"change participants", () => first.Room.Participants.Value = new[]
2017-05-22 12:01:55 +08:00
{
2017-06-24 16:05:48 +08:00
new User { GlobalRank = 1254 },
new User { GlobalRank = 123189 },
2017-05-22 12:01:55 +08:00
});
2017-06-24 16:05:48 +08:00
}
2017-05-22 12:01:55 +08:00
2017-06-24 16:05:48 +08:00
[BackgroundDependencyLoader]
private void load(RulesetDatabase rulesets)
{
this.rulesets = rulesets;
2017-05-22 11:07:15 +08:00
}
}
}