From 43fdea246d371e897800e2f8f7d5f4d7222b7852 Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Tue, 12 Nov 2024 01:06:22 +0900 Subject: [PATCH] Restore LabelStep implementation --- .../Visual/Testing/TestSceneStepButton.cs | 2 +- .../Testing/Drawables/Steps/LabelStep.cs | 15 ++------------- osu.Framework/Testing/TestScene.cs | 9 ++++++++- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/osu.Framework.Tests/Visual/Testing/TestSceneStepButton.cs b/osu.Framework.Tests/Visual/Testing/TestSceneStepButton.cs index 193cc4adc6..602709ffc2 100644 --- a/osu.Framework.Tests/Visual/Testing/TestSceneStepButton.cs +++ b/osu.Framework.Tests/Visual/Testing/TestSceneStepButton.cs @@ -25,7 +25,7 @@ public TestSceneStepButton() { Text = nameof(LabelStep), IsSetupStep = false, - Test = this + Action = _ => { }, }, new AssertButton { diff --git a/osu.Framework/Testing/Drawables/Steps/LabelStep.cs b/osu.Framework/Testing/Drawables/Steps/LabelStep.cs index 762c50343a..5f1271a63a 100644 --- a/osu.Framework/Testing/Drawables/Steps/LabelStep.cs +++ b/osu.Framework/Testing/Drawables/Steps/LabelStep.cs @@ -2,16 +2,13 @@ // See the LICENCE file in the repository root for full licence text. using System; -using osu.Framework.Development; -using osu.Framework.Logging; using osuTK.Graphics; namespace osu.Framework.Testing.Drawables.Steps { public partial class LabelStep : StepButton { - public required TestScene Test { get; init; } - public new Action? Action { get; set; } + public new required Action Action { get; init; } protected override Color4 IdleColour => new Color4(77, 77, 77, 255); @@ -24,14 +21,6 @@ public LabelStep() base.Action = clickAction; } - private void clickAction() - { - Logger.Log($@"💨 {Test} {Text}"); - - if (!DebugUtils.IsNUnitRunning) - Test.RunAllSteps(startFromStep: this, stopCondition: s => s is LabelStep); - - Action?.Invoke(); - } + private void clickAction() => Action(this); } } diff --git a/osu.Framework/Testing/TestScene.cs b/osu.Framework/Testing/TestScene.cs index c781cd9619..4cc97bf25f 100644 --- a/osu.Framework/Testing/TestScene.cs +++ b/osu.Framework/Testing/TestScene.cs @@ -300,7 +300,14 @@ public void AddLabel([NotNull] string description) { Text = description, IsSetupStep = false, - Test = this, + Action = step => + { + Logger.Log($@"💨 {this} {description}"); + + // kinda hacky way to avoid this doesn't get triggered by automated runs. + if (step.IsHovered) + RunAllSteps(startFromStep: step, stopCondition: s => s is LabelStep); + }, }); }