mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 12:17:26 +08:00
Make toolbar testable and add the most basic of visual tests
This commit is contained in:
parent
45e4c09cb8
commit
dff082ed94
25
osu.Game.Tests/Visual/TestCaseToolbar.cs
Normal file
25
osu.Game.Tests/Visual/TestCaseToolbar.cs
Normal file
@ -0,0 +1,25 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Overlays.Toolbar;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
{
|
||||
public class TestCaseToolbar : OsuTestCase
|
||||
{
|
||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||
{
|
||||
typeof(ToolbarButton),
|
||||
typeof(ToolbarModeSelector),
|
||||
typeof(ToolbarModeButton),
|
||||
};
|
||||
|
||||
public TestCaseToolbar()
|
||||
{
|
||||
Add(new Toolbar { State = Visibility.Visible });
|
||||
}
|
||||
}
|
||||
}
|
@ -148,6 +148,7 @@
|
||||
<Compile Include="Visual\TestCaseStoryboard.cs" />
|
||||
<Compile Include="Visual\TestCaseTabControl.cs" />
|
||||
<Compile Include="Visual\TestCaseTextAwesome.cs" />
|
||||
<Compile Include="Visual\TestCaseToolbar.cs" />
|
||||
<Compile Include="Visual\TestCaseTwoLayerButton.cs" />
|
||||
<Compile Include="Visual\TestCaseUserPanel.cs" />
|
||||
<Compile Include="Visual\TestCaseUserProfile.cs" />
|
||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
SetIcon(FontAwesome.fa_comments);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(ChatOverlay chat)
|
||||
{
|
||||
StateContainer = chat;
|
||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
SetIcon(FontAwesome.fa_osu_chevron_down_o);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(DirectOverlay direct)
|
||||
{
|
||||
StateContainer = direct;
|
||||
|
@ -64,7 +64,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(RulesetStore rulesets, OsuGame game)
|
||||
{
|
||||
foreach (var r in rulesets.AvailableRulesets)
|
||||
@ -81,7 +81,10 @@ namespace osu.Game.Overlays.Toolbar
|
||||
|
||||
ruleset.ValueChanged += rulesetChanged;
|
||||
ruleset.DisabledChanged += disabledChanged;
|
||||
ruleset.BindTo(game.Ruleset);
|
||||
if (game != null)
|
||||
ruleset.BindTo(game.Ruleset);
|
||||
else
|
||||
ruleset.Value = rulesets.AvailableRulesets.FirstOrDefault();
|
||||
}
|
||||
|
||||
public override bool HandleInput => !ruleset.Disabled;
|
||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
Icon = FontAwesome.fa_music;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(MusicController music)
|
||||
{
|
||||
StateContainer = music;
|
||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
TooltipSub = "Waiting for 'ya";
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(NotificationOverlay notificationOverlay)
|
||||
{
|
||||
StateContainer = notificationOverlay;
|
||||
|
@ -21,8 +21,11 @@ namespace osu.Game.Overlays.Toolbar
|
||||
set
|
||||
{
|
||||
stateContainer = value;
|
||||
Action = stateContainer.ToggleVisibility;
|
||||
stateContainer.StateChanged += stateChanged;
|
||||
if (stateContainer != null)
|
||||
{
|
||||
Action = stateContainer.ToggleVisibility;
|
||||
stateContainer.StateChanged += stateChanged;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
TooltipSub = "Change your settings";
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(SettingsOverlay settings)
|
||||
{
|
||||
StateContainer = settings;
|
||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
Icon = FontAwesome.fa_users;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(SocialOverlay chat)
|
||||
{
|
||||
StateContainer = chat;
|
||||
|
Loading…
Reference in New Issue
Block a user