Skip to content

Commit

Permalink
Fix failing test and add coverage of conversion case
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Dec 13, 2023
1 parent 0611a1d commit eff81be
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion osu.Game.Tests/Visual/SongSelect/TestSceneAdvancedStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
using osu.Game.Graphics;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mania;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Screens.Select.Details;
using osuTK.Graphics;
Expand All @@ -38,6 +40,12 @@ public partial class TestSceneAdvancedStats : OsuTestScene
Width = 500
});

[SetUpSteps]
public void SetUpSteps()
{
AddStep("reset game ruleset", () => Ruleset.Value = new OsuRuleset().RulesetInfo);
}

private BeatmapInfo exampleBeatmapInfo => new BeatmapInfo
{
Ruleset = rulesets.AvailableRulesets.First(),
Expand Down Expand Up @@ -66,8 +74,10 @@ public void TestNoMod()
}

[Test]
public void TestManiaFirstBarText()
public void TestManiaFirstBarTextManiaBeatmap()
{
AddStep("set game ruleset to mania", () => Ruleset.Value = new ManiaRuleset().RulesetInfo);

AddStep("set beatmap", () => advancedStats.BeatmapInfo = new BeatmapInfo
{
Ruleset = rulesets.GetRuleset(3) ?? throw new InvalidOperationException("osu!mania ruleset not found"),
Expand All @@ -84,6 +94,27 @@ public void TestManiaFirstBarText()
AddAssert("first bar text is correct", () => advancedStats.ChildrenOfType<SpriteText>().First().Text == BeatmapsetsStrings.ShowStatsCsMania);
}

[Test]
public void TestManiaFirstBarTextConvert()
{
AddStep("set game ruleset to mania", () => Ruleset.Value = new ManiaRuleset().RulesetInfo);

AddStep("set beatmap", () => advancedStats.BeatmapInfo = new BeatmapInfo
{
Ruleset = new OsuRuleset().RulesetInfo,
Difficulty = new BeatmapDifficulty
{
CircleSize = 5,
DrainRate = 4.3f,
OverallDifficulty = 4.5f,
ApproachRate = 3.1f
},
StarRating = 8
});

AddAssert("first bar text is correct", () => advancedStats.ChildrenOfType<SpriteText>().First().Text == BeatmapsetsStrings.ShowStatsCsMania);
}

[Test]
public void TestEasyMod()
{
Expand Down

0 comments on commit eff81be

Please sign in to comment.