1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 18:32:56 +08:00

Added tests for hiding diffs (and especially the last visible diff)

This commit is contained in:
FreezyLemon 2017-12-26 03:57:18 +01:00
parent c737e5245e
commit c822735724

View File

@ -70,6 +70,7 @@ namespace osu.Game.Tests.Visual
testRemoveAll();
testEmptyTraversal();
testHiding();
}
private void ensureRandomFetchSuccess() =>
@ -295,6 +296,40 @@ namespace osu.Game.Tests.Visual
checkNoSelection();
}
private void testHiding()
{
var hidingSet = createTestBeatmapSet(1);
hidingSet.Beatmaps[1].Hidden = true;
AddStep("Add set with diff 2 hidden", () => carousel.UpdateBeatmapSet(hidingSet));
setSelected(1, 1);
checkVisibleItemCount(true, 2);
advanceSelection(true);
checkSelected(1, 3);
setHidden(3);
checkSelected(1, 1);
setHidden(2, false);
advanceSelection(true);
checkSelected(1, 2);
setHidden(1);
checkSelected(1, 2);
setHidden(2);
checkNoSelection();
void setHidden(int diff, bool hidden = true)
{
AddStep((hidden ? "" : "un") + $"hide diff {diff}", () =>
{
hidingSet.Beatmaps[diff - 1].Hidden = hidden;
carousel.UpdateBeatmapSet(hidingSet);
});
}
}
private BeatmapSetInfo createTestBeatmapSet(int i)
{
return new BeatmapSetInfo