mirror of
https://github.com/ppy/osu.git
synced 2025-03-28 09:37:23 +08:00
Merge pull request #7623 from peppy/fix-ss-click-crash
Fix crash due to misordered selection events
This commit is contained in:
commit
d0715700eb
@ -14,6 +14,7 @@ using osu.Framework.Extensions;
|
|||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
@ -25,6 +26,7 @@ using osu.Game.Rulesets.Taiko;
|
|||||||
using osu.Game.Screens.Select;
|
using osu.Game.Screens.Select;
|
||||||
using osu.Game.Screens.Select.Carousel;
|
using osu.Game.Screens.Select.Carousel;
|
||||||
using osu.Game.Screens.Select.Filter;
|
using osu.Game.Screens.Select.Filter;
|
||||||
|
using osuTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.SongSelect
|
namespace osu.Game.Tests.Visual.SongSelect
|
||||||
{
|
{
|
||||||
@ -95,6 +97,123 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
AddAssert("filter count is 1", () => songSelect.FilterCount == 1);
|
AddAssert("filter count is 1", () => songSelect.FilterCount == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestChangeBeatmapBeforeEnter()
|
||||||
|
{
|
||||||
|
addRulesetImportStep(0);
|
||||||
|
|
||||||
|
createSongSelect();
|
||||||
|
|
||||||
|
AddUntilStep("wait for initial selection", () => !Beatmap.IsDefault);
|
||||||
|
|
||||||
|
WorkingBeatmap selected = null;
|
||||||
|
|
||||||
|
AddStep("store selected beatmap", () => selected = Beatmap.Value);
|
||||||
|
|
||||||
|
AddStep("select next and enter", () =>
|
||||||
|
{
|
||||||
|
InputManager.PressKey(Key.Down);
|
||||||
|
InputManager.ReleaseKey(Key.Down);
|
||||||
|
InputManager.PressKey(Key.Enter);
|
||||||
|
InputManager.ReleaseKey(Key.Enter);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("ensure selection changed", () => selected != Beatmap.Value);
|
||||||
|
|
||||||
|
AddUntilStep("wait for return to song select", () => songSelect.IsCurrentScreen());
|
||||||
|
AddUntilStep("bindable lease returned", () => !Beatmap.Disabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestChangeBeatmapAfterEnter()
|
||||||
|
{
|
||||||
|
addRulesetImportStep(0);
|
||||||
|
|
||||||
|
createSongSelect();
|
||||||
|
|
||||||
|
AddUntilStep("wait for initial selection", () => !Beatmap.IsDefault);
|
||||||
|
|
||||||
|
WorkingBeatmap selected = null;
|
||||||
|
|
||||||
|
AddStep("store selected beatmap", () => selected = Beatmap.Value);
|
||||||
|
|
||||||
|
AddStep("select next and enter", () =>
|
||||||
|
{
|
||||||
|
InputManager.PressKey(Key.Enter);
|
||||||
|
InputManager.ReleaseKey(Key.Enter);
|
||||||
|
InputManager.PressKey(Key.Down);
|
||||||
|
InputManager.ReleaseKey(Key.Down);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("ensure selection didn't change", () => selected == Beatmap.Value);
|
||||||
|
|
||||||
|
AddUntilStep("wait for return to song select", () => songSelect.IsCurrentScreen());
|
||||||
|
AddUntilStep("bindable lease returned", () => !Beatmap.Disabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestChangeBeatmapViaMouseBeforeEnter()
|
||||||
|
{
|
||||||
|
addRulesetImportStep(0);
|
||||||
|
|
||||||
|
createSongSelect();
|
||||||
|
|
||||||
|
AddUntilStep("wait for initial selection", () => !Beatmap.IsDefault);
|
||||||
|
|
||||||
|
WorkingBeatmap selected = null;
|
||||||
|
|
||||||
|
AddStep("store selected beatmap", () => selected = Beatmap.Value);
|
||||||
|
|
||||||
|
AddStep("select next and enter", () =>
|
||||||
|
{
|
||||||
|
InputManager.MoveMouseTo(songSelect.Carousel.ChildrenOfType<DrawableCarouselBeatmap>()
|
||||||
|
.First(b => ((CarouselBeatmap)b.Item).Beatmap != songSelect.Carousel.SelectedBeatmap));
|
||||||
|
|
||||||
|
InputManager.PressButton(MouseButton.Left);
|
||||||
|
InputManager.ReleaseButton(MouseButton.Left);
|
||||||
|
|
||||||
|
InputManager.PressKey(Key.Enter);
|
||||||
|
InputManager.ReleaseKey(Key.Enter);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("ensure selection changed", () => selected != Beatmap.Value);
|
||||||
|
|
||||||
|
AddUntilStep("wait for return to song select", () => songSelect.IsCurrentScreen());
|
||||||
|
AddUntilStep("bindable lease returned", () => !Beatmap.Disabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestChangeBeatmapViaMouseAfterEnter()
|
||||||
|
{
|
||||||
|
addRulesetImportStep(0);
|
||||||
|
|
||||||
|
createSongSelect();
|
||||||
|
|
||||||
|
AddUntilStep("wait for initial selection", () => !Beatmap.IsDefault);
|
||||||
|
|
||||||
|
WorkingBeatmap selected = null;
|
||||||
|
|
||||||
|
AddStep("store selected beatmap", () => selected = Beatmap.Value);
|
||||||
|
|
||||||
|
AddStep("select next and enter", () =>
|
||||||
|
{
|
||||||
|
InputManager.MoveMouseTo(songSelect.Carousel.ChildrenOfType<DrawableCarouselBeatmap>()
|
||||||
|
.First(b => ((CarouselBeatmap)b.Item).Beatmap != songSelect.Carousel.SelectedBeatmap));
|
||||||
|
|
||||||
|
InputManager.PressButton(MouseButton.Left);
|
||||||
|
|
||||||
|
InputManager.PressKey(Key.Enter);
|
||||||
|
InputManager.ReleaseKey(Key.Enter);
|
||||||
|
|
||||||
|
InputManager.ReleaseButton(MouseButton.Left);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("ensure selection didn't change", () => selected == Beatmap.Value);
|
||||||
|
|
||||||
|
AddUntilStep("wait for return to song select", () => songSelect.IsCurrentScreen());
|
||||||
|
AddUntilStep("bindable lease returned", () => !Beatmap.Disabled);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestNoFilterOnSimpleResume()
|
public void TestNoFilterOnSimpleResume()
|
||||||
{
|
{
|
||||||
|
@ -56,6 +56,9 @@ namespace osu.Game.Screens.Select
|
|||||||
public override bool HandleNonPositionalInput => AllowSelection;
|
public override bool HandleNonPositionalInput => AllowSelection;
|
||||||
public override bool HandlePositionalInput => AllowSelection;
|
public override bool HandlePositionalInput => AllowSelection;
|
||||||
|
|
||||||
|
public override bool PropagatePositionalInputSubTree => AllowSelection;
|
||||||
|
public override bool PropagateNonPositionalInputSubTree => AllowSelection;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether carousel items have completed asynchronously loaded.
|
/// Whether carousel items have completed asynchronously loaded.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -449,8 +452,6 @@ namespace osu.Game.Screens.Select
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool ReceivePositionalInputAtSubTree(Vector2 screenSpacePos) => ReceivePositionalInputAt(screenSpacePos);
|
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
@ -8,6 +8,7 @@ using osu.Framework.Testing.Input;
|
|||||||
using osu.Game.Graphics.Cursor;
|
using osu.Game.Graphics.Cursor;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Input.Bindings;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
@ -30,7 +31,11 @@ namespace osu.Game.Tests.Visual
|
|||||||
InputManager = new ManualInputManager
|
InputManager = new ManualInputManager
|
||||||
{
|
{
|
||||||
UseParentInput = true,
|
UseParentInput = true,
|
||||||
Child = content = new MenuCursorContainer { RelativeSizeAxes = Axes.Both },
|
Child = new GlobalActionContainer(null)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Child = content = new MenuCursorContainer { RelativeSizeAxes = Axes.Both }
|
||||||
|
},
|
||||||
},
|
},
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user