Skip to content

Commit

Permalink
Merge pull request #1 from ppy/master
Browse files Browse the repository at this point in the history
Merge ppy:master into master
  • Loading branch information
recapitalverb authored Feb 4, 2020
2 parents 76ba0b8 + d627d2f commit 1f2d710
Show file tree
Hide file tree
Showing 62 changed files with 915 additions and 1,001 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ private void performFullSetup(bool allowPause = false)

private void setupUserSettings()
{
AddUntilStep("Song select has selection", () => songSelect.Carousel.SelectedBeatmap != null);
AddUntilStep("Song select has selection", () => songSelect.Carousel?.SelectedBeatmap != null);
AddStep("Set default user settings", () =>
{
SelectedMods.Value = SelectedMods.Value.Concat(new[] { new OsuModNoFail() }).ToArray();
Expand Down
40 changes: 39 additions & 1 deletion osu.Game.Tests/Visual/Gameplay/TestSceneHUDOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,26 @@
// See the LICENCE file in the repository root for full licence text.

using System;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Configuration;
using osu.Game.Rulesets.Mods;
using osu.Game.Screens.Play;
using osuTK.Input;

namespace osu.Game.Tests.Visual.Gameplay
{
public class TestSceneHUDOverlay : ManualInputManagerTestScene
{
private HUDOverlay hudOverlay;

private Drawable hideTarget => hudOverlay.KeyCounter; // best way of checking hideTargets without exposing.
// best way to check without exposing.
private Drawable hideTarget => hudOverlay.KeyCounter;
private FillFlowContainer<KeyCounter> keyCounterFlow => hudOverlay.KeyCounter.ChildrenOfType<FillFlowContainer<KeyCounter>>().First();

[Resolved]
private OsuConfigManager config { get; set; }
Expand All @@ -28,6 +34,7 @@ public void TestShownByDefault()
AddAssert("showhud is set", () => hudOverlay.ShowHud.Value);

AddAssert("hidetarget is visible", () => hideTarget.IsPresent);
AddAssert("key counter flow is visible", () => keyCounterFlow.IsPresent);
AddAssert("pause button is visible", () => hudOverlay.HoldToQuit.IsPresent);
}

Expand All @@ -50,6 +57,9 @@ public void TestHideExternally()

AddUntilStep("hidetarget is hidden", () => !hideTarget.IsPresent);
AddAssert("pause button is still visible", () => hudOverlay.HoldToQuit.IsPresent);

// Key counter flow container should not be affected by this, only the key counter display will be hidden as checked above.
AddAssert("key counter flow not affected", () => keyCounterFlow.IsPresent);
}

[Test]
Expand All @@ -68,12 +78,40 @@ public void TestExternalHideDoesntAffectConfig()
AddAssert("config unchanged", () => originalConfigValue == config.Get<bool>(OsuSetting.ShowInterface));
}

[Test]
public void TestChangeHUDVisibilityOnHiddenKeyCounter()
{
bool keyCounterVisibleValue = false;

createNew();
AddStep("save keycounter visible value", () => keyCounterVisibleValue = config.Get<bool>(OsuSetting.KeyOverlay));

AddStep("set keycounter visible false", () =>
{
config.Set<bool>(OsuSetting.KeyOverlay, false);
hudOverlay.KeyCounter.AlwaysVisible.Value = false;
});

AddStep("set showhud false", () => hudOverlay.ShowHud.Value = false);
AddUntilStep("hidetarget is hidden", () => !hideTarget.IsPresent);
AddAssert("key counters hidden", () => !keyCounterFlow.IsPresent);

AddStep("set showhud true", () => hudOverlay.ShowHud.Value = true);
AddUntilStep("hidetarget is visible", () => hideTarget.IsPresent);
AddAssert("key counters still hidden", () => !keyCounterFlow.IsPresent);

AddStep("return value", () => config.Set<bool>(OsuSetting.KeyOverlay, keyCounterVisibleValue));
}

private void createNew(Action<HUDOverlay> action = null)
{
AddStep("create overlay", () =>
{
Child = hudOverlay = new HUDOverlay(null, null, null, Array.Empty<Mod>());

// Add any key just to display the key counter visually.
hudOverlay.KeyCounter.Add(new KeyCounterKeyboard(Key.Space));

action?.Invoke(hudOverlay);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Beatmaps;
using osu.Game.Overlays;
using osu.Game.Overlays.BeatmapSet;
using osu.Game.Rulesets;
using System;
Expand All @@ -21,6 +22,9 @@ public class TestSceneBeatmapRulesetSelector : OsuTestScene
typeof(BeatmapRulesetTabItem),
};

[Cached]
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);

private readonly TestRulesetSelector selector;

public TestSceneBeatmapRulesetSelector()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
using osu.Framework.Graphics.Shapes;
using osuTK.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Overlays;
using osu.Framework.Allocation;

namespace osu.Game.Tests.Visual.Online
{
Expand All @@ -22,6 +24,9 @@ public class TestSceneRankingsCountryFilter : OsuTestScene
typeof(CountryPill)
};

[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green);

public TestSceneRankingsCountryFilter()
{
var countryBindable = new Bindable<Country>();
Expand Down
66 changes: 0 additions & 66 deletions osu.Game.Tests/Visual/Online/TestSceneRankingsDismissableFlag.cs

This file was deleted.

20 changes: 10 additions & 10 deletions osu.Game.Tests/Visual/Online/TestSceneRankingsHeader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@

using System;
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Overlays;
using osu.Game.Overlays.Rankings;
using osu.Game.Rulesets;
using osu.Game.Users;
Expand All @@ -15,24 +16,23 @@ public class TestSceneRankingsHeader : OsuTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(DismissableFlag),
typeof(HeaderTitle),
typeof(RankingsRulesetSelector),
typeof(RankingsScopeSelector),
typeof(RankingsHeader),
typeof(RankingsOverlayHeader),
typeof(CountryFilter),
typeof(CountryPill)
};

[Cached]
private readonly OverlayColourProvider overlayColour = new OverlayColourProvider(OverlayColourScheme.Green);

public TestSceneRankingsHeader()
{
var countryBindable = new Bindable<Country>();
var ruleset = new Bindable<RulesetInfo>();
var scope = new Bindable<RankingsScope>();

Add(new RankingsHeader
Add(new RankingsOverlayHeader
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scope = { BindTarget = scope },
Current = { BindTarget = scope },
Country = { BindTarget = countryBindable },
Ruleset = { BindTarget = ruleset },
Spotlights = new[]
Expand Down
55 changes: 0 additions & 55 deletions osu.Game.Tests/Visual/Online/TestSceneRankingsHeaderTitle.cs

This file was deleted.

3 changes: 2 additions & 1 deletion osu.Game.Tests/Visual/Online/TestSceneRankingsOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ public class TestSceneRankingsOverlay : OsuTestScene
typeof(TableRowBackground),
typeof(UserBasedTable),
typeof(RankingsTable<>),
typeof(RankingsOverlay)
typeof(RankingsOverlay),
typeof(RankingsOverlayHeader)
};

[Cached]
Expand Down
41 changes: 0 additions & 41 deletions osu.Game.Tests/Visual/Online/TestSceneRankingsRulesetSelector.cs

This file was deleted.

Loading

0 comments on commit 1f2d710

Please sign in to comment.