mirror of https://github.com/ppy/osu
Test colours
This commit is contained in:
parent
039f009562
commit
2a12194ff9
|
@ -1,38 +1,65 @@
|
||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Mods;
|
using osu.Game.Overlays.Mods;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.UserInterface
|
namespace osu.Game.Tests.Visual.UserInterface
|
||||||
{
|
{
|
||||||
|
[TestFixture]
|
||||||
public class TestSceneModsEffectDisplay : OsuTestScene
|
public class TestSceneModsEffectDisplay : OsuTestScene
|
||||||
{
|
{
|
||||||
[Cached]
|
[Cached]
|
||||||
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green);
|
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green);
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private OsuColour colours { get; set; } = null!;
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestEffectDisplay()
|
public void TestModsEffectDisplay()
|
||||||
{
|
{
|
||||||
TestDisplay dsp;
|
TestDisplay testDisplay = null!;
|
||||||
Add(dsp = new TestDisplay
|
Box background = null!;
|
||||||
|
|
||||||
|
AddStep("add display", () =>
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Add(testDisplay = new TestDisplay
|
||||||
Origin = Anchor.Centre
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre
|
||||||
|
});
|
||||||
|
var boxes = testDisplay.ChildrenOfType<Box>();
|
||||||
|
background = boxes.First();
|
||||||
});
|
});
|
||||||
AddSliderStep("value", 40, 60, 50, i => dsp.Value = i);
|
|
||||||
|
AddStep("set value to default", () => testDisplay.Value = 50);
|
||||||
|
AddUntilStep("colours are correct", () => testDisplay.Container.Colour == Color4.White && background.Colour == colourProvider.Background3);
|
||||||
|
|
||||||
|
AddStep("set value to less", () => testDisplay.Value = 40);
|
||||||
|
AddUntilStep("colours are correct", () => testDisplay.Container.Colour == colourProvider.Background5 && background.Colour == colours.ForModType(ModType.DifficultyReduction));
|
||||||
|
|
||||||
|
AddStep("set value to bigger", () => testDisplay.Value = 60);
|
||||||
|
AddUntilStep("colours are correct", () => testDisplay.Container.Colour == colourProvider.Background5 && background.Colour == colours.ForModType(ModType.DifficultyIncrease));
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestDisplay : ModsEffectDisplay
|
private class TestDisplay : ModsEffectDisplay
|
||||||
{
|
{
|
||||||
private readonly OsuSpriteText text;
|
private readonly OsuSpriteText text;
|
||||||
|
|
||||||
|
public Container<Drawable> Container => Content;
|
||||||
|
|
||||||
protected override LocalisableString Label => "Test display";
|
protected override LocalisableString Label => "Test display";
|
||||||
|
|
||||||
public int Value
|
public int Value
|
||||||
|
|
Loading…
Reference in New Issue