mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 16:52:54 +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\TestCaseStoryboard.cs" />
|
||||||
<Compile Include="Visual\TestCaseTabControl.cs" />
|
<Compile Include="Visual\TestCaseTabControl.cs" />
|
||||||
<Compile Include="Visual\TestCaseTextAwesome.cs" />
|
<Compile Include="Visual\TestCaseTextAwesome.cs" />
|
||||||
|
<Compile Include="Visual\TestCaseToolbar.cs" />
|
||||||
<Compile Include="Visual\TestCaseTwoLayerButton.cs" />
|
<Compile Include="Visual\TestCaseTwoLayerButton.cs" />
|
||||||
<Compile Include="Visual\TestCaseUserPanel.cs" />
|
<Compile Include="Visual\TestCaseUserPanel.cs" />
|
||||||
<Compile Include="Visual\TestCaseUserProfile.cs" />
|
<Compile Include="Visual\TestCaseUserProfile.cs" />
|
||||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
SetIcon(FontAwesome.fa_comments);
|
SetIcon(FontAwesome.fa_comments);
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(ChatOverlay chat)
|
private void load(ChatOverlay chat)
|
||||||
{
|
{
|
||||||
StateContainer = chat;
|
StateContainer = chat;
|
||||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
SetIcon(FontAwesome.fa_osu_chevron_down_o);
|
SetIcon(FontAwesome.fa_osu_chevron_down_o);
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(DirectOverlay direct)
|
private void load(DirectOverlay direct)
|
||||||
{
|
{
|
||||||
StateContainer = direct;
|
StateContainer = direct;
|
||||||
|
@ -64,7 +64,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(RulesetStore rulesets, OsuGame game)
|
private void load(RulesetStore rulesets, OsuGame game)
|
||||||
{
|
{
|
||||||
foreach (var r in rulesets.AvailableRulesets)
|
foreach (var r in rulesets.AvailableRulesets)
|
||||||
@ -81,7 +81,10 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
|
|
||||||
ruleset.ValueChanged += rulesetChanged;
|
ruleset.ValueChanged += rulesetChanged;
|
||||||
ruleset.DisabledChanged += disabledChanged;
|
ruleset.DisabledChanged += disabledChanged;
|
||||||
|
if (game != null)
|
||||||
ruleset.BindTo(game.Ruleset);
|
ruleset.BindTo(game.Ruleset);
|
||||||
|
else
|
||||||
|
ruleset.Value = rulesets.AvailableRulesets.FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool HandleInput => !ruleset.Disabled;
|
public override bool HandleInput => !ruleset.Disabled;
|
||||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
Icon = FontAwesome.fa_music;
|
Icon = FontAwesome.fa_music;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(MusicController music)
|
private void load(MusicController music)
|
||||||
{
|
{
|
||||||
StateContainer = music;
|
StateContainer = music;
|
||||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
TooltipSub = "Waiting for 'ya";
|
TooltipSub = "Waiting for 'ya";
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(NotificationOverlay notificationOverlay)
|
private void load(NotificationOverlay notificationOverlay)
|
||||||
{
|
{
|
||||||
StateContainer = notificationOverlay;
|
StateContainer = notificationOverlay;
|
||||||
|
@ -21,10 +21,13 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
stateContainer = value;
|
stateContainer = value;
|
||||||
|
if (stateContainer != null)
|
||||||
|
{
|
||||||
Action = stateContainer.ToggleVisibility;
|
Action = stateContainer.ToggleVisibility;
|
||||||
stateContainer.StateChanged += stateChanged;
|
stateContainer.StateChanged += stateChanged;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ToolbarOverlayToggleButton()
|
public ToolbarOverlayToggleButton()
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
TooltipSub = "Change your settings";
|
TooltipSub = "Change your settings";
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(SettingsOverlay settings)
|
private void load(SettingsOverlay settings)
|
||||||
{
|
{
|
||||||
StateContainer = settings;
|
StateContainer = settings;
|
||||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
Icon = FontAwesome.fa_users;
|
Icon = FontAwesome.fa_users;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(SocialOverlay chat)
|
private void load(SocialOverlay chat)
|
||||||
{
|
{
|
||||||
StateContainer = chat;
|
StateContainer = chat;
|
||||||
|
Loading…
Reference in New Issue
Block a user