From b0e556d83fd1367fc4156516c026255b26f5cac2 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Fri, 4 May 2018 00:01:00 +0300 Subject: [PATCH] Actualize QuitButton visual test --- ...aseHoldToQuit.cs => TestCaseQuitButton.cs} | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) rename osu.Game.Tests/Visual/{TestCaseHoldToQuit.cs => TestCaseQuitButton.cs} (60%) diff --git a/osu.Game.Tests/Visual/TestCaseHoldToQuit.cs b/osu.Game.Tests/Visual/TestCaseQuitButton.cs similarity index 60% rename from osu.Game.Tests/Visual/TestCaseHoldToQuit.cs rename to osu.Game.Tests/Visual/TestCaseQuitButton.cs index 9a2228c23c..545a8ff57b 100644 --- a/osu.Game.Tests/Visual/TestCaseHoldToQuit.cs +++ b/osu.Game.Tests/Visual/TestCaseQuitButton.cs @@ -4,33 +4,36 @@ using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Screens.Play.HUD; namespace osu.Game.Tests.Visual { [Description("'Hold to Quit' UI element")] - public class TestCaseHoldToQuit : OsuTestCase + public class TestCaseQuitButton : OsuTestCase { + private readonly QuitButton quitButton; + private Drawable innerButton => quitButton.Children.Single(child => child is CircularContainer); private bool exitAction; - public TestCaseHoldToQuit() + public TestCaseQuitButton() { - QuitButton holdToQuit; - Add(holdToQuit = new QuitButton + Add(quitButton = new QuitButton { Origin = Anchor.BottomRight, Anchor = Anchor.BottomRight, }); - holdToQuit.ExitAction = () => exitAction = true; + quitButton.ExitAction = () => exitAction = true; - var text = holdToQuit.Children.OfType().Single(); + var text = quitButton.Children.OfType().Single(); AddStep("Trigger text fade in/out", () => { exitAction = false; - holdToQuit.TriggerOnMouseDown(); - holdToQuit.TriggerOnMouseUp(); + + innerButton.TriggerOnMouseDown(); + innerButton.TriggerOnMouseUp(); }); AddUntilStep(() => text.IsPresent && !exitAction, "Text visible"); @@ -39,10 +42,10 @@ namespace osu.Game.Tests.Visual AddStep("Trigger exit action", () => { exitAction = false; - holdToQuit.TriggerOnMouseDown(); + innerButton.TriggerOnMouseDown(); }); - AddUntilStep(() => exitAction, $"{nameof(holdToQuit.ExitAction)} was triggered"); + AddUntilStep(() => exitAction, $"{nameof(quitButton.ExitAction)} was triggered"); } } }