From 5cd973fb3490dcc10d10e4775e294d690b0ffda1 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 6 Feb 2023 19:20:43 -0600 Subject: [PATCH] Add test --- .../TestSceneHitCircleLateFade.cs | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleLateFade.cs diff --git a/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleLateFade.cs b/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleLateFade.cs new file mode 100644 index 0000000000..3195c0b24b --- /dev/null +++ b/osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleLateFade.cs @@ -0,0 +1,48 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +#nullable disable + +using NUnit.Framework; +using osu.Framework.Extensions.ObjectExtensions; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables; +using osu.Game.Tests.Visual; +using osuTK; + +namespace osu.Game.Rulesets.Osu.Tests +{ + public partial class TestSceneHitCircleLateFade : OsuTestScene + { + [Test] + public void TestFadeOutIntoMiss() + { + float? alphaAtMiss = null; + + AddStep("Create hit circle", () => + { + alphaAtMiss = null; + + DrawableHitCircle drawableHitCircle = new DrawableHitCircle(new HitCircle + { + StartTime = Time.Current + 500, + Position = new Vector2(250) + }); + + drawableHitCircle.HitObject.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); + + drawableHitCircle.OnNewResult += (_, _) => + { + alphaAtMiss = drawableHitCircle.Alpha; + }; + + Child = drawableHitCircle; + }); + + AddUntilStep("Wait until circle is missed", () => alphaAtMiss.IsNotNull()); + AddAssert("Transparent when missed", () => alphaAtMiss == 0); + } + } +}