1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-16 00:52:59 +08:00
osu-lazer/osu.Game.Tests/Visual/Ranking/TestSceneScorePanel.cs

115 lines
3.3 KiB
C#
Raw Normal View History

2020-03-17 15:59:34 +08:00
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
using osu.Game.Screens.Ranking;
namespace osu.Game.Tests.Visual.Ranking
{
public class TestSceneScorePanel : OsuTestScene
{
2020-05-26 15:26:58 +08:00
private ScorePanel panel;
2020-03-17 15:59:34 +08:00
[Test]
public void TestDRank()
{
2020-05-21 17:39:22 +08:00
var score = new TestScoreInfo(new OsuRuleset().RulesetInfo) { Accuracy = 0.5, Rank = ScoreRank.D };
2020-03-17 15:59:34 +08:00
addPanelStep(score);
}
[Test]
public void TestCRank()
{
2020-05-21 17:39:22 +08:00
var score = new TestScoreInfo(new OsuRuleset().RulesetInfo) { Accuracy = 0.75, Rank = ScoreRank.C };
2020-03-17 15:59:34 +08:00
addPanelStep(score);
}
[Test]
public void TestBRank()
{
2020-05-21 17:39:22 +08:00
var score = new TestScoreInfo(new OsuRuleset().RulesetInfo) { Accuracy = 0.85, Rank = ScoreRank.B };
2020-03-17 15:59:34 +08:00
addPanelStep(score);
}
[Test]
public void TestARank()
{
2020-05-21 17:39:22 +08:00
var score = new TestScoreInfo(new OsuRuleset().RulesetInfo) { Accuracy = 0.925, Rank = ScoreRank.A };
2020-03-17 15:59:34 +08:00
addPanelStep(score);
}
[Test]
public void TestSRank()
{
2020-05-21 17:39:22 +08:00
var score = new TestScoreInfo(new OsuRuleset().RulesetInfo) { Accuracy = 0.975, Rank = ScoreRank.S };
2020-03-17 15:59:34 +08:00
addPanelStep(score);
}
[Test]
public void TestAlmostSSRank()
{
2020-05-21 17:39:22 +08:00
var score = new TestScoreInfo(new OsuRuleset().RulesetInfo) { Accuracy = 0.9999, Rank = ScoreRank.S };
2020-03-17 15:59:34 +08:00
addPanelStep(score);
}
[Test]
public void TestSSRank()
{
2020-05-21 17:39:22 +08:00
var score = new TestScoreInfo(new OsuRuleset().RulesetInfo) { Accuracy = 1, Rank = ScoreRank.X };
2020-03-17 15:59:34 +08:00
addPanelStep(score);
}
[Test]
public void TestAllHitResults()
{
2020-05-21 17:39:22 +08:00
var score = new TestScoreInfo(new OsuRuleset().RulesetInfo) { Statistics = { [HitResult.Perfect] = 350, [HitResult.Ok] = 200 } };
2020-03-17 15:59:34 +08:00
addPanelStep(score);
}
2020-05-16 17:22:07 +08:00
[Test]
public void TestContractedPanel()
{
2020-05-21 17:39:22 +08:00
var score = new TestScoreInfo(new OsuRuleset().RulesetInfo) { Accuracy = 0.925, Rank = ScoreRank.A };
2020-05-16 17:22:07 +08:00
addPanelStep(score, PanelState.Contracted);
}
2020-05-26 15:26:58 +08:00
[Test]
public void TestExpandAndContract()
{
var score = new TestScoreInfo(new OsuRuleset().RulesetInfo) { Accuracy = 0.925, Rank = ScoreRank.A };
addPanelStep(score, PanelState.Contracted);
AddWaitStep("wait for transition", 10);
AddStep("expand panel", () => panel.State = PanelState.Expanded);
AddWaitStep("wait for transition", 10);
AddStep("contract panel", () => panel.State = PanelState.Contracted);
AddWaitStep("wait for transition", 10);
}
2020-05-16 17:22:07 +08:00
private void addPanelStep(ScoreInfo score, PanelState state = PanelState.Expanded) => AddStep("add panel", () =>
2020-03-17 15:59:34 +08:00
{
2020-05-26 15:26:58 +08:00
Child = panel = new ScorePanel(score)
2020-03-17 15:59:34 +08:00
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
2020-05-16 17:22:07 +08:00
State = state
2020-03-17 15:59:34 +08:00
};
});
}
}