2020-07-11 12:47:17 +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 osu.Game.Overlays.Comments.Buttons;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Game.Overlays;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osuTK;
|
2020-07-12 18:19:28 +08:00
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2020-07-12 18:36:42 +08:00
|
|
|
|
using osu.Framework.Testing;
|
2020-07-11 12:47:17 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Tests.Visual.UserInterface
|
|
|
|
|
{
|
2022-11-24 13:32:20 +08:00
|
|
|
|
public partial class TestSceneCommentRepliesButton : OsuTestScene
|
2020-07-11 12:47:17 +08:00
|
|
|
|
{
|
|
|
|
|
[Cached]
|
|
|
|
|
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
|
|
|
|
|
|
2020-07-12 18:19:28 +08:00
|
|
|
|
private readonly TestButton button;
|
|
|
|
|
|
2020-07-11 12:47:17 +08:00
|
|
|
|
public TestSceneCommentRepliesButton()
|
|
|
|
|
{
|
|
|
|
|
Child = new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
|
Spacing = new Vector2(0, 10),
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2020-07-12 18:19:28 +08:00
|
|
|
|
button = new TestButton(),
|
2020-07-14 20:02:29 +08:00
|
|
|
|
new LoadRepliesButton
|
|
|
|
|
{
|
|
|
|
|
Action = () => { }
|
|
|
|
|
},
|
2020-07-11 13:13:11 +08:00
|
|
|
|
new ShowRepliesButton(1),
|
2020-07-11 12:47:17 +08:00
|
|
|
|
new ShowRepliesButton(2)
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2020-07-12 18:19:28 +08:00
|
|
|
|
[Test]
|
2020-07-14 08:01:14 +08:00
|
|
|
|
public void TestArrowDirection()
|
2020-07-12 18:19:28 +08:00
|
|
|
|
{
|
2020-07-14 08:01:14 +08:00
|
|
|
|
AddStep("Set upwards", () => button.SetIconDirection(true));
|
2020-07-12 18:19:28 +08:00
|
|
|
|
AddAssert("Icon facing upwards", () => button.Icon.Scale.Y == -1);
|
2020-07-14 08:01:14 +08:00
|
|
|
|
AddStep("Set downwards", () => button.SetIconDirection(false));
|
2020-07-12 18:19:28 +08:00
|
|
|
|
AddAssert("Icon facing downwards", () => button.Icon.Scale.Y == 1);
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-24 13:32:20 +08:00
|
|
|
|
private partial class TestButton : CommentRepliesButton
|
2020-07-11 12:47:17 +08:00
|
|
|
|
{
|
2020-07-12 18:36:42 +08:00
|
|
|
|
public SpriteIcon Icon => this.ChildrenOfType<SpriteIcon>().First();
|
2020-07-12 18:19:28 +08:00
|
|
|
|
|
2020-07-12 17:27:26 +08:00
|
|
|
|
public TestButton()
|
|
|
|
|
{
|
|
|
|
|
Text = "sample text";
|
|
|
|
|
}
|
2020-07-12 18:19:28 +08:00
|
|
|
|
|
2020-07-14 08:01:14 +08:00
|
|
|
|
public new void SetIconDirection(bool upwards) => base.SetIconDirection(upwards);
|
2020-07-11 12:47:17 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|