1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 23:12:56 +08:00

Add failing test case

This commit is contained in:
Salman Ahmed 2024-01-17 08:10:02 +03:00
parent 68fb1b8663
commit f11682d44f

View File

@ -4,11 +4,13 @@
#nullable disable
using System;
using System.Diagnostics;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Testing;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Graphics.Containers;
@ -177,6 +179,43 @@ namespace osu.Game.Tests.Visual.Editing
AddUntilStep("Scrolled to end", () => timingScreen.ChildrenOfType<OsuScrollContainer>().First().IsScrolledToEnd());
}
[Test]
public void TestEditThenClickAway()
{
AddStep("Add two control points", () =>
{
editorBeatmap.ControlPointInfo.Clear();
editorBeatmap.ControlPointInfo.Add(1000, new TimingControlPoint());
editorBeatmap.ControlPointInfo.Add(2000, new TimingControlPoint());
});
AddStep("Select second timing point", () =>
{
InputManager.MoveMouseTo(Child.ChildrenOfType<TimingRowAttribute>().Last());
InputManager.Click(MouseButton.Left);
});
AddStep("Scroll to end", () => timingScreen.ChildrenOfType<ControlPointSettings>().Single().ChildrenOfType<OsuScrollContainer>().Single().ScrollToEnd(false));
AddStep("Modify time signature", () =>
{
var timeSignatureTextBox = Child.ChildrenOfType<LabelledTimeSignature.TimeSignatureBox>().Single().ChildrenOfType<TextBox>().Single();
InputManager.MoveMouseTo(timeSignatureTextBox);
InputManager.Click(MouseButton.Left);
Debug.Assert(!timeSignatureTextBox.Current.Value.Equals("1"));
timeSignatureTextBox.Current.Value = "1";
});
AddStep("Select first timing point", () =>
{
InputManager.MoveMouseTo(Child.ChildrenOfType<TimingRowAttribute>().First());
InputManager.Click(MouseButton.Left);
});
AddAssert("Second timing point changed time signature", () => editorBeatmap.ControlPointInfo.TimingPoints.Last().TimeSignature.Numerator == 1);
AddAssert("First timing point preserved time signature", () => editorBeatmap.ControlPointInfo.TimingPoints.First().TimeSignature.Numerator == 4);
}
protected override void Dispose(bool isDisposing)
{
Beatmap.Disabled = false;