osu/osu.Game.Tests/Visual/TestCaseResults.cs

73 lines
2.0 KiB
C#
Raw Normal View History

2018-01-05 11:21:19 +00:00
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
2017-09-18 13:32:49 +00:00
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
2018-03-02 06:34:31 +00:00
using NUnit.Framework;
2017-09-18 13:32:49 +00:00
using osu.Framework.Allocation;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Ranking;
using osu.Game.Users;
namespace osu.Game.Tests.Visual
{
2018-03-02 06:34:31 +00:00
[TestFixture]
2017-12-20 12:47:45 +00:00
public class TestCaseResults : OsuTestCase
2017-09-18 13:32:49 +00:00
{
private BeatmapManager beatmaps;
2017-12-30 21:45:02 +00:00
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(Score),
typeof(Results),
typeof(ResultsPage),
typeof(ResultsPageScore),
typeof(ResultsPageRanking)
};
2017-09-18 13:32:49 +00:00
[BackgroundDependencyLoader]
private void load(BeatmapManager beatmaps)
{
this.beatmaps = beatmaps;
}
private WorkingBeatmap beatmap;
protected override void LoadComplete()
{
base.LoadComplete();
if (beatmap == null)
{
var beatmapInfo = beatmaps.QueryBeatmap(b => b.RulesetID == 0);
if (beatmapInfo != null)
beatmap = beatmaps.GetWorkingBeatmap(beatmapInfo);
}
Add(new Results(new Score
{
TotalScore = 2845370,
Accuracy = 0.98,
MaxCombo = 123,
Rank = ScoreRank.A,
Date = DateTimeOffset.Now,
Statistics = new Dictionary<HitResult, dynamic>
2017-09-18 13:32:49 +00:00
{
{ HitResult.Great, 50 },
{ HitResult.Good, 20 },
{ HitResult.Meh, 50 },
{ HitResult.Miss, 1 }
2017-09-18 13:32:49 +00:00
},
User = new User
{
Username = "peppy",
}
})
{
InitialBeatmap = beatmap
});
}
}
}