mirror of
https://github.com/ppy/osu.git
synced 2026-05-23 19:40:09 +08:00
b578d34da4
Can reproduce the failure via something like
diff --git a/osu.Game.Rulesets.Mania/Edit/Setup/ManiaDifficultySection.cs b/osu.Game.Rulesets.Mania/Edit/Setup/ManiaDifficultySection.cs
index fe5c437e40..92c58a7bde 100644
--- a/osu.Game.Rulesets.Mania/Edit/Setup/ManiaDifficultySection.cs
+++ b/osu.Game.Rulesets.Mania/Edit/Setup/ManiaDifficultySection.cs
@@ -187,13 +187,13 @@ private void updateKeyCount(ValueChangedEvent<int> keyCount)
{
if (!t.GetResultSafely())
{
- Schedule(() =>
+ Scheduler.AddDelayed(() =>
{
changeHandler!.RestoreState(-1);
Beatmap.Difficulty.CircleSize = keyCount.OldValue;
setStateFromActualKeyCount(keyCount.OldValue);
updatingKeyCount = false;
- });
+ }, 1000);
}
else
{
so I'm banking on this being just a case of CI fuzzing the test by being
slow.
If the test fails again on this same assert after this change there are
bigger problems at hand. But given the lack of local reproduction I'd
rather start with this than spend an hour staring at it.
73 lines
3.6 KiB
C#
73 lines
3.6 KiB
C#
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
using System.Linq;
|
|
using NUnit.Framework;
|
|
using osu.Framework.Testing;
|
|
using osu.Game.Graphics.UserInterfaceV2;
|
|
using osu.Game.Overlays;
|
|
using osu.Game.Screens.Edit;
|
|
using osu.Game.Screens.Edit.Setup;
|
|
using osu.Game.Tests.Visual;
|
|
using osuTK.Input;
|
|
|
|
namespace osu.Game.Rulesets.Mania.Tests.Editor
|
|
{
|
|
public partial class TestSceneManiaEditorSaving : EditorSavingTestScene
|
|
{
|
|
protected override Ruleset CreateRuleset() => new ManiaRuleset();
|
|
|
|
[Test]
|
|
public void TestKeyCountChange()
|
|
{
|
|
FormSliderBar<int> keyCount = null!;
|
|
|
|
AddStep("go to setup screen", () => InputManager.Key(Key.F4));
|
|
AddUntilStep("retrieve key count slider", () => keyCount = Editor.ChildrenOfType<SetupScreen>().Single().ChildrenOfType<FormSliderBar<int>>().First(), () => Is.Not.Null);
|
|
AddAssert("key count is 5", () => keyCount.Current.Value, () => Is.EqualTo(5));
|
|
AddStep("change key count to 8", () =>
|
|
{
|
|
keyCount.Current.Value = 8;
|
|
});
|
|
AddUntilStep("dialog visible", () => Game.ChildrenOfType<IDialogOverlay>().SingleOrDefault()?.CurrentDialog, Is.InstanceOf<SaveAndReloadEditorDialog>);
|
|
AddStep("refuse", () => InputManager.Key(Key.Number2));
|
|
AddUntilStep("key count is 5", () => keyCount.Current.Value, () => Is.EqualTo(5));
|
|
|
|
AddStep("change key count to 8 again", () =>
|
|
{
|
|
keyCount.Current.Value = 8;
|
|
});
|
|
AddUntilStep("dialog visible", () => Game.ChildrenOfType<IDialogOverlay>().Single().CurrentDialog, Is.InstanceOf<SaveAndReloadEditorDialog>);
|
|
AddStep("acquiesce", () => InputManager.Key(Key.Number1));
|
|
AddUntilStep("beatmap became 8K", () => Game.Beatmap.Value.BeatmapInfo.Difficulty.CircleSize, () => Is.EqualTo(8));
|
|
}
|
|
|
|
[Test]
|
|
public void TestDualStagesChange()
|
|
{
|
|
FormCheckBox dualStages = null!;
|
|
FormSliderBar<int> keyCount = null!;
|
|
|
|
AddStep("go to setup screen", () => InputManager.Key(Key.F4));
|
|
AddUntilStep("retrieve dual stages checkbox", () => dualStages = Editor.ChildrenOfType<SetupScreen>().Single().ChildrenOfType<FormCheckBox>().First(), () => Is.Not.Null);
|
|
AddUntilStep("retrieve key count slider", () => keyCount = Editor.ChildrenOfType<SetupScreen>().Single().ChildrenOfType<FormSliderBar<int>>().First(), () => Is.Not.Null);
|
|
AddAssert("key count is 5", () => keyCount.Current.Value, () => Is.EqualTo(5));
|
|
AddStep("set dual stages", () =>
|
|
{
|
|
dualStages.Current.Value = true;
|
|
});
|
|
AddUntilStep("dialog visible", () => Game.ChildrenOfType<IDialogOverlay>().SingleOrDefault()?.CurrentDialog, Is.InstanceOf<SaveAndReloadEditorDialog>);
|
|
AddStep("refuse", () => InputManager.Key(Key.Number2));
|
|
AddUntilStep("key count is 5", () => keyCount.Current.Value, () => Is.EqualTo(5));
|
|
|
|
AddStep("set dual stages again", () =>
|
|
{
|
|
dualStages.Current.Value = true;
|
|
});
|
|
AddUntilStep("dialog visible", () => Game.ChildrenOfType<IDialogOverlay>().Single().CurrentDialog, Is.InstanceOf<SaveAndReloadEditorDialog>);
|
|
AddStep("acquiesce", () => InputManager.Key(Key.Number1));
|
|
AddUntilStep("beatmap became 12K", () => Game.Beatmap.Value.BeatmapInfo.Difficulty.CircleSize, () => Is.EqualTo(12));
|
|
}
|
|
}
|
|
}
|