mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 23:12:56 +08:00
Make test actually test multiple icons
This commit is contained in:
parent
87369f8a80
commit
f12be60d8d
@ -4,27 +4,58 @@
|
|||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Beatmaps.Drawables;
|
using osu.Game.Beatmaps.Drawables;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Tests.Beatmaps;
|
using osu.Game.Tests.Beatmaps;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Beatmaps
|
namespace osu.Game.Tests.Visual.Beatmaps
|
||||||
{
|
{
|
||||||
public partial class TestSceneDifficultyIcon : OsuTestScene
|
public partial class TestSceneDifficultyIcon : OsuTestScene
|
||||||
{
|
{
|
||||||
|
private FillFlowContainer fill;
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
Child = fill = new FillFlowContainer
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Width = 300,
|
||||||
|
Direction = FillDirection.Full,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void CreateDifficultyIcon()
|
public void CreateDifficultyIcon()
|
||||||
{
|
{
|
||||||
DifficultyIcon difficultyIcon = null;
|
DifficultyIcon difficultyIcon = null;
|
||||||
|
|
||||||
AddStep("create difficulty icon", () =>
|
AddRepeatStep("create difficulty icon", () =>
|
||||||
{
|
{
|
||||||
Child = difficultyIcon = new DifficultyIcon(new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo, new OsuRuleset().RulesetInfo)
|
var rulesetInfo = new OsuRuleset().RulesetInfo;
|
||||||
|
var beatmapInfo = new TestBeatmap(rulesetInfo).BeatmapInfo;
|
||||||
|
|
||||||
|
beatmapInfo.Difficulty.ApproachRate = RNG.Next(0, 10);
|
||||||
|
beatmapInfo.Difficulty.CircleSize = RNG.Next(0, 10);
|
||||||
|
beatmapInfo.Difficulty.OverallDifficulty = RNG.Next(0, 10);
|
||||||
|
beatmapInfo.Difficulty.DrainRate = RNG.Next(0, 10);
|
||||||
|
beatmapInfo.StarRating = RNG.NextSingle(0, 10);
|
||||||
|
beatmapInfo.BPM = RNG.Next(60, 300);
|
||||||
|
|
||||||
|
fill.Add(difficultyIcon = new DifficultyIcon(beatmapInfo, rulesetInfo)
|
||||||
{
|
{
|
||||||
|
Scale = new Vector2(2),
|
||||||
ShowTooltip = true,
|
ShowTooltip = true,
|
||||||
ShowExtendedTooltip = true
|
ShowExtendedTooltip = true
|
||||||
};
|
});
|
||||||
});
|
}, 10);
|
||||||
|
|
||||||
AddStep("hide extended tooltip", () => difficultyIcon.ShowExtendedTooltip = false);
|
AddStep("hide extended tooltip", () => difficultyIcon.ShowExtendedTooltip = false);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user