From 51ade3251d68c9222a897852ce20e99b0d676077 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 17 Jan 2022 15:15:20 +0900 Subject: [PATCH 1/4] Improve `ScoresContainer` loading overlay logic to work better with tests --- osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs index a40f29abf2..00dedc892b 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs @@ -65,6 +65,9 @@ namespace osu.Game.Overlays.BeatmapSet.Scores scoreTable.ClearScores(); scoreTable.Hide(); + loading.Hide(); + loading.FinishTransforms(); + if (value?.Scores.Any() != true) return; @@ -258,9 +261,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { Scores = null; notSupporterPlaceholder.Show(); - - loading.Hide(); - loading.FinishTransforms(); return; } @@ -272,9 +272,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores getScoresRequest = new GetScoresRequest(Beatmap.Value, Beatmap.Value.Ruleset, scope.Value, modSelector.SelectedMods); getScoresRequest.Success += scores => { - loading.Hide(); - loading.FinishTransforms(); - Scores = scores; if (!scores.Scores.Any()) From 6436b6186f6e3a1ad2262748138576b23334f750 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 17 Jan 2022 15:15:34 +0900 Subject: [PATCH 2/4] Rewrite `TestScenScoresContainer` to work again --- .../Visual/Online/TestSceneScoresContainer.cs | 440 +++++++++--------- 1 file changed, 231 insertions(+), 209 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs b/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs index be2db9a8a0..71b60d8842 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs @@ -1,11 +1,14 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; +using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Testing; using osu.Framework.Utils; using osu.Game.Online.API; using osu.Game.Online.API.Requests.Responses; @@ -24,224 +27,38 @@ namespace osu.Game.Tests.Visual.Online [Cached] private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue); - public TestSceneScoresContainer() + private TestScoresContainer scoresContainer; + + [SetUpSteps] + public void SetUpSteps() { - TestScoresContainer scoresContainer; - - Child = new Container + AddStep("Create container", () => { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - RelativeSizeAxes = Axes.Both, - Width = 0.8f, - Children = new Drawable[] + Child = new Container { - new Box + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + RelativeSizeAxes = Axes.Both, + Width = 0.8f, + Children = new Drawable[] { - RelativeSizeAxes = Axes.Both, - Colour = Color4.Black, - }, - scoresContainer = new TestScoresContainer(), - } - }; - - var allScores = new APIScoresCollection - { - Scores = new List - { - new APIScore - { - User = new APIUser + new Box { - Id = 6602580, - Username = @"waaiiru", - Country = new Country - { - FullName = @"Spain", - FlagName = @"ES", - }, + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, }, - Mods = new[] + scoresContainer = new TestScoresContainer { - new APIMod { Acronym = new OsuModDoubleTime().Acronym }, - new APIMod { Acronym = new OsuModHidden().Acronym }, - new APIMod { Acronym = new OsuModFlashlight().Acronym }, - new APIMod { Acronym = new OsuModHardRock().Acronym }, - }, - Rank = ScoreRank.XH, - PP = 200, - MaxCombo = 1234, - TotalScore = 1234567890, - Accuracy = 1, - }, - new APIScore - { - User = new APIUser - { - Id = 4608074, - Username = @"Skycries", - Country = new Country - { - FullName = @"Brazil", - FlagName = @"BR", - }, - }, - Mods = new[] - { - new APIMod { Acronym = new OsuModDoubleTime().Acronym }, - new APIMod { Acronym = new OsuModHidden().Acronym }, - new APIMod { Acronym = new OsuModFlashlight().Acronym }, - }, - Rank = ScoreRank.S, - PP = 190, - MaxCombo = 1234, - TotalScore = 1234789, - Accuracy = 0.9997, - }, - new APIScore - { - User = new APIUser - { - Id = 1014222, - Username = @"eLy", - Country = new Country - { - FullName = @"Japan", - FlagName = @"JP", - }, - }, - Mods = new[] - { - new APIMod { Acronym = new OsuModDoubleTime().Acronym }, - new APIMod { Acronym = new OsuModHidden().Acronym }, - }, - Rank = ScoreRank.B, - PP = 180, - MaxCombo = 1234, - TotalScore = 12345678, - Accuracy = 0.9854, - }, - new APIScore - { - User = new APIUser - { - Id = 1541390, - Username = @"Toukai", - Country = new Country - { - FullName = @"Canada", - FlagName = @"CA", - }, - }, - Mods = new[] - { - new APIMod { Acronym = new OsuModDoubleTime().Acronym }, - }, - Rank = ScoreRank.C, - PP = 170, - MaxCombo = 1234, - TotalScore = 1234567, - Accuracy = 0.8765, - }, - new APIScore - { - User = new APIUser - { - Id = 7151382, - Username = @"Mayuri Hana", - Country = new Country - { - FullName = @"Thailand", - FlagName = @"TH", - }, - }, - Rank = ScoreRank.D, - PP = 160, - MaxCombo = 1234, - TotalScore = 123456, - Accuracy = 0.6543, - }, - } - }; - - var myBestScore = new APIScoreWithPosition - { - Score = new APIScore - { - User = new APIUser - { - Id = 7151382, - Username = @"Mayuri Hana", - Country = new Country - { - FullName = @"Thailand", - FlagName = @"TH", - }, - }, - Rank = ScoreRank.D, - PP = 160, - MaxCombo = 1234, - TotalScore = 123456, - Accuracy = 0.6543, - }, - Position = 1337, - }; - - var myBestScoreWithNullPosition = new APIScoreWithPosition - { - Score = new APIScore - { - User = new APIUser - { - Id = 7151382, - Username = @"Mayuri Hana", - Country = new Country - { - FullName = @"Thailand", - FlagName = @"TH", - }, - }, - Rank = ScoreRank.D, - PP = 160, - MaxCombo = 1234, - TotalScore = 123456, - Accuracy = 0.6543, - }, - Position = null, - }; - - var oneScore = new APIScoresCollection - { - Scores = new List - { - new APIScore - { - User = new APIUser - { - Id = 6602580, - Username = @"waaiiru", - Country = new Country - { - FullName = @"Spain", - FlagName = @"ES", - }, - }, - Mods = new[] - { - new APIMod { Acronym = new OsuModDoubleTime().Acronym }, - new APIMod { Acronym = new OsuModHidden().Acronym }, - new APIMod { Acronym = new OsuModFlashlight().Acronym }, - new APIMod { Acronym = new OsuModHardRock().Acronym }, - }, - Rank = ScoreRank.XH, - PP = 200, - MaxCombo = 1234, - TotalScore = 1234567890, - Accuracy = 1, + Beatmap = { Value = CreateAPIBeatmap() } + } } - } - }; + }; + }); + } + [Test] + public void TestDisplay() + { foreach (var s in allScores.Scores) { s.Statistics = new Dictionary @@ -273,6 +90,211 @@ namespace osu.Game.Tests.Visual.Online }); } + private readonly APIScoresCollection allScores = new APIScoresCollection + { + Scores = new List + { + new APIScore + { + Date = DateTimeOffset.Now, + User = new APIUser + { + Id = 6602580, + Username = @"waaiiru", + Country = new Country + { + FullName = @"Spain", + FlagName = @"ES", + }, + }, + Mods = new[] + { + new APIMod { Acronym = new OsuModDoubleTime().Acronym }, + new APIMod { Acronym = new OsuModHidden().Acronym }, + new APIMod { Acronym = new OsuModFlashlight().Acronym }, + new APIMod { Acronym = new OsuModHardRock().Acronym }, + }, + Rank = ScoreRank.XH, + PP = 200, + MaxCombo = 1234, + TotalScore = 1234567890, + Accuracy = 1, + }, + new APIScore + { + Date = DateTimeOffset.Now, + User = new APIUser + { + Id = 4608074, + Username = @"Skycries", + Country = new Country + { + FullName = @"Brazil", + FlagName = @"BR", + }, + }, + Mods = new[] + { + new APIMod { Acronym = new OsuModDoubleTime().Acronym }, + new APIMod { Acronym = new OsuModHidden().Acronym }, + new APIMod { Acronym = new OsuModFlashlight().Acronym }, + }, + Rank = ScoreRank.S, + PP = 190, + MaxCombo = 1234, + TotalScore = 1234789, + Accuracy = 0.9997, + }, + new APIScore + { + Date = DateTimeOffset.Now, + User = new APIUser + { + Id = 1014222, + Username = @"eLy", + Country = new Country + { + FullName = @"Japan", + FlagName = @"JP", + }, + }, + Mods = new[] + { + new APIMod { Acronym = new OsuModDoubleTime().Acronym }, + new APIMod { Acronym = new OsuModHidden().Acronym }, + }, + Rank = ScoreRank.B, + PP = 180, + MaxCombo = 1234, + TotalScore = 12345678, + Accuracy = 0.9854, + }, + new APIScore + { + Date = DateTimeOffset.Now, + User = new APIUser + { + Id = 1541390, + Username = @"Toukai", + Country = new Country + { + FullName = @"Canada", + FlagName = @"CA", + }, + }, + Mods = new[] + { + new APIMod { Acronym = new OsuModDoubleTime().Acronym }, + }, + Rank = ScoreRank.C, + PP = 170, + MaxCombo = 1234, + TotalScore = 1234567, + Accuracy = 0.8765, + }, + new APIScore + { + Date = DateTimeOffset.Now, + User = new APIUser + { + Id = 7151382, + Username = @"Mayuri Hana", + Country = new Country + { + FullName = @"Thailand", + FlagName = @"TH", + }, + }, + Rank = ScoreRank.D, + PP = 160, + MaxCombo = 1234, + TotalScore = 123456, + Accuracy = 0.6543, + }, + } + }; + + private readonly APIScoreWithPosition myBestScore = new APIScoreWithPosition + { + Score = new APIScore + { + Date = DateTimeOffset.Now, + User = new APIUser + { + Id = 7151382, + Username = @"Mayuri Hana", + Country = new Country + { + FullName = @"Thailand", + FlagName = @"TH", + }, + }, + Rank = ScoreRank.D, + PP = 160, + MaxCombo = 1234, + TotalScore = 123456, + Accuracy = 0.6543, + }, + Position = 1337, + }; + + private readonly APIScoreWithPosition myBestScoreWithNullPosition = new APIScoreWithPosition + { + Score = new APIScore + { + Date = DateTimeOffset.Now, + User = new APIUser + { + Id = 7151382, + Username = @"Mayuri Hana", + Country = new Country + { + FullName = @"Thailand", + FlagName = @"TH", + }, + }, + Rank = ScoreRank.D, + PP = 160, + MaxCombo = 1234, + TotalScore = 123456, + Accuracy = 0.6543, + }, + Position = null, + }; + + private readonly APIScoresCollection oneScore = new APIScoresCollection + { + Scores = new List + { + new APIScore + { + Date = DateTimeOffset.Now, + User = new APIUser + { + Id = 6602580, + Username = @"waaiiru", + Country = new Country + { + FullName = @"Spain", + FlagName = @"ES", + }, + }, + Mods = new[] + { + new APIMod { Acronym = new OsuModDoubleTime().Acronym }, + new APIMod { Acronym = new OsuModHidden().Acronym }, + new APIMod { Acronym = new OsuModFlashlight().Acronym }, + new APIMod { Acronym = new OsuModHardRock().Acronym }, + }, + Rank = ScoreRank.XH, + PP = 200, + MaxCombo = 1234, + TotalScore = 1234567890, + Accuracy = 1, + } + } + }; + private class TestScoresContainer : ScoresContainer { public new APIScoresCollection Scores From a80e461000737994c24d84ea20fabe34494d5c6d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 17 Jan 2022 16:23:58 +0900 Subject: [PATCH 3/4] Add better test coverage of user top scores --- .../Visual/Online/TestSceneScoresContainer.cs | 455 +++++++++--------- 1 file changed, 235 insertions(+), 220 deletions(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs b/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs index 71b60d8842..d4af01f772 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; @@ -30,36 +31,247 @@ namespace osu.Game.Tests.Visual.Online private TestScoresContainer scoresContainer; [SetUpSteps] - public void SetUpSteps() + public void SetUp() => Schedule(() => { - AddStep("Create container", () => + Child = new Container { - Child = new Container + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, + RelativeSizeAxes = Axes.Both, + Width = 0.8f, + Children = new Drawable[] { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - RelativeSizeAxes = Axes.Both, - Width = 0.8f, - Children = new Drawable[] + new Box { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.Black, - }, - scoresContainer = new TestScoresContainer - { - Beatmap = { Value = CreateAPIBeatmap() } - } + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + }, + scoresContainer = new TestScoresContainer + { + Beatmap = { Value = CreateAPIBeatmap() } } - }; + } + }; + }); + + [Test] + public void TestNoUserBest() + { + AddStep("Scores with no user best", () => + { + var allScores = createScores(); + + allScores.UserScore = null; + + scoresContainer.Scores = allScores; }); + + AddUntilStep("wait for scores displayed", () => scoresContainer.ChildrenOfType().Any()); + AddAssert("no user best displayed", () => scoresContainer.ChildrenOfType().Count() == 1); + + AddStep("Load null scores", () => scoresContainer.Scores = null); + + AddUntilStep("wait for scores not displayed", () => !scoresContainer.ChildrenOfType().Any()); + AddAssert("no best score displayed", () => !scoresContainer.ChildrenOfType().Any()); + + AddStep("Load only one score", () => + { + var allScores = createScores(); + + allScores.Scores.RemoveRange(1, allScores.Scores.Count - 1); + + scoresContainer.Scores = allScores; + }); + + AddUntilStep("wait for scores not displayed", () => scoresContainer.ChildrenOfType().Count() == 1); + AddAssert("no best score displayed", () => scoresContainer.ChildrenOfType().Count() == 1); } [Test] - public void TestDisplay() + public void TestUserBest() { - foreach (var s in allScores.Scores) + AddStep("Load scores with personal best", () => + { + var allScores = createScores(); + allScores.UserScore = createUserBest(); + scoresContainer.Scores = allScores; + }); + + AddUntilStep("wait for scores displayed", () => scoresContainer.ChildrenOfType().Any()); + AddAssert("best score displayed", () => scoresContainer.ChildrenOfType().Count() == 2); + + AddStep("Load scores with personal best (null position)", () => + { + var allScores = createScores(); + var userBest = createUserBest(); + userBest.Position = null; + allScores.UserScore = userBest; + scoresContainer.Scores = allScores; + }); + + AddUntilStep("wait for scores displayed", () => scoresContainer.ChildrenOfType().Any()); + AddAssert("best score displayed", () => scoresContainer.ChildrenOfType().Count() == 2); + + AddStep("Load scores with personal best (first place)", () => + { + var allScores = createScores(); + allScores.UserScore = new APIScoreWithPosition + { + Score = allScores.Scores.First(), + Position = 1, + }; + scoresContainer.Scores = allScores; + }); + + AddUntilStep("wait for scores displayed", () => scoresContainer.ChildrenOfType().Any()); + AddAssert("best score displayed", () => scoresContainer.ChildrenOfType().Count() == 1); + + AddStep("Scores with no user best", () => + { + var allScores = createScores(); + + allScores.UserScore = null; + + scoresContainer.Scores = allScores; + }); + + AddAssert("best score not displayed", () => scoresContainer.ChildrenOfType().Count() == 1); + } + + private int onlineID = 1; + + private APIScoresCollection createScores() + { + var scores = new APIScoresCollection + { + Scores = new List + { + new APIScore + { + Date = DateTimeOffset.Now, + OnlineID = onlineID++, + User = new APIUser + { + Id = 6602580, + Username = @"waaiiru", + Country = new Country + { + FullName = @"Spain", + FlagName = @"ES", + }, + }, + Mods = new[] + { + new APIMod { Acronym = new OsuModDoubleTime().Acronym }, + new APIMod { Acronym = new OsuModHidden().Acronym }, + new APIMod { Acronym = new OsuModFlashlight().Acronym }, + new APIMod { Acronym = new OsuModHardRock().Acronym }, + }, + Rank = ScoreRank.XH, + PP = 200, + MaxCombo = 1234, + TotalScore = 1234567890, + Accuracy = 1, + }, + new APIScore + { + Date = DateTimeOffset.Now, + OnlineID = onlineID++, + User = new APIUser + { + Id = 4608074, + Username = @"Skycries", + Country = new Country + { + FullName = @"Brazil", + FlagName = @"BR", + }, + }, + Mods = new[] + { + new APIMod { Acronym = new OsuModDoubleTime().Acronym }, + new APIMod { Acronym = new OsuModHidden().Acronym }, + new APIMod { Acronym = new OsuModFlashlight().Acronym }, + }, + Rank = ScoreRank.S, + PP = 190, + MaxCombo = 1234, + TotalScore = 1234789, + Accuracy = 0.9997, + }, + new APIScore + { + Date = DateTimeOffset.Now, + OnlineID = onlineID++, + User = new APIUser + { + Id = 1014222, + Username = @"eLy", + Country = new Country + { + FullName = @"Japan", + FlagName = @"JP", + }, + }, + Mods = new[] + { + new APIMod { Acronym = new OsuModDoubleTime().Acronym }, + new APIMod { Acronym = new OsuModHidden().Acronym }, + }, + Rank = ScoreRank.B, + PP = 180, + MaxCombo = 1234, + TotalScore = 12345678, + Accuracy = 0.9854, + }, + new APIScore + { + Date = DateTimeOffset.Now, + OnlineID = onlineID++, + User = new APIUser + { + Id = 1541390, + Username = @"Toukai", + Country = new Country + { + FullName = @"Canada", + FlagName = @"CA", + }, + }, + Mods = new[] + { + new APIMod { Acronym = new OsuModDoubleTime().Acronym }, + }, + Rank = ScoreRank.C, + PP = 170, + MaxCombo = 1234, + TotalScore = 1234567, + Accuracy = 0.8765, + }, + new APIScore + { + Date = DateTimeOffset.Now, + OnlineID = onlineID++, + User = new APIUser + { + Id = 7151382, + Username = @"Mayuri Hana", + Country = new Country + { + FullName = @"Thailand", + FlagName = @"TH", + }, + }, + Rank = ScoreRank.D, + PP = 160, + MaxCombo = 1234, + TotalScore = 123456, + Accuracy = 0.6543, + }, + } + }; + + foreach (var s in scores.Scores) { s.Statistics = new Dictionary { @@ -70,155 +282,15 @@ namespace osu.Game.Tests.Visual.Online }; } - AddStep("Load all scores", () => - { - allScores.UserScore = null; - scoresContainer.Scores = allScores; - }); - AddStep("Load null scores", () => scoresContainer.Scores = null); - AddStep("Load only one score", () => scoresContainer.Scores = oneScore); - AddStep("Load scores with my best", () => - { - allScores.UserScore = myBestScore; - scoresContainer.Scores = allScores; - }); - - AddStep("Load scores with null my best position", () => - { - allScores.UserScore = myBestScoreWithNullPosition; - scoresContainer.Scores = allScores; - }); + return scores; } - private readonly APIScoresCollection allScores = new APIScoresCollection - { - Scores = new List - { - new APIScore - { - Date = DateTimeOffset.Now, - User = new APIUser - { - Id = 6602580, - Username = @"waaiiru", - Country = new Country - { - FullName = @"Spain", - FlagName = @"ES", - }, - }, - Mods = new[] - { - new APIMod { Acronym = new OsuModDoubleTime().Acronym }, - new APIMod { Acronym = new OsuModHidden().Acronym }, - new APIMod { Acronym = new OsuModFlashlight().Acronym }, - new APIMod { Acronym = new OsuModHardRock().Acronym }, - }, - Rank = ScoreRank.XH, - PP = 200, - MaxCombo = 1234, - TotalScore = 1234567890, - Accuracy = 1, - }, - new APIScore - { - Date = DateTimeOffset.Now, - User = new APIUser - { - Id = 4608074, - Username = @"Skycries", - Country = new Country - { - FullName = @"Brazil", - FlagName = @"BR", - }, - }, - Mods = new[] - { - new APIMod { Acronym = new OsuModDoubleTime().Acronym }, - new APIMod { Acronym = new OsuModHidden().Acronym }, - new APIMod { Acronym = new OsuModFlashlight().Acronym }, - }, - Rank = ScoreRank.S, - PP = 190, - MaxCombo = 1234, - TotalScore = 1234789, - Accuracy = 0.9997, - }, - new APIScore - { - Date = DateTimeOffset.Now, - User = new APIUser - { - Id = 1014222, - Username = @"eLy", - Country = new Country - { - FullName = @"Japan", - FlagName = @"JP", - }, - }, - Mods = new[] - { - new APIMod { Acronym = new OsuModDoubleTime().Acronym }, - new APIMod { Acronym = new OsuModHidden().Acronym }, - }, - Rank = ScoreRank.B, - PP = 180, - MaxCombo = 1234, - TotalScore = 12345678, - Accuracy = 0.9854, - }, - new APIScore - { - Date = DateTimeOffset.Now, - User = new APIUser - { - Id = 1541390, - Username = @"Toukai", - Country = new Country - { - FullName = @"Canada", - FlagName = @"CA", - }, - }, - Mods = new[] - { - new APIMod { Acronym = new OsuModDoubleTime().Acronym }, - }, - Rank = ScoreRank.C, - PP = 170, - MaxCombo = 1234, - TotalScore = 1234567, - Accuracy = 0.8765, - }, - new APIScore - { - Date = DateTimeOffset.Now, - User = new APIUser - { - Id = 7151382, - Username = @"Mayuri Hana", - Country = new Country - { - FullName = @"Thailand", - FlagName = @"TH", - }, - }, - Rank = ScoreRank.D, - PP = 160, - MaxCombo = 1234, - TotalScore = 123456, - Accuracy = 0.6543, - }, - } - }; - - private readonly APIScoreWithPosition myBestScore = new APIScoreWithPosition + private APIScoreWithPosition createUserBest() => new APIScoreWithPosition { Score = new APIScore { Date = DateTimeOffset.Now, + OnlineID = onlineID++, User = new APIUser { Id = 7151382, @@ -238,63 +310,6 @@ namespace osu.Game.Tests.Visual.Online Position = 1337, }; - private readonly APIScoreWithPosition myBestScoreWithNullPosition = new APIScoreWithPosition - { - Score = new APIScore - { - Date = DateTimeOffset.Now, - User = new APIUser - { - Id = 7151382, - Username = @"Mayuri Hana", - Country = new Country - { - FullName = @"Thailand", - FlagName = @"TH", - }, - }, - Rank = ScoreRank.D, - PP = 160, - MaxCombo = 1234, - TotalScore = 123456, - Accuracy = 0.6543, - }, - Position = null, - }; - - private readonly APIScoresCollection oneScore = new APIScoresCollection - { - Scores = new List - { - new APIScore - { - Date = DateTimeOffset.Now, - User = new APIUser - { - Id = 6602580, - Username = @"waaiiru", - Country = new Country - { - FullName = @"Spain", - FlagName = @"ES", - }, - }, - Mods = new[] - { - new APIMod { Acronym = new OsuModDoubleTime().Acronym }, - new APIMod { Acronym = new OsuModHidden().Acronym }, - new APIMod { Acronym = new OsuModFlashlight().Acronym }, - new APIMod { Acronym = new OsuModHardRock().Acronym }, - }, - Rank = ScoreRank.XH, - PP = 200, - MaxCombo = 1234, - TotalScore = 1234567890, - Accuracy = 1, - } - } - }; - private class TestScoresContainer : ScoresContainer { public new APIScoresCollection Scores From 0ba0b5f11abb083bcdf29f41b8b229fc160b5e4b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 17 Jan 2022 19:45:32 +0900 Subject: [PATCH 4/4] Fix test step not being `until` when it needs to be --- osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs b/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs index d4af01f772..8a304110dd 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneScoresContainer.cs @@ -135,7 +135,7 @@ namespace osu.Game.Tests.Visual.Online scoresContainer.Scores = allScores; }); - AddAssert("best score not displayed", () => scoresContainer.ChildrenOfType().Count() == 1); + AddUntilStep("best score not displayed", () => scoresContainer.ChildrenOfType().Count() == 1); } private int onlineID = 1;