2017-04-18 21:35:21 +08:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using System;
|
2017-04-20 10:02:56 +08:00
|
|
|
|
using System.Collections.Generic;
|
2017-04-18 20:36:34 +08:00
|
|
|
|
using System.Linq;
|
2017-04-11 13:01:13 +08:00
|
|
|
|
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;
|
|
|
|
|
|
2017-07-07 20:05:55 +08:00
|
|
|
|
protected override void LoadComplete()
|
2017-04-11 13:01:13 +08:00
|
|
|
|
{
|
2017-07-07 20:05:55 +08:00
|
|
|
|
base.LoadComplete();
|
2017-04-11 13:01:13 +08:00
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-20 10:02:56 +08:00
|
|
|
|
Add(new Results(new Score
|
2017-04-11 13:01:13 +08:00
|
|
|
|
{
|
|
|
|
|
TotalScore = 2845370,
|
|
|
|
|
Accuracy = 0.98,
|
2017-04-18 20:35:41 +08:00
|
|
|
|
MaxCombo = 123,
|
2017-04-11 13:01:13 +08:00
|
|
|
|
Rank = ScoreRank.A,
|
2017-05-16 21:14:50 +08:00
|
|
|
|
Date = DateTimeOffset.Now,
|
2017-04-20 10:02:56 +08:00
|
|
|
|
Statistics = new Dictionary<string, dynamic>()
|
|
|
|
|
{
|
|
|
|
|
{ "300", 50 },
|
|
|
|
|
{ "100", 20 },
|
|
|
|
|
{ "50", 50 },
|
|
|
|
|
{ "x", 1 }
|
|
|
|
|
},
|
2017-04-11 13:01:13 +08:00
|
|
|
|
User = new User
|
|
|
|
|
{
|
|
|
|
|
Username = "peppy",
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
{
|
|
|
|
|
Beatmap = beatmap
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-04-20 10:02:56 +08:00
|
|
|
|
}
|