Add visual and failing test cases

This commit is contained in:
Salman Ahmed 2024-01-27 01:45:22 +03:00
parent 2778e43713
commit 2ccd0e3692

View File

@ -26,8 +26,10 @@ using osu.Game.Scoring;
using osu.Game.Screens;
using osu.Game.Screens.Play;
using osu.Game.Screens.Ranking;
using osu.Game.Screens.Ranking.Expanded.Accuracy;
using osu.Game.Screens.Ranking.Expanded.Statistics;
using osu.Game.Screens.Ranking.Statistics;
using osu.Game.Skinning;
using osu.Game.Tests.Resources;
using osuTK;
using osuTK.Input;
@ -44,6 +46,9 @@ namespace osu.Game.Tests.Visual.Ranking
[Resolved]
private RealmAccess realm { get; set; }
[Resolved]
private SkinManager skins { get; set; }
protected override void LoadComplete()
{
base.LoadComplete();
@ -59,6 +64,9 @@ namespace osu.Game.Tests.Visual.Ranking
});
}
[SetUp]
public void SetUp() => Schedule(() => skins.CurrentSkinInfo.SetDefault());
[Test]
public void TestScaling()
{
@ -132,6 +140,46 @@ namespace osu.Game.Tests.Visual.Ranking
AddAssert("retry overlay present", () => screen.RetryOverlay != null);
}
[Test]
public void TestResultsWithFailingRank()
{
TestResultsScreen screen = null;
loadResultsScreen(() =>
{
var score = TestResources.CreateTestScoreInfo();
score.OnlineID = onlineScoreID++;
score.HitEvents = TestSceneStatisticsPanel.CreatePositionDistributedHitEvents();
score.Rank = ScoreRank.F;
return screen = createResultsScreen(score);
});
AddUntilStep("wait for loaded", () => screen.IsLoaded);
AddAssert("retry overlay present", () => screen.RetryOverlay != null);
AddAssert("no badges displayed", () => this.ChildrenOfType<RankBadge>().All(b => !b.IsPresent));
}
[Test]
public void TestResultsWithFailingRankOnLegacySkin()
{
TestResultsScreen screen = null;
AddStep("set legacy skin", () => skins.CurrentSkinInfo.Value = skins.DefaultClassicSkin.SkinInfo);
loadResultsScreen(() =>
{
var score = TestResources.CreateTestScoreInfo();
score.OnlineID = onlineScoreID++;
score.HitEvents = TestSceneStatisticsPanel.CreatePositionDistributedHitEvents();
score.Rank = ScoreRank.F;
return screen = createResultsScreen(score);
});
AddUntilStep("wait for loaded", () => screen.IsLoaded);
AddAssert("retry overlay present", () => screen.RetryOverlay != null);
AddAssert("no badges displayed", () => this.ChildrenOfType<RankBadge>().All(b => !b.IsPresent));
}
[Test]
public void TestShowHideStatisticsViaOutsideClick()
{