2019-11-30 00:01:07 +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 osu.Framework.Allocation;
|
|
|
|
|
using osu.Game.Overlays;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using osu.Game.Users;
|
2019-12-05 06:53:25 +00:00
|
|
|
|
using osu.Framework.Bindables;
|
|
|
|
|
using osu.Game.Overlays.Rankings;
|
2019-11-30 00:01:07 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Tests.Visual.Online
|
|
|
|
|
{
|
|
|
|
|
public class TestSceneRankingsOverlay : OsuTestScene
|
|
|
|
|
{
|
|
|
|
|
protected override bool UseOnlineAPI => true;
|
|
|
|
|
|
2020-02-19 14:09:22 +00:00
|
|
|
|
[Cached(typeof(RankingsOverlay))]
|
|
|
|
|
private readonly RankingsOverlay rankingsOverlay;
|
2019-11-30 00:01:07 +00:00
|
|
|
|
|
2019-12-05 06:53:25 +00:00
|
|
|
|
private readonly Bindable<Country> countryBindable = new Bindable<Country>();
|
|
|
|
|
private readonly Bindable<RankingsScope> scope = new Bindable<RankingsScope>();
|
|
|
|
|
|
2019-11-30 00:01:07 +00:00
|
|
|
|
public TestSceneRankingsOverlay()
|
|
|
|
|
{
|
2019-12-05 06:53:25 +00:00
|
|
|
|
Add(rankingsOverlay = new TestRankingsOverlay
|
|
|
|
|
{
|
|
|
|
|
Country = { BindTarget = countryBindable },
|
2021-02-09 09:48:50 +00:00
|
|
|
|
Header = { Current = { BindTarget = scope } },
|
2019-12-05 06:53:25 +00:00
|
|
|
|
});
|
2019-11-30 00:01:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestShow()
|
|
|
|
|
{
|
|
|
|
|
AddStep("Show", rankingsOverlay.Show);
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-05 06:53:25 +00:00
|
|
|
|
[Test]
|
|
|
|
|
public void TestFlagScopeDependency()
|
|
|
|
|
{
|
|
|
|
|
AddStep("Set scope to Score", () => scope.Value = RankingsScope.Score);
|
|
|
|
|
AddAssert("Check country is Null", () => countryBindable.Value == null);
|
|
|
|
|
AddStep("Set country", () => countryBindable.Value = us_country);
|
|
|
|
|
AddAssert("Check scope is Performance", () => scope.Value == RankingsScope.Performance);
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-30 00:01:07 +00:00
|
|
|
|
[Test]
|
|
|
|
|
public void TestShowCountry()
|
|
|
|
|
{
|
2019-12-05 06:53:25 +00:00
|
|
|
|
AddStep("Show US", () => rankingsOverlay.ShowCountry(us_country));
|
2019-11-30 00:01:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void TestHide()
|
|
|
|
|
{
|
|
|
|
|
AddStep("Hide", rankingsOverlay.Hide);
|
|
|
|
|
}
|
2019-12-05 06:53:25 +00:00
|
|
|
|
|
2019-12-05 07:05:04 +00:00
|
|
|
|
private static readonly Country us_country = new Country
|
2019-12-05 06:53:25 +00:00
|
|
|
|
{
|
|
|
|
|
FlagName = "US",
|
|
|
|
|
FullName = "United States"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private class TestRankingsOverlay : RankingsOverlay
|
|
|
|
|
{
|
|
|
|
|
public new Bindable<Country> Country => base.Country;
|
|
|
|
|
}
|
2019-11-30 00:01:07 +00:00
|
|
|
|
}
|
|
|
|
|
}
|