osu/osu.Game.Tests/Visual/Online/TestSceneRankingsHeader.cs

76 lines
2.3 KiB
C#
Raw Normal View History

2019-09-12 02:53:18 +00: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 System.Collections.Generic;
using osu.Framework.Allocation;
2019-09-12 02:53:18 +00:00
using osu.Framework.Bindables;
using osu.Game.Overlays;
2019-09-12 02:53:18 +00:00
using osu.Game.Overlays.Rankings;
using osu.Game.Rulesets;
using osu.Game.Users;
namespace osu.Game.Tests.Visual.Online
{
public class TestSceneRankingsHeader : OsuTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(RankingsOverlayHeader),
2020-02-03 17:32:20 +00:00
typeof(CountryFilter),
2020-02-03 17:59:08 +00:00
typeof(CountryPill)
2019-09-12 02:53:18 +00:00
};
[Cached]
private readonly OverlayColourProvider overlayColour = new OverlayColourProvider(OverlayColourScheme.Green);
2019-09-12 02:53:18 +00:00
public TestSceneRankingsHeader()
{
var countryBindable = new Bindable<Country>();
var ruleset = new Bindable<RulesetInfo>();
var scope = new Bindable<RankingsScope>();
Add(new RankingsOverlayHeader
2019-09-12 02:53:18 +00:00
{
Current = { BindTarget = scope },
2019-09-12 02:53:18 +00:00
Country = { BindTarget = countryBindable },
Ruleset = { BindTarget = ruleset },
2019-09-12 03:36:17 +00:00
Spotlights = new[]
{
new Spotlight
{
Id = 1,
Text = "Spotlight 1"
},
new Spotlight
{
Id = 2,
Text = "Spotlight 2"
},
new Spotlight
{
Id = 3,
2019-09-13 07:59:09 +00:00
Text = "Spotlight 3"
2019-09-12 03:36:17 +00:00
}
}
2019-09-12 02:53:18 +00:00
});
var country = new Country
{
FlagName = "BY",
FullName = "Belarus"
};
var unknownCountry = new Country
{
FlagName = "CK",
FullName = "Cook Islands"
};
2019-09-12 02:53:18 +00:00
AddStep("Set country", () => countryBindable.Value = country);
AddStep("Set scope to Score", () => scope.Value = RankingsScope.Score);
AddStep("Set country with no flag", () => countryBindable.Value = unknownCountry);
2019-09-12 02:53:18 +00:00
}
}
}