1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-16 10:17:36 +08:00
osu-lazer/osu.Game.Tests/Visual/Online/TestSceneUserHistoryGraph.cs

57 lines
2.4 KiB
C#
Raw Normal View History

2020-02-08 05:10:17 +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.
using System;
using osu.Framework.Allocation;
2020-02-08 05:10:17 +08:00
using osu.Framework.Graphics;
using osu.Game.Online.API.Requests.Responses;
2020-02-08 05:10:17 +08:00
using osu.Game.Overlays;
using osu.Game.Overlays.Profile.Sections.Historical;
2020-02-08 05:10:17 +08:00
namespace osu.Game.Tests.Visual.Online
{
2022-11-24 13:32:20 +08:00
public partial class TestSceneUserHistoryGraph : OsuTestScene
2020-02-08 05:10:17 +08:00
{
[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Pink);
public TestSceneUserHistoryGraph()
{
2020-03-10 05:50:12 +08:00
UserHistoryGraph graph;
2020-02-08 05:10:17 +08:00
Add(graph = new UserHistoryGraph("Test")
2020-02-08 05:10:17 +08:00
{
RelativeSizeAxes = Axes.X,
Height = 200,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
});
var values = new[]
{
new APIUserHistoryCount { Date = new DateTime(2000, 1, 1), Count = 10 },
new APIUserHistoryCount { Date = new DateTime(2000, 2, 1), Count = 20 },
new APIUserHistoryCount { Date = new DateTime(2000, 3, 1), Count = 100 },
new APIUserHistoryCount { Date = new DateTime(2000, 4, 1), Count = 15 },
new APIUserHistoryCount { Date = new DateTime(2000, 5, 1), Count = 30 }
2020-02-08 05:10:17 +08:00
};
var moreValues = new[]
{
new APIUserHistoryCount { Date = new DateTime(2010, 5, 1), Count = 1000 },
new APIUserHistoryCount { Date = new DateTime(2010, 6, 1), Count = 20 },
new APIUserHistoryCount { Date = new DateTime(2010, 7, 1), Count = 20000 },
new APIUserHistoryCount { Date = new DateTime(2010, 8, 1), Count = 30 },
new APIUserHistoryCount { Date = new DateTime(2010, 9, 1), Count = 50 },
new APIUserHistoryCount { Date = new DateTime(2010, 10, 1), Count = 2000 },
new APIUserHistoryCount { Date = new DateTime(2010, 11, 1), Count = 2100 }
2020-02-08 05:10:17 +08:00
};
AddStep("Set fake values", () => graph.Values = values);
AddStep("Set more values", () => graph.Values = moreValues);
AddStep("Set null values", () => graph.Values = null);
AddStep("Set empty values", () => graph.Values = Array.Empty<APIUserHistoryCount>());
2020-02-08 05:10:17 +08:00
}
}
}