From 90334a2b91888698e449797f8c29d6f71c526885 Mon Sep 17 00:00:00 2001 From: ansel <79257300125@ya.ru> Date: Sat, 27 Aug 2022 20:12:45 +0300 Subject: [PATCH] Add test scene --- .../TestSceneModsEffectDisplay.cs | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 osu.Game.Tests/Visual/UserInterface/TestSceneModsEffectDisplay.cs diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneModsEffectDisplay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneModsEffectDisplay.cs new file mode 100644 index 0000000000..36267b0e2a --- /dev/null +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneModsEffectDisplay.cs @@ -0,0 +1,60 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Localisation; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Overlays; +using osu.Game.Overlays.Mods; + +namespace osu.Game.Tests.Visual.UserInterface +{ + public class TestSceneModsEffectDisplay : OsuTestScene + { + [Cached] + private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green); + + [Test] + public void TestEffectDisplay() + { + TestDisplay dsp; + Add(dsp = new TestDisplay + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre + }); + AddSliderStep("value", 40, 60, 50, i => dsp.Value = i); + } + + private class TestDisplay : ModsEffectDisplay + { + private readonly OsuSpriteText text; + + protected override LocalisableString Label => "Test display"; + + public int Value + { + set + { + text.Text = value.ToString(); + SetColours(value.CompareTo(50)); + } + } + + public TestDisplay() + { + Add(text = new OsuSpriteText + { + Font = OsuFont.Default.With(size: 17, weight: FontWeight.SemiBold), + Text = "50" + }); + } + + [BackgroundDependencyLoader] + private void load() => SetColours(0); + } + } +}