mirror of
https://github.com/ppy/osu
synced 2025-01-02 12:22:13 +00:00
Add failing test showing expanded state being unexpectedly lost
This commit is contained in:
parent
01ca9eb81c
commit
e9187cc3cf
@ -6,12 +6,12 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Beatmaps.Drawables;
|
||||||
using osu.Game.Beatmaps.Drawables.Cards;
|
using osu.Game.Beatmaps.Drawables.Cards;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
@ -19,11 +19,10 @@ using osu.Game.Online.API.Requests;
|
|||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using APIUser = osu.Game.Online.API.Requests.Responses.APIUser;
|
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Beatmaps
|
namespace osu.Game.Tests.Visual.Beatmaps
|
||||||
{
|
{
|
||||||
public class TestSceneBeatmapCard : OsuTestScene
|
public class TestSceneBeatmapCard : OsuManualInputManagerTestScene
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// All cards on this scene use a common online ID to ensure that map download, preview tracks, etc. can be tested manually with online sources.
|
/// All cards on this scene use a common online ID to ensure that map download, preview tracks, etc. can be tested manually with online sources.
|
||||||
@ -253,14 +252,32 @@ namespace osu.Game.Tests.Visual.Beatmaps
|
|||||||
public void TestNormal()
|
public void TestNormal()
|
||||||
{
|
{
|
||||||
createTestCase(beatmapSetInfo => new BeatmapCard(beatmapSetInfo));
|
createTestCase(beatmapSetInfo => new BeatmapCard(beatmapSetInfo));
|
||||||
|
}
|
||||||
|
|
||||||
AddToggleStep("toggle expanded state", expanded =>
|
[Test]
|
||||||
{
|
public void TestHoverState()
|
||||||
var card = this.ChildrenOfType<BeatmapCard>().Last();
|
{
|
||||||
if (!card.Expanded.Disabled)
|
AddStep("create cards", () => Child = createContent(OverlayColourScheme.Blue, s => new BeatmapCard(s)));
|
||||||
card.Expanded.Value = expanded;
|
|
||||||
});
|
AddStep("Hover card", () => InputManager.MoveMouseTo(firstCard()));
|
||||||
AddToggleStep("disable/enable expansion", disabled => this.ChildrenOfType<BeatmapCard>().ForEach(card => card.Expanded.Disabled = disabled));
|
AddWaitStep("wait for potential state change", 5);
|
||||||
|
AddAssert("card is not expanded", () => !firstCard().Expanded.Value);
|
||||||
|
|
||||||
|
AddStep("Hover spectrum display", () => InputManager.MoveMouseTo(firstCard().ChildrenOfType<DifficultySpectrumDisplay>().Single()));
|
||||||
|
AddUntilStep("card is expanded", () => firstCard().Expanded.Value);
|
||||||
|
|
||||||
|
AddStep("Hover difficulty content", () => InputManager.MoveMouseTo(firstCard().ChildrenOfType<BeatmapCardDifficultyList>().Single()));
|
||||||
|
AddWaitStep("wait for potential state change", 5);
|
||||||
|
AddAssert("card is still expanded", () => firstCard().Expanded.Value);
|
||||||
|
|
||||||
|
AddStep("Hover main content again", () => InputManager.MoveMouseTo(firstCard()));
|
||||||
|
AddWaitStep("wait for potential state change", 5);
|
||||||
|
AddAssert("card is still expanded", () => firstCard().Expanded.Value);
|
||||||
|
|
||||||
|
AddStep("Hover away", () => InputManager.MoveMouseTo(this.ChildrenOfType<BeatmapCard>().Last()));
|
||||||
|
AddUntilStep("card is not expanded", () => !firstCard().Expanded.Value);
|
||||||
|
|
||||||
|
BeatmapCard firstCard() => this.ChildrenOfType<BeatmapCard>().First();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user