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

Move test to improve diff readability

This commit is contained in:
Endrik Tombak 2022-10-24 22:55:09 +03:00
parent 9def12c60b
commit b95091fbb0

View File

@ -827,63 +827,6 @@ namespace osu.Game.Tests.Visual.SongSelect
AddStep("remove single ruleset set", () => carousel.RemoveBeatmapSet(testSingle));
}
[Test]
public void TestCarouselSelectsNextWhenPreviousIsFiltered()
{
List<BeatmapSetInfo> sets = new List<BeatmapSetInfo>();
// 10 sets that go osu! -> taiko -> catch -> osu! -> ...
for (int i = 0; i < 10; i++)
{
var rulesetInfo = rulesets.AvailableRulesets.ElementAt(i % 3);
sets.Add(TestResources.CreateTestBeatmapSetInfo(5, new[] { rulesetInfo }));
}
// Sort mode is important to keep the ruleset order
loadBeatmaps(sets, () => new FilterCriteria { Sort = SortMode.Title });
setSelected(1, 1);
for (int i = 1; i < 10; i++)
{
var rulesetInfo = rulesets.AvailableRulesets.ElementAt(i % 3);
AddStep($"Set ruleset to {rulesetInfo.ShortName}", () =>
{
carousel.Filter(new FilterCriteria { Ruleset = rulesetInfo, Sort = SortMode.Title }, false);
});
waitForSelection(i + 1, 1);
}
}
[Test]
public void TestCarouselSelectsBackwardsWhenDistanceIsShorter()
{
List<BeatmapSetInfo> sets = new List<BeatmapSetInfo>();
// 10 sets that go taiko, osu!, osu!, osu!, taiko, osu!, osu!, osu!, ...
for (int i = 0; i < 10; i++)
{
var rulesetInfo = rulesets.AvailableRulesets.ElementAt(i % 4 == 0 ? 1 : 0);
sets.Add(TestResources.CreateTestBeatmapSetInfo(5, new[] { rulesetInfo }));
}
// Sort mode is important to keep the ruleset order
loadBeatmaps(sets, () => new FilterCriteria { Sort = SortMode.Title });
for (int i = 2; i < 10; i += 4)
{
setSelected(i, 1);
AddStep("Set ruleset to taiko", () =>
{
carousel.Filter(new FilterCriteria { Ruleset = rulesets.AvailableRulesets.ElementAt(1), Sort = SortMode.Title }, false);
});
waitForSelection(i - 1, 1);
AddStep("Remove ruleset filter", () =>
{
carousel.Filter(new FilterCriteria { Sort = SortMode.Title }, false);
});
}
}
[Test]
public void TestCarouselRemembersSelection()
{
@ -966,6 +909,63 @@ namespace osu.Game.Tests.Visual.SongSelect
checkVisibleItemCount(true, 15);
}
[Test]
public void TestCarouselSelectsNextWhenPreviousIsFiltered()
{
List<BeatmapSetInfo> sets = new List<BeatmapSetInfo>();
// 10 sets that go osu! -> taiko -> catch -> osu! -> ...
for (int i = 0; i < 10; i++)
{
var rulesetInfo = rulesets.AvailableRulesets.ElementAt(i % 3);
sets.Add(TestResources.CreateTestBeatmapSetInfo(5, new[] { rulesetInfo }));
}
// Sort mode is important to keep the ruleset order
loadBeatmaps(sets, () => new FilterCriteria { Sort = SortMode.Title });
setSelected(1, 1);
for (int i = 1; i < 10; i++)
{
var rulesetInfo = rulesets.AvailableRulesets.ElementAt(i % 3);
AddStep($"Set ruleset to {rulesetInfo.ShortName}", () =>
{
carousel.Filter(new FilterCriteria { Ruleset = rulesetInfo, Sort = SortMode.Title }, false);
});
waitForSelection(i + 1, 1);
}
}
[Test]
public void TestCarouselSelectsBackwardsWhenDistanceIsShorter()
{
List<BeatmapSetInfo> sets = new List<BeatmapSetInfo>();
// 10 sets that go taiko, osu!, osu!, osu!, taiko, osu!, osu!, osu!, ...
for (int i = 0; i < 10; i++)
{
var rulesetInfo = rulesets.AvailableRulesets.ElementAt(i % 4 == 0 ? 1 : 0);
sets.Add(TestResources.CreateTestBeatmapSetInfo(5, new[] { rulesetInfo }));
}
// Sort mode is important to keep the ruleset order
loadBeatmaps(sets, () => new FilterCriteria { Sort = SortMode.Title });
for (int i = 2; i < 10; i += 4)
{
setSelected(i, 1);
AddStep("Set ruleset to taiko", () =>
{
carousel.Filter(new FilterCriteria { Ruleset = rulesets.AvailableRulesets.ElementAt(1), Sort = SortMode.Title }, false);
});
waitForSelection(i - 1, 1);
AddStep("Remove ruleset filter", () =>
{
carousel.Filter(new FilterCriteria { Sort = SortMode.Title }, false);
});
}
}
private void loadBeatmaps(List<BeatmapSetInfo> beatmapSets = null, Func<FilterCriteria> initialCriteria = null, Action<BeatmapCarousel> carouselAdjust = null, int? count = null,
bool randomDifficulties = false)
{