2021-10-17 20:15:36 +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.
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
#nullable disable
|
|
|
|
|
2021-10-17 20:15:36 +08:00
|
|
|
using System;
|
2021-10-17 20:55:52 +08:00
|
|
|
using System.Collections.Generic;
|
2021-10-17 20:15:36 +08:00
|
|
|
using System.Linq;
|
2021-10-17 20:55:52 +08:00
|
|
|
using NUnit.Framework;
|
|
|
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
2021-10-17 20:15:36 +08:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2021-10-17 20:55:52 +08:00
|
|
|
using osu.Framework.Testing;
|
2021-10-17 20:15:36 +08:00
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
using osu.Game.Beatmaps.Drawables;
|
2021-10-17 20:55:52 +08:00
|
|
|
using osu.Game.Overlays;
|
2021-10-17 20:15:36 +08:00
|
|
|
using osu.Game.Tests.Visual.UserInterface;
|
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
namespace osu.Game.Tests.Visual.Beatmaps
|
|
|
|
{
|
|
|
|
public class TestSceneBeatmapSetOnlineStatusPill : ThemeComparisonTestScene
|
|
|
|
{
|
|
|
|
protected override Drawable CreateContent() => new FillFlowContainer
|
|
|
|
{
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
Spacing = new Vector2(0, 10),
|
2021-11-24 17:42:47 +08:00
|
|
|
ChildrenEnumerable = Enum.GetValues(typeof(BeatmapOnlineStatus)).Cast<BeatmapOnlineStatus>().Select(status => new BeatmapSetOnlineStatusPill
|
2021-10-17 20:15:36 +08:00
|
|
|
{
|
2021-10-26 02:20:40 +08:00
|
|
|
AutoSizeAxes = Axes.Both,
|
2021-10-17 20:15:36 +08:00
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
Status = status
|
|
|
|
})
|
|
|
|
};
|
2021-10-17 20:55:52 +08:00
|
|
|
|
|
|
|
private IEnumerable<BeatmapSetOnlineStatusPill> statusPills => this.ChildrenOfType<BeatmapSetOnlineStatusPill>();
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void TestFixedWidth()
|
|
|
|
{
|
|
|
|
AddStep("create themed content", () => CreateThemedContent(OverlayColourScheme.Red));
|
|
|
|
|
2021-10-26 02:20:40 +08:00
|
|
|
AddStep("set fixed width", () => statusPills.ForEach(pill =>
|
|
|
|
{
|
|
|
|
pill.AutoSizeAxes = Axes.Y;
|
|
|
|
pill.Width = 90;
|
|
|
|
}));
|
|
|
|
AddStep("unset fixed width", () => statusPills.ForEach(pill => pill.AutoSizeAxes = Axes.Both));
|
2021-10-17 20:55:52 +08:00
|
|
|
}
|
2021-10-17 20:15:36 +08:00
|
|
|
}
|
|
|
|
}
|