-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Expand file tree
/
Copy pathTestSceneLeaderboardStatistic.cs
More file actions
114 lines (105 loc) · 3.87 KB
/
TestSceneLeaderboardStatistic.cs
File metadata and controls
114 lines (105 loc) · 3.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// 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 NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Testing;
using osu.Game.Graphics;
using osu.Game.Online.Leaderboards;
using osu.Game.Overlays;
using osuTK;
namespace osu.Game.Tests.Visual.Online
{
public partial class TestSceneLeaderboardStatistic : OsuTestScene
{
[Cached]
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Aquamarine);
[Cached]
private OsuColour colours = new OsuColour();
private FillFlowContainer container = null!;
private LeaderboardStatistic[] statistics = [];
[SetUpSteps]
public void SetUpSteps()
{
AddStep("create container", () =>
{
Child = new Container
{
Masking = true,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
AutoSizeAxes = Axes.X,
Height = 50,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colours.Gray3,
},
container = new FillFlowContainer
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Direction = FillDirection.Horizontal,
AutoSizeAxes = Axes.Both,
Margin = new MarginPadding { Horizontal = 20 },
Spacing = new Vector2(20, 0)
},
},
};
});
}
[Test]
public void TestTwoElements()
{
AddStep("create content", () =>
{
container.AddRange(statistics = new[]
{
new LeaderboardStatistic("COMBO", "123x", false),
new LeaderboardStatistic("ACCURACY", "100.00%", true),
});
});
AddStep("change to vertical", () =>
{
container.Direction = FillDirection.Vertical;
container.ScaleTo(0.8f, 200, Easing.OutQuint);
});
AddStep("change to horizontal", () =>
{
container.Direction = FillDirection.Horizontal;
container.ScaleTo(1, 200, Easing.OutQuint);
});
}
[Test]
public void TestThreeElements()
{
AddStep("create content", () =>
{
container.AddRange(statistics = new[]
{
new LeaderboardStatistic("COMBO", "123x", false),
new LeaderboardStatistic("ACCURACY", "100.00%", true),
new LeaderboardStatistic("TEST", "12345", false),
});
});
AddStep("change to vertical", () =>
{
container.Direction = FillDirection.Vertical;
container.ScaleTo(0.8f, 200, Easing.OutQuint);
foreach (var statistic in statistics)
statistic.Direction = Direction.Vertical;
});
AddStep("change to horizontal", () =>
{
container.Direction = FillDirection.Horizontal;
container.ScaleTo(1, 200, Easing.OutQuint);
foreach (var statistic in statistics)
statistic.Direction = Direction.Horizontal;
});
}
}
}