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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

137 lines
3.5 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.
2022-06-17 15:37:17 +08:00
#nullable disable
2020-03-17 15:59:34 +08:00
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
using osu.Game.Screens.Ranking;
using osu.Game.Tests.Resources;
2020-03-17 15:59:34 +08:00
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()
{
var score = TestResources.CreateTestScoreInfo();
score.Accuracy = 0.5;
score.Rank = ScoreRank.D;
2020-03-17 15:59:34 +08:00
addPanelStep(score);
}
[Test]
public void TestCRank()
{
var score = TestResources.CreateTestScoreInfo();
score.Accuracy = 0.75;
score.Rank = ScoreRank.C;
2020-03-17 15:59:34 +08:00
addPanelStep(score);
}
[Test]
public void TestBRank()
{
var score = TestResources.CreateTestScoreInfo();
score.Accuracy = 0.85;
score.Rank = ScoreRank.B;
2020-03-17 15:59:34 +08:00
addPanelStep(score);
}
[Test]
public void TestARank()
{
var score = TestResources.CreateTestScoreInfo();
score.Accuracy = 0.925;
score.Rank = ScoreRank.A;
2020-03-17 15:59:34 +08:00
addPanelStep(score);
}
[Test]
public void TestSRank()
{
var score = TestResources.CreateTestScoreInfo();
score.Accuracy = 0.975;
score.Rank = ScoreRank.S;
2020-03-17 15:59:34 +08:00
addPanelStep(score);
}
[Test]
public void TestAlmostSSRank()
{
var score = TestResources.CreateTestScoreInfo();
score.Accuracy = 0.9999;
score.Rank = ScoreRank.S;
2020-03-17 15:59:34 +08:00
addPanelStep(score);
}
[Test]
public void TestSSRank()
{
var score = TestResources.CreateTestScoreInfo();
score.Accuracy = 1;
score.Rank = ScoreRank.X;
2020-03-17 15:59:34 +08:00
addPanelStep(score);
}
[Test]
public void TestAllHitResults()
{
var score = TestResources.CreateTestScoreInfo();
score.Statistics[HitResult.Perfect] = 350;
score.Statistics[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()
{
var score = TestResources.CreateTestScoreInfo();
score.Accuracy = 0.925;
score.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 = TestResources.CreateTestScoreInfo();
score.Accuracy = 0.925;
score.Rank = ScoreRank.A;
2020-05-26 15:26:58 +08:00
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
{
Child = panel = new ScorePanel(score, true)
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
};
});
}
}