2024-01-18 16:17:37 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
using NUnit.Framework;
|
2024-01-22 16:18:22 +08:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Utils;
|
2024-01-18 16:17:37 +08:00
|
|
|
using osu.Game.Beatmaps.Drawables;
|
|
|
|
using osu.Game.Rulesets.Osu;
|
|
|
|
using osu.Game.Tests.Beatmaps;
|
2024-01-22 16:18:22 +08:00
|
|
|
using osuTK;
|
2024-01-18 16:17:37 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Tests.Visual.Beatmaps
|
|
|
|
{
|
|
|
|
public partial class TestSceneDifficultyIcon : OsuTestScene
|
|
|
|
{
|
2024-02-22 18:45:57 +08:00
|
|
|
private FillFlowContainer fill = null!;
|
2024-01-22 16:18:22 +08:00
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
|
|
Child = fill = new FillFlowContainer
|
|
|
|
{
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
Width = 300,
|
|
|
|
Direction = FillDirection.Full,
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2024-01-18 16:17:37 +08:00
|
|
|
[Test]
|
2024-01-19 00:16:03 +08:00
|
|
|
public void CreateDifficultyIcon()
|
2024-01-18 16:17:37 +08:00
|
|
|
{
|
2024-02-22 18:45:57 +08:00
|
|
|
DifficultyIcon difficultyIcon = null!;
|
2024-01-18 16:17:37 +08:00
|
|
|
|
2024-01-22 16:18:22 +08:00
|
|
|
AddRepeatStep("create difficulty icon", () =>
|
2024-01-18 16:17:37 +08:00
|
|
|
{
|
2024-01-22 16:18:22 +08:00
|
|
|
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)
|
2024-01-18 16:17:37 +08:00
|
|
|
{
|
2024-01-22 16:18:22 +08:00
|
|
|
Scale = new Vector2(2),
|
2024-01-18 16:17:37 +08:00
|
|
|
ShowTooltip = true,
|
|
|
|
ShowExtendedTooltip = true
|
2024-01-22 16:18:22 +08:00
|
|
|
});
|
|
|
|
}, 10);
|
2024-01-18 16:17:37 +08:00
|
|
|
|
|
|
|
AddStep("hide extended tooltip", () => difficultyIcon.ShowExtendedTooltip = false);
|
|
|
|
|
|
|
|
AddStep("hide tooltip", () => difficultyIcon.ShowTooltip = false);
|
|
|
|
|
|
|
|
AddStep("show tooltip", () => difficultyIcon.ShowTooltip = true);
|
|
|
|
|
|
|
|
AddStep("show extended tooltip", () => difficultyIcon.ShowExtendedTooltip = true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|