mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 06:42:54 +08:00
Add test for accuracy heatmap to TestCaseStatisticsPanel
This commit is contained in:
parent
ef5e3d5ab8
commit
85017a0094
@ -1,19 +1,24 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Screens.Ranking.Statistics;
|
using osu.Game.Screens.Ranking.Statistics;
|
||||||
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Ranking
|
namespace osu.Game.Tests.Visual.Ranking
|
||||||
{
|
{
|
||||||
public class TestSceneStatisticsPanel : OsuTestScene
|
public class TestSceneStatisticsPanel : OsuTestScene
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
public void TestScoreWithStatistics()
|
public void TestScoreWithTimeStatistics()
|
||||||
{
|
{
|
||||||
var score = new TestScoreInfo(new OsuRuleset().RulesetInfo)
|
var score = new TestScoreInfo(new OsuRuleset().RulesetInfo)
|
||||||
{
|
{
|
||||||
@ -23,6 +28,17 @@ namespace osu.Game.Tests.Visual.Ranking
|
|||||||
loadPanel(score);
|
loadPanel(score);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestScoreWithPositionStatistics()
|
||||||
|
{
|
||||||
|
var score = new TestScoreInfo(new OsuRuleset().RulesetInfo)
|
||||||
|
{
|
||||||
|
HitEvents = CreatePositionDistributedHitEvents()
|
||||||
|
};
|
||||||
|
|
||||||
|
loadPanel(score);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestScoreWithoutStatistics()
|
public void TestScoreWithoutStatistics()
|
||||||
{
|
{
|
||||||
@ -44,5 +60,24 @@ namespace osu.Game.Tests.Visual.Ranking
|
|||||||
Score = { Value = score }
|
Score = { Value = score }
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
public static List<HitEvent> CreatePositionDistributedHitEvents()
|
||||||
|
{
|
||||||
|
var hitEvents = new List<HitEvent>();
|
||||||
|
// Use constant seed for reproducibility
|
||||||
|
var random = new Random(0);
|
||||||
|
|
||||||
|
for (int i = 0; i < 500; i++)
|
||||||
|
{
|
||||||
|
float angle = (float) random.NextDouble() * 2 * (float) Math.PI;
|
||||||
|
float radius = (float) random.NextDouble() * 0.5f * HitCircle.OBJECT_RADIUS;
|
||||||
|
|
||||||
|
Vector2 position = new Vector2(radius * (float) Math.Cos(angle), radius * (float) Math.Sin(angle));
|
||||||
|
|
||||||
|
hitEvents.Add(new HitEvent(0, HitResult.Perfect, new HitCircle(), new HitCircle(), position));
|
||||||
|
}
|
||||||
|
|
||||||
|
return hitEvents;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user