mirror of
https://github.com/ppy/osu.git
synced 2025-03-19 01:17:19 +08:00
Add failing test case
This commit is contained in:
parent
5a4a07b146
commit
2767dda9d6
@ -17,10 +17,13 @@ using osu.Game.Database;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Difficulty;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Screens.Ranking;
|
||||
using osu.Game.Screens.Ranking.Expanded.Statistics;
|
||||
using osu.Game.Screens.Ranking.Statistics;
|
||||
using osu.Game.Tests.Resources;
|
||||
using osuTK;
|
||||
@ -256,6 +259,23 @@ namespace osu.Game.Tests.Visual.Ranking
|
||||
AddAssert("download button is enabled", () => screen.ChildrenOfType<DownloadButton>().Last().Enabled.Value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRulesetWithNoPerformanceCalculator()
|
||||
{
|
||||
var ruleset = new RulesetWithNoPerformanceCalculator();
|
||||
var score = TestResources.CreateTestScoreInfo(ruleset.RulesetInfo);
|
||||
|
||||
AddStep("load results", () => Child = new TestResultsContainer(createResultsScreen(score)));
|
||||
AddUntilStep("wait for load", () => this.ChildrenOfType<ScorePanelList>().Single().AllPanelsVisible);
|
||||
|
||||
AddAssert("PP displayed as 0", () =>
|
||||
{
|
||||
var performance = this.ChildrenOfType<PerformanceStatistic>().Single();
|
||||
var counter = performance.ChildrenOfType<StatisticCounter>().Single();
|
||||
return counter.Current.Value == 0;
|
||||
});
|
||||
}
|
||||
|
||||
private TestResultsScreen createResultsScreen(ScoreInfo score = null) => new TestResultsScreen(score ?? TestResources.CreateTestScoreInfo());
|
||||
|
||||
private UnrankedSoloResultsScreen createUnrankedSoloResultsScreen() => new UnrankedSoloResultsScreen(TestResources.CreateTestScoreInfo());
|
||||
@ -367,5 +387,10 @@ namespace osu.Game.Tests.Visual.Ranking
|
||||
RetryOverlay = InternalChildren.OfType<HotkeyRetryOverlay>().SingleOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
private class RulesetWithNoPerformanceCalculator : OsuRuleset
|
||||
{
|
||||
public override PerformanceCalculator CreatePerformanceCalculator(DifficultyAttributes attributes, ScoreInfo score) => null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user