osu/osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs

81 lines
2.8 KiB
C#
Raw Normal View History

2017-05-22 03:07:15 +00: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 04:29:39 +00:00
using osu.Framework.Graphics;
2017-05-22 03:07:15 +00:00
using osu.Framework.Testing;
2017-05-22 04:29:39 +00:00
using osu.Game.Screens.Multiplayer;
2017-05-22 03:07:15 +00:00
using osu.Game.Online.Multiplayer;
using osu.Game.Users;
using osu.Game.Database;
namespace osu.Desktop.VisualTests.Tests
{
2017-05-22 15:44:58 +00:00
internal class TestCaseDrawableRoom : TestCase
2017-05-22 03:07:15 +00:00
{
public override string Description => @"Select your favourite room";
public override void Reset()
{
base.Reset();
2017-05-22 15:44:58 +00:00
DrawableRoom p;
2017-05-22 03:07:15 +00:00
Add(new FillFlowContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
AutoSizeAxes = Axes.Y,
Width = 500f,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
2017-05-22 15:44:58 +00:00
p = new DrawableRoom(new Room
2017-05-22 03:07:15 +00:00
{
Name = @"Great Room Right Here",
2017-05-22 04:01:55 +00:00
Host = new User { Username = @"Naeferith", Id = 9492835, Country = new Country { FlagName = @"FR" }},
2017-05-22 15:46:41 +00:00
Status = RoomStatus.Open,
2017-05-22 15:45:40 +00:00
Beatmap = new BeatmapMetadata { Title = @"Seiryu", Artist = @"Critical Crystal" },
2017-05-22 03:07:15 +00:00
}),
2017-05-22 15:44:58 +00:00
new DrawableRoom(new Room
2017-05-22 03:07:15 +00:00
{
Name = @"Relax It's The Weekend",
2017-05-22 04:01:55 +00:00
Host = new User{ Username = @"peppy", Id = 2, Country = new Country { FlagName = @"AU" }},
2017-05-22 15:46:41 +00:00
Status = RoomStatus.Playing,
2017-05-22 15:45:40 +00:00
Beatmap = new BeatmapMetadata { Title = @"ZAQ", Artist = @"Serendipity" },
2017-05-22 03:07:15 +00:00
}),
}
});
2017-05-22 04:01:55 +00:00
AddStep(@"change state", () =>
{
2017-05-22 15:46:41 +00:00
p.Room.Value.Status = RoomStatus.Playing;
2017-05-22 04:01:55 +00:00
p.Room.TriggerChange();
});
AddStep(@"change name", () =>
{
p.Room.Value.Name = @"I Changed Name";
p.Room.TriggerChange();
});
AddStep(@"change host", () =>
{
p.Room.Value.Host = new User { Username = @"DrabWeb", Id = 6946022, Country = new Country { FlagName = @"CA" } };
p.Room.TriggerChange();
});
AddStep(@"change beatmap", () =>
{
2017-05-22 15:45:40 +00:00
p.Room.Value.Beatmap = null;
2017-05-22 04:01:55 +00:00
p.Room.TriggerChange();
});
AddStep(@"change state", () =>
{
2017-05-22 15:46:41 +00:00
p.Room.Value.Status = RoomStatus.Open;
2017-05-22 04:01:55 +00:00
p.Room.TriggerChange();
});
2017-05-22 03:07:15 +00:00
}
}
}