1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-25 16:12:55 +08:00
osu-lazer/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButton.cs

68 lines
2.1 KiB
C#
Raw Normal View History

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
{
public class TestSceneCommentRepliesButton : OsuTestScene
{
[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(),
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);
}
2020-07-11 12:47:17 +08:00
private class TestButton : CommentRepliesButton
{
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
}
}
}