1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 08:27:49 +08:00

Reorder tests for testability

This commit is contained in:
Dean Herbert 2023-07-13 01:24:09 +09:00
parent 48670308a5
commit 8c4831e09f

View File

@ -69,6 +69,30 @@ namespace osu.Game.Tests.Visual.Ranking
}));
}
[TestCase(1, ScoreRank.X)]
[TestCase(0.9999, ScoreRank.S)]
[TestCase(0.975, ScoreRank.S)]
[TestCase(0.925, ScoreRank.A)]
[TestCase(0.85, ScoreRank.B)]
[TestCase(0.75, ScoreRank.C)]
[TestCase(0.5, ScoreRank.D)]
[TestCase(0.2, ScoreRank.D)]
public void TestResultsWithPlayer(double accuracy, ScoreRank rank)
{
TestResultsScreen screen = null;
var score = TestResources.CreateTestScoreInfo();
score.OnlineID = 1234;
score.HitEvents = TestSceneStatisticsPanel.CreatePositionDistributedHitEvents();
score.Accuracy = accuracy;
score.Rank = rank;
loadResultsScreen(() => screen = createResultsScreen(score));
AddUntilStep("wait for loaded", () => screen.IsLoaded);
AddAssert("retry overlay present", () => screen.RetryOverlay != null);
}
[Test]
public void TestResultsWithoutPlayer()
{
@ -83,8 +107,6 @@ namespace osu.Game.Tests.Visual.Ranking
};
var score = TestResources.CreateTestScoreInfo();
score.OnlineID = 1234;
score.HitEvents = TestSceneStatisticsPanel.CreatePositionDistributedHitEvents();
stack.Push(screen = createResultsScreen(score));
});
@ -92,28 +114,6 @@ namespace osu.Game.Tests.Visual.Ranking
AddAssert("retry overlay not present", () => screen.RetryOverlay == null);
}
[TestCase(0.2, ScoreRank.D)]
[TestCase(0.5, ScoreRank.D)]
[TestCase(0.75, ScoreRank.C)]
[TestCase(0.85, ScoreRank.B)]
[TestCase(0.925, ScoreRank.A)]
[TestCase(0.975, ScoreRank.S)]
[TestCase(0.9999, ScoreRank.S)]
[TestCase(1, ScoreRank.X)]
public void TestResultsWithPlayer(double accuracy, ScoreRank rank)
{
TestResultsScreen screen = null;
var score = TestResources.CreateTestScoreInfo();
score.Accuracy = accuracy;
score.Rank = rank;
loadResultsScreen(() => screen = createResultsScreen(score));
AddUntilStep("wait for loaded", () => screen.IsLoaded);
AddAssert("retry overlay present", () => screen.RetryOverlay != null);
}
[Test]
public void TestResultsForUnranked()
{
@ -332,13 +332,14 @@ namespace osu.Game.Tests.Visual.Ranking
}
}
private partial class TestResultsScreen : ResultsScreen
private partial class TestResultsScreen : SoloResultsScreen
{
public HotkeyRetryOverlay RetryOverlay;
public TestResultsScreen(ScoreInfo score)
: base(score, true)
{
ShowUserStatistics = true;
}
protected override void LoadComplete()