Merge remote-tracking branch 'upstream/master' into fix-info-wedge

This commit is contained in:
Dean Herbert 2017-12-23 21:40:27 +09:00
commit 8e644e878a
2 changed files with 21 additions and 1 deletions

View File

@ -69,6 +69,7 @@ private void load()
testSorting();
testRemoveAll();
testEmptyTraversal();
}
private void ensureRandomFetchSuccess() =>
@ -103,6 +104,8 @@ private void checkVisibleItemCount(bool diff, int count) =>
AddAssert($"{count} {(diff ? "diffs" : "sets")} visible", () =>
carousel.Items.Count(s => (diff ? s.Item is CarouselBeatmap : s.Item is CarouselBeatmapSet) && s.Item.Visible) == count);
private void checkNoSelection() => AddAssert("Selection is null", () => currentSelection == null);
private void nextRandom() =>
AddStep("select random next", () =>
{
@ -274,9 +277,23 @@ private void testRemoveAll()
return false;
}, "Remove all");
AddAssert("Selection is null", () => currentSelection == null);
checkNoSelection();
}
private void testEmptyTraversal()
{
advanceSelection(direction: 1, diff: false);
checkNoSelection();
advanceSelection(direction: 1, diff: true);
checkNoSelection();
advanceSelection(direction: -1, diff: false);
checkNoSelection();
advanceSelection(direction: -1, diff: true);
checkNoSelection();
}
private BeatmapSetInfo createTestBeatmapSet(int i)
{

View File

@ -181,6 +181,9 @@ public void SelectBeatmap(BeatmapInfo beatmap)
/// <param name="skipDifficulties">Whether to skip individual difficulties and only increment over full groups.</param>
public void SelectNext(int direction = 1, bool skipDifficulties = true)
{
if (!Items.Any())
return;
int originalIndex = Items.IndexOf(selectedBeatmap?.Drawables.First());
int currentIndex = originalIndex;