fix test count

This commit is contained in:
David Zhao 2019-06-10 18:58:03 +09:00
parent 41e3e2222b
commit d4ba67747b
2 changed files with 11 additions and 3 deletions

View File

@ -0,0 +1 @@
osu

View File

@ -11,6 +11,7 @@
using osu.Framework.Audio;
using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Logging;
using osu.Framework.MathUtils;
using osu.Framework.Platform;
using osu.Framework.Screens;
@ -215,11 +216,13 @@ public void TestAddNewBeatmapWhileSelectingRandom()
{
const int test_count = 10;
int beatmapChangedCount = 0;
int debounceCount = 0;
createSongSelect();
AddStep("Setup counter", () =>
AddStep("Setup counters", () =>
{
beatmapChangedCount = 0;
songSelect.Carousel.SelectionChanged += _ => beatmapChangedCount++;
debounceCount = 0;
songSelect.Carousel.SelectionChanged += _ => beatmapChangedCount += 1;
});
AddRepeatStep($"Create beatmaps {test_count} times", () =>
{
@ -229,10 +232,14 @@ public void TestAddNewBeatmapWhileSelectingRandom()
{
// Wait for debounce
songSelect.Carousel.SelectNextRandom();
++debounceCount;
}, 400);
}, test_count);
AddAssert($"Beatmap changed {test_count} times", () => beatmapChangedCount == test_count);
AddUntilStep("Debounce limit reached", () => debounceCount == test_count);
// The selected beatmap should have changed an additional 2 times since both initially loading songselect and the first import also triggers selectionChanged
AddAssert($"Beatmap changed {test_count + 2} times", () => beatmapChangedCount == test_count + 2);
}
[Test]