From b4b4a8a157a0bbcb5e99269ff3772afeff7f2545 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Tue, 29 May 2018 03:24:38 -0300 Subject: [PATCH] Add TestCaseMatchInfo. --- osu.Game.Tests/Visual/TestCaseMatch.cs | 2 + osu.Game.Tests/Visual/TestCaseMatchInfo.cs | 59 ++++++++++++++++++++ osu.Game/Screens/Multi/Screens/Match/Info.cs | 7 ++- 3 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 osu.Game.Tests/Visual/TestCaseMatchInfo.cs diff --git a/osu.Game.Tests/Visual/TestCaseMatch.cs b/osu.Game.Tests/Visual/TestCaseMatch.cs index 6f41723982..69c1a6a0b2 100644 --- a/osu.Game.Tests/Visual/TestCaseMatch.cs +++ b/osu.Game.Tests/Visual/TestCaseMatch.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using NUnit.Framework; using osu.Framework.Allocation; using osu.Game.Beatmaps; using osu.Game.Online.Multiplayer; @@ -10,6 +11,7 @@ namespace osu.Game.Tests.Visual { + [TestFixture] public class TestCaseMatch : OsuTestCase { [BackgroundDependencyLoader] diff --git a/osu.Game.Tests/Visual/TestCaseMatchInfo.cs b/osu.Game.Tests/Visual/TestCaseMatchInfo.cs new file mode 100644 index 0000000000..f58bc0e30a --- /dev/null +++ b/osu.Game.Tests/Visual/TestCaseMatchInfo.cs @@ -0,0 +1,59 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using NUnit.Framework; +using osu.Framework.Allocation; +using osu.Game.Beatmaps; +using osu.Game.Online.Multiplayer; +using osu.Game.Rulesets; +using osu.Game.Screens.Multi.Screens.Match; + +namespace osu.Game.Tests.Visual +{ + [TestFixture] + public class TestCaseMatchInfo : OsuTestCase + { + [BackgroundDependencyLoader] + private void load(RulesetStore rulesets) + { + Info info = new Info(); + Add(info); + + AddStep(@"set name", () => info.Name = @"Room Name?"); + AddStep(@"set availability", () => info.Availability = RoomAvailability.FriendsOnly); + AddStep(@"set status", () => info.Status = new RoomStatusPlaying()); + + AddStep(@"set beatmap", () => info.Beatmap = new BeatmapInfo + { + StarDifficulty = 2.4, + Ruleset = rulesets.GetRuleset(0), + Metadata = new BeatmapMetadata + { + Title = @"My Song", + Artist = @"VisualTests", + AuthorString = @"osu!lazer", + }, + }); + + AddStep(@"set type", () => info.Type = new GameTypeTagTeam()); + + AddStep(@"change name", () => info.Name = @"Room Name!"); + AddStep(@"change availability", () => info.Availability = RoomAvailability.InviteOnly); + AddStep(@"change status", () => info.Status = new RoomStatusOpen()); + + AddStep(@"change beatmap", () => info.Beatmap = new BeatmapInfo + { + StarDifficulty = 4.2, + Ruleset = rulesets.GetRuleset(3), + Metadata = new BeatmapMetadata + { + Title = @"Your Song", + Artist = @"Tester", + AuthorString = @"Someone", + }, + }); + + AddStep(@"change type", () => info.Type = new GameTypeTeamVersus()); + } + } +} diff --git a/osu.Game/Screens/Multi/Screens/Match/Info.cs b/osu.Game/Screens/Multi/Screens/Match/Info.cs index 88dda4a67b..e2efbad269 100644 --- a/osu.Game/Screens/Multi/Screens/Match/Info.cs +++ b/osu.Game/Screens/Multi/Screens/Match/Info.cs @@ -24,9 +24,12 @@ public class Info : Container private readonly OsuSpriteText name, availabilityStatus; private readonly BeatmapTypeInfo beatmapTypeInfo; + private readonly ReadyButton readyButton; private OsuColour colours; + public Bindable Ready => readyButton.Ready; + public string Name { set { name.Text = value; } @@ -116,7 +119,7 @@ public Info() }, }, }, - new ReadyButton + readyButton = new ReadyButton { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, @@ -146,7 +149,7 @@ private void updateAvailabilityStatus() { if (status != null) { - availabilityStatus.FadeColour(status.GetAppropriateColour(colours)); + availabilityStatus.FadeColour(status.GetAppropriateColour(colours), 100); availabilityStatus.Text = $"{availability.GetDescription()}, {status.Message}"; } }