Skip to content

Commit

Permalink
Restore LabelStep implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
smoogipoo committed Nov 11, 2024
1 parent 3960655 commit 43fdea2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion osu.Framework.Tests/Visual/Testing/TestSceneStepButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public TestSceneStepButton()
{
Text = nameof(LabelStep),
IsSetupStep = false,
Test = this
Action = _ => { },
},
new AssertButton
{
Expand Down
15 changes: 2 additions & 13 deletions osu.Framework/Testing/Drawables/Steps/LabelStep.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<LabelStep> Action { get; init; }

protected override Color4 IdleColour => new Color4(77, 77, 77, 255);

Expand All @@ -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);
}
}
9 changes: 8 additions & 1 deletion osu.Framework/Testing/TestScene.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
},
});
}

Expand Down

0 comments on commit 43fdea2

Please sign in to comment.