mirror of
https://github.com/ppy/osu.git
synced 2024-11-13 18:07:25 +08:00
Update carousel test logic to match new carousel selection behaviour
This commit is contained in:
parent
ce5d01ed19
commit
2bcf079386
@ -399,7 +399,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
AddStep("filter to ruleset 0", () =>
|
AddStep("filter to ruleset 0", () =>
|
||||||
carousel.Filter(new FilterCriteria { Ruleset = rulesets.AvailableRulesets.ElementAt(0) }, false));
|
carousel.Filter(new FilterCriteria { Ruleset = rulesets.AvailableRulesets.ElementAt(0) }, false));
|
||||||
AddStep("select filtered map skipping filtered", () => carousel.SelectBeatmap(testMixed.Beatmaps[1], false));
|
AddStep("select filtered map skipping filtered", () => carousel.SelectBeatmap(testMixed.Beatmaps[1], false));
|
||||||
AddAssert("unfiltered beatmap selected", () => carousel.SelectedBeatmap.Equals(testMixed.Beatmaps[0]));
|
AddAssert("unfiltered beatmap not selected", () => carousel.SelectedBeatmap == null);
|
||||||
|
|
||||||
AddStep("remove mixed set", () =>
|
AddStep("remove mixed set", () =>
|
||||||
{
|
{
|
||||||
|
@ -591,16 +591,16 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
BeatmapInfo filteredBeatmap = null;
|
||||||
DrawableCarouselBeatmapSet.FilterableDifficultyIcon filteredIcon = null;
|
DrawableCarouselBeatmapSet.FilterableDifficultyIcon filteredIcon = null;
|
||||||
|
|
||||||
AddStep("Get filtered icon", () =>
|
AddStep("Get filtered icon", () =>
|
||||||
{
|
{
|
||||||
var filteredBeatmap = songSelect.Carousel.SelectedBeatmapSet.Beatmaps.Find(b => b.BPM < maxBPM);
|
filteredBeatmap = songSelect.Carousel.SelectedBeatmapSet.Beatmaps.Find(b => b.BPM < maxBPM);
|
||||||
int filteredBeatmapIndex = getBeatmapIndex(filteredBeatmap.BeatmapSet, filteredBeatmap);
|
int filteredBeatmapIndex = getBeatmapIndex(filteredBeatmap.BeatmapSet, filteredBeatmap);
|
||||||
filteredIcon = set.ChildrenOfType<DrawableCarouselBeatmapSet.FilterableDifficultyIcon>().ElementAt(filteredBeatmapIndex);
|
filteredIcon = set.ChildrenOfType<DrawableCarouselBeatmapSet.FilterableDifficultyIcon>().ElementAt(filteredBeatmapIndex);
|
||||||
});
|
});
|
||||||
|
|
||||||
int? previousID = null;
|
|
||||||
AddStep("Store current ID", () => previousID = songSelect.Carousel.SelectedBeatmap.ID);
|
|
||||||
AddStep("Click on a filtered difficulty", () =>
|
AddStep("Click on a filtered difficulty", () =>
|
||||||
{
|
{
|
||||||
InputManager.MoveMouseTo(filteredIcon);
|
InputManager.MoveMouseTo(filteredIcon);
|
||||||
@ -608,7 +608,8 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
InputManager.PressButton(MouseButton.Left);
|
InputManager.PressButton(MouseButton.Left);
|
||||||
InputManager.ReleaseButton(MouseButton.Left);
|
InputManager.ReleaseButton(MouseButton.Left);
|
||||||
});
|
});
|
||||||
AddAssert("Selected beatmap has not changed", () => songSelect.Carousel.SelectedBeatmap.ID == previousID);
|
|
||||||
|
AddAssert("Selected beatmap correct", () => songSelect.Carousel.SelectedBeatmap == filteredBeatmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getBeatmapIndex(BeatmapSetInfo set, BeatmapInfo info) => set.Beatmaps.FindIndex(b => b == info);
|
private int getBeatmapIndex(BeatmapSetInfo set, BeatmapInfo info) => set.Beatmaps.FindIndex(b => b == info);
|
||||||
|
Loading…
Reference in New Issue
Block a user