2017-04-11 13:01:13 +08:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Testing;
|
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
using osu.Game.Database;
|
2017-04-18 14:16:50 +08:00
|
|
|
|
using osu.Game.Rulesets.Scoring;
|
2017-04-11 13:01:13 +08:00
|
|
|
|
using osu.Game.Screens.Ranking;
|
|
|
|
|
using osu.Game.Users;
|
|
|
|
|
|
|
|
|
|
namespace osu.Desktop.VisualTests.Tests
|
|
|
|
|
{
|
|
|
|
|
internal class TestCaseResults : TestCase
|
|
|
|
|
{
|
|
|
|
|
private BeatmapDatabase db;
|
|
|
|
|
|
|
|
|
|
public override string Description => @"Results after playing.";
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(BeatmapDatabase db)
|
|
|
|
|
{
|
|
|
|
|
this.db = db;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private WorkingBeatmap beatmap;
|
|
|
|
|
|
|
|
|
|
public override void Reset()
|
|
|
|
|
{
|
|
|
|
|
base.Reset();
|
|
|
|
|
|
|
|
|
|
if (beatmap == null)
|
|
|
|
|
{
|
2017-04-18 14:16:50 +08:00
|
|
|
|
var beatmapInfo = db.Query<BeatmapInfo>().FirstOrDefault(b => b.RulesetID == 0);
|
2017-04-11 13:01:13 +08:00
|
|
|
|
if (beatmapInfo != null)
|
|
|
|
|
beatmap = db.GetWorkingBeatmap(beatmapInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
base.Reset();
|
|
|
|
|
|
2017-04-11 14:56:52 +08:00
|
|
|
|
Add(new Results(new Score
|
2017-04-11 13:01:13 +08:00
|
|
|
|
{
|
|
|
|
|
TotalScore = 2845370,
|
|
|
|
|
Accuracy = 0.98,
|
|
|
|
|
Rank = ScoreRank.A,
|
|
|
|
|
User = new User
|
|
|
|
|
{
|
|
|
|
|
Username = "peppy",
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
{
|
|
|
|
|
Beatmap = beatmap
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|