mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 19:04:06 +08:00
Add test scene for demonstrating OsuDropdown
appearance
This commit is contained in:
parent
6c1d224164
commit
6c18d46443
20
osu.Game.Tests/Visual/UserInterface/TestSceneOsuDropdown.cs
Normal file
20
osu.Game.Tests/Visual/UserInterface/TestSceneOsuDropdown.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// 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.Graphics;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.UserInterface
|
||||||
|
{
|
||||||
|
public class TestSceneOsuDropdown : ThemeComparisonTestScene
|
||||||
|
{
|
||||||
|
protected override Drawable CreateContent() =>
|
||||||
|
new OsuEnumDropdown<BeatmapSetOnlineStatus>
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Width = 150
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,69 @@
|
|||||||
|
// 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;
|
||||||
|
using System.Linq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.UserInterface
|
||||||
|
{
|
||||||
|
public abstract class ThemeComparisonTestScene : OsuGridTestScene
|
||||||
|
{
|
||||||
|
protected ThemeComparisonTestScene()
|
||||||
|
: base(1, 2)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
Cell(0, 0).AddRange(new[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = colours.GreySeafoam
|
||||||
|
},
|
||||||
|
CreateContent()
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createThemedContent(OverlayColourScheme colourScheme)
|
||||||
|
{
|
||||||
|
var colourProvider = new OverlayColourProvider(colourScheme);
|
||||||
|
|
||||||
|
Cell(0, 1).Clear();
|
||||||
|
Cell(0, 1).Add(new DependencyProvidingContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
CachedDependencies = new (Type, object)[]
|
||||||
|
{
|
||||||
|
(typeof(OverlayColourProvider), colourProvider)
|
||||||
|
},
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = colourProvider.Background4
|
||||||
|
},
|
||||||
|
CreateContent()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract Drawable CreateContent();
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestAllColourSchemes()
|
||||||
|
{
|
||||||
|
foreach (var scheme in Enum.GetValues(typeof(OverlayColourScheme)).Cast<OverlayColourScheme>())
|
||||||
|
AddStep($"set {scheme} scheme", () => createThemedContent(scheme));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user