mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 15:33:05 +08:00
Add test coverage for all added features
This commit is contained in:
parent
9fa39cd34e
commit
391c4e529c
@ -1,12 +1,16 @@
|
||||
// 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.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Overlays;
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Users;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Overlays.Rankings;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Taiko;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
@ -35,6 +39,44 @@ namespace osu.Game.Tests.Visual.Online
|
||||
AddStep("Show", rankingsOverlay.Show);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRulesetResetsOnNoFilters()
|
||||
{
|
||||
AddStep("Set different ruleset", () => rankingsOverlay.ChildrenOfType<RulesetSelector>().Single().SwitchTab(1));
|
||||
AddAssert("Ruleset not default", () => !rankingsOverlay.Header.Ruleset.IsDefault);
|
||||
AddStep("Hide overlay", () => rankingsOverlay.Hide());
|
||||
AddUntilStep("Wait for hide", () => !rankingsOverlay.IsPresent);
|
||||
|
||||
AddStep("Show overlay again", () => rankingsOverlay.Show());
|
||||
AddAssert("Ruleset reverted", () => rankingsOverlay.Header.Ruleset.IsDefault);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRulesetDoesntResetOnCountryFilter()
|
||||
{
|
||||
AddStep("Set different ruleset", () => rankingsOverlay.ChildrenOfType<RulesetSelector>().Single().SwitchTab(1));
|
||||
AddAssert("Ruleset not default", () => !rankingsOverlay.Header.Ruleset.IsDefault);
|
||||
AddStep("Set country filter", () => countryBindable.Value = us_country);
|
||||
AddStep("Hide overlay", () => rankingsOverlay.Hide());
|
||||
AddUntilStep("Wait for hide", () => !rankingsOverlay.IsPresent);
|
||||
|
||||
AddStep("Show overlay again", () => rankingsOverlay.Show());
|
||||
AddAssert("Ruleset not reverted", () => !rankingsOverlay.Header.Ruleset.IsDefault);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRulesetDoesntResetOnScopeChange()
|
||||
{
|
||||
AddStep("Set ruleset to osu!taiko", () => rankingsOverlay.Header.Ruleset.Value = new TaikoRuleset().RulesetInfo);
|
||||
AddAssert("Ruleset not default", () => !rankingsOverlay.Header.Ruleset.IsDefault);
|
||||
AddStep("Set different scope", () => scope.Value = RankingsScope.Score);
|
||||
AddStep("Hide overlay", () => rankingsOverlay.Hide());
|
||||
AddUntilStep("Wait for hide", () => !rankingsOverlay.IsPresent);
|
||||
|
||||
AddStep("Show overlay again", () => rankingsOverlay.Show());
|
||||
AddAssert("Ruleset not reverted", () => !rankingsOverlay.Header.Ruleset.IsDefault);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestFlagScopeDependency()
|
||||
{
|
||||
|
@ -70,5 +70,27 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
AddStep("Select catch", () => ruleset.Value = new CatchRuleset().RulesetInfo);
|
||||
AddAssert("Check catch selected", () => selector.Current.Value.Equals(new CatchRuleset().RulesetInfo));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestUserPreferredRuleset()
|
||||
{
|
||||
OverlayRulesetSelector localSelector = null;
|
||||
|
||||
AddStep("Set osu! preferred ruleset", () => API.LocalUser.Value.PlayMode = OsuRuleset.SHORT_NAME);
|
||||
AddStep("load overlay ruleset selector", () => Child = localSelector = new OverlayRulesetSelector());
|
||||
AddAssert("Check osu! selected", () => localSelector.Current.Value.Equals(new OsuRuleset().RulesetInfo));
|
||||
|
||||
AddStep("Set osu!taiko preferred ruleset", () => API.LocalUser.Value.PlayMode = TaikoRuleset.SHORT_NAME);
|
||||
AddStep("load overlay ruleset selector", () => Child = localSelector = new OverlayRulesetSelector());
|
||||
AddAssert("Check osu!taiko selected", () => localSelector.Current.Value.Equals(new TaikoRuleset().RulesetInfo));
|
||||
|
||||
AddStep("Set osu!catch preferred ruleset", () => API.LocalUser.Value.PlayMode = CatchRuleset.SHORT_NAME);
|
||||
AddStep("load overlay ruleset selector", () => Child = localSelector = new OverlayRulesetSelector());
|
||||
AddAssert("Check osu!catch selected", () => localSelector.Current.Value.Equals(new CatchRuleset().RulesetInfo));
|
||||
|
||||
AddStep("Set osu!mania preferred ruleset", () => API.LocalUser.Value.PlayMode = ManiaRuleset.SHORT_NAME);
|
||||
AddStep("load overlay ruleset selector", () => Child = localSelector = new OverlayRulesetSelector());
|
||||
AddAssert("Check osu!mania selected", () => localSelector.Current.Value.Equals(new ManiaRuleset().RulesetInfo));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user