Cleanup test

This commit is contained in:
smoogipoo
2020-05-22 20:18:47 +09:00
parent 899b9f8060
commit 5005986049

View File

@ -9,16 +9,13 @@ using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Testing;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu;
using osu.Game.Scoring; using osu.Game.Scoring;
using osu.Game.Screens.Ranking; using osu.Game.Screens.Ranking;
using osu.Game.Screens.Ranking.Contracted; using osu.Game.Screens.Ranking.Contracted;
using osu.Game.Tests.Beatmaps; using osu.Game.Tests.Beatmaps;
using osu.Game.Users;
using osuTK; using osuTK;
namespace osu.Game.Tests.Visual.Ranking namespace osu.Game.Tests.Visual.Ranking
@ -29,22 +26,9 @@ namespace osu.Game.Tests.Visual.Ranking
private RulesetStore rulesetStore { get; set; } private RulesetStore rulesetStore { get; set; }
[Test] [Test]
public void TestMapWithKnownMapper() public void TestShowPanel()
{ {
var author = new User { Username = "mapper_name" }; AddStep("show example score", () => showPanel(createTestBeatmap(), new TestScoreInfo(new OsuRuleset().RulesetInfo)));
AddStep("show example score", () => showPanel(createTestBeatmap(author), new TestScoreInfo(new OsuRuleset().RulesetInfo)));
AddAssert("mapper name present", () => this.ChildrenOfType<OsuSpriteText>().Any(spriteText => spriteText.Text == "mapper_name"));
}
[Test]
public void TestMapWithUnknownMapper()
{
AddStep("show example score", () => showPanel(createTestBeatmap(null), new TestScoreInfo(new OsuRuleset().RulesetInfo)));
AddAssert("mapped by text not present", () =>
this.ChildrenOfType<OsuSpriteText>().All(spriteText => !containsAny(spriteText.Text, "mapped", "by")));
} }
private void showPanel(WorkingBeatmap workingBeatmap, ScoreInfo score) private void showPanel(WorkingBeatmap workingBeatmap, ScoreInfo score)
@ -52,10 +36,9 @@ namespace osu.Game.Tests.Visual.Ranking
Child = new ContractedPanelMiddleContentContainer(workingBeatmap, score); Child = new ContractedPanelMiddleContentContainer(workingBeatmap, score);
} }
private WorkingBeatmap createTestBeatmap(User author) private WorkingBeatmap createTestBeatmap()
{ {
var beatmap = new TestBeatmap(rulesetStore.GetRuleset(0)); var beatmap = new TestBeatmap(rulesetStore.GetRuleset(0));
beatmap.Metadata.Author = author;
beatmap.Metadata.Title = "Verrrrrrrrrrrrrrrrrrry looooooooooooooooooooooooong beatmap title"; beatmap.Metadata.Title = "Verrrrrrrrrrrrrrrrrrry looooooooooooooooooooooooong beatmap title";
beatmap.Metadata.Artist = "Verrrrrrrrrrrrrrrrrrry looooooooooooooooooooooooong beatmap artist"; beatmap.Metadata.Artist = "Verrrrrrrrrrrrrrrrrrry looooooooooooooooooooooooong beatmap artist";
@ -75,7 +58,7 @@ namespace osu.Game.Tests.Visual.Ranking
Anchor = Anchor.Centre; Anchor = Anchor.Centre;
Origin = Anchor.Centre; Origin = Anchor.Centre;
Size = new Vector2(ScorePanel.CONTRACTED_WIDTH, 700); Size = new Vector2(ScorePanel.CONTRACTED_WIDTH, 460);
Children = new Drawable[] Children = new Drawable[]
{ {
new Box new Box