mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 11:27:24 +08:00
Add failing test case for old cards not expiring correctly
This commit is contained in:
parent
d4ea57c660
commit
2660f41339
@ -107,19 +107,31 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
AddUntilStep("is hidden", () => overlay.State.Value == Visibility.Hidden);
|
AddUntilStep("is hidden", () => overlay.State.Value == Visibility.Hidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestCorrectOldContentExpiration()
|
||||||
|
{
|
||||||
|
AddAssert("is visible", () => overlay.State.Value == Visibility.Visible);
|
||||||
|
|
||||||
|
AddStep("show many results", () => fetchFor(Enumerable.Repeat(CreateAPIBeatmapSet(Ruleset.Value), 100).ToArray()));
|
||||||
|
assertAllCardsOfType<BeatmapCardNormal>(100);
|
||||||
|
|
||||||
|
AddStep("show more results", () => fetchFor(Enumerable.Repeat(CreateAPIBeatmapSet(Ruleset.Value), 30).ToArray()));
|
||||||
|
assertAllCardsOfType<BeatmapCardNormal>(30);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestCardSizeSwitching()
|
public void TestCardSizeSwitching()
|
||||||
{
|
{
|
||||||
AddAssert("is visible", () => overlay.State.Value == Visibility.Visible);
|
AddAssert("is visible", () => overlay.State.Value == Visibility.Visible);
|
||||||
|
|
||||||
AddStep("show many results", () => fetchFor(Enumerable.Repeat(CreateAPIBeatmapSet(Ruleset.Value), 100).ToArray()));
|
AddStep("show many results", () => fetchFor(Enumerable.Repeat(CreateAPIBeatmapSet(Ruleset.Value), 100).ToArray()));
|
||||||
assertAllCardsOfType<BeatmapCardNormal>();
|
assertAllCardsOfType<BeatmapCardNormal>(100);
|
||||||
|
|
||||||
setCardSize(BeatmapCardSize.Extra);
|
setCardSize(BeatmapCardSize.Extra);
|
||||||
assertAllCardsOfType<BeatmapCardExtra>();
|
assertAllCardsOfType<BeatmapCardExtra>(100);
|
||||||
|
|
||||||
setCardSize(BeatmapCardSize.Normal);
|
setCardSize(BeatmapCardSize.Normal);
|
||||||
assertAllCardsOfType<BeatmapCardNormal>();
|
assertAllCardsOfType<BeatmapCardNormal>(100);
|
||||||
|
|
||||||
AddStep("fetch for 0 beatmaps", () => fetchFor());
|
AddStep("fetch for 0 beatmaps", () => fetchFor());
|
||||||
AddUntilStep("placeholder shown", () => overlay.ChildrenOfType<BeatmapListingOverlay.NotFoundDrawable>().SingleOrDefault()?.IsPresent == true);
|
AddUntilStep("placeholder shown", () => overlay.ChildrenOfType<BeatmapListingOverlay.NotFoundDrawable>().SingleOrDefault()?.IsPresent == true);
|
||||||
@ -323,13 +335,12 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
|
|
||||||
private void setCardSize(BeatmapCardSize cardSize) => AddStep($"set card size to {cardSize}", () => overlay.ChildrenOfType<BeatmapListingCardSizeTabControl>().Single().Current.Value = cardSize);
|
private void setCardSize(BeatmapCardSize cardSize) => AddStep($"set card size to {cardSize}", () => overlay.ChildrenOfType<BeatmapListingCardSizeTabControl>().Single().Current.Value = cardSize);
|
||||||
|
|
||||||
private void assertAllCardsOfType<T>()
|
private void assertAllCardsOfType<T>(int expectedCount)
|
||||||
where T : BeatmapCard =>
|
where T : BeatmapCard =>
|
||||||
AddUntilStep($"all loaded beatmap cards are {typeof(T)}", () =>
|
AddUntilStep($"all loaded beatmap cards are {typeof(T)}", () =>
|
||||||
{
|
{
|
||||||
int loadedCorrectCount = this.ChildrenOfType<BeatmapCard>().Count(card => card.IsLoaded && card.GetType() == typeof(T));
|
int loadedCorrectCount = this.ChildrenOfType<BeatmapCard>().Count(card => card.IsLoaded && card.GetType() == typeof(T));
|
||||||
int totalCount = this.ChildrenOfType<BeatmapCard>().Count();
|
return loadedCorrectCount > 0 && loadedCorrectCount == expectedCount;
|
||||||
return loadedCorrectCount > 0 && loadedCorrectCount == totalCount;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user