1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-16 02:57:26 +08:00
osu-lazer/osu.Game.Tests/Visual/Ranking/TestSceneAccuracyCircle.cs

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

103 lines
3.1 KiB
C#
Raw Normal View History

2020-03-17 15:37:56 +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:37:56 +08:00
using System;
using NUnit.Framework;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Online.API.Requests.Responses;
2020-03-17 15:37:56 +08:00
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
using osu.Game.Screens.Ranking.Expanded.Accuracy;
using osu.Game.Tests.Beatmaps;
using osuTK;
namespace osu.Game.Tests.Visual.Ranking
{
public partial class TestSceneAccuracyCircle : OsuTestScene
{
[TestCase(0)]
[TestCase(0.2)]
[TestCase(0.5)]
[TestCase(0.6999)]
[TestCase(0.7)]
[TestCase(0.75)]
[TestCase(0.7999)]
[TestCase(0.8)]
[TestCase(0.85)]
[TestCase(0.8999)]
[TestCase(0.9)]
[TestCase(0.925)]
[TestCase(0.9499)]
[TestCase(0.95)]
[TestCase(0.975)]
[TestCase(0.9999)]
[TestCase(1)]
public void TestRank(double accuracy)
2020-03-19 10:58:52 +08:00
{
var score = createScore(accuracy, ScoreProcessor.RankFromAccuracy(accuracy));
2020-03-17 15:37:56 +08:00
addCircleStep(score);
}
private void addCircleStep(ScoreInfo score) => AddStep("add panel", () =>
{
Children = new Drawable[]
{
new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(500, 700),
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = ColourInfo.GradientVertical(Color4Extensions.FromHex("#555"), Color4Extensions.FromHex("#333"))
}
}
},
new AccuracyCircle(score, true)
2020-03-17 15:37:56 +08:00
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(230)
}
};
});
private ScoreInfo createScore(double accuracy, ScoreRank rank) => new ScoreInfo
2020-03-17 15:37:56 +08:00
{
User = new APIUser
2020-03-17 15:37:56 +08:00
{
Id = 2,
Username = "peppy",
},
BeatmapInfo = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo,
2022-01-04 14:59:41 +08:00
Ruleset = new OsuRuleset().RulesetInfo,
2020-03-17 15:37:56 +08:00
Mods = new Mod[] { new OsuModHardRock(), new OsuModDoubleTime() },
TotalScore = 2845370,
Accuracy = accuracy,
2020-03-17 15:37:56 +08:00
MaxCombo = 999,
Rank = rank,
2020-03-17 15:37:56 +08:00
Date = DateTimeOffset.Now,
Statistics =
{
{ HitResult.Miss, 1 },
{ HitResult.Meh, 50 },
{ HitResult.Good, 100 },
{ HitResult.Great, 300 },
}
};
}
}