osu/osu.Game.Tests/Visual/UserInterface/TestSceneCommentRepliesButt...

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

68 lines
2.2 KiB
C#
Raw Normal View History

2020-07-11 04:47:17 +00: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 10:19:28 +00:00
using NUnit.Framework;
using System.Linq;
using osu.Framework.Graphics.Sprites;
2020-07-12 10:36:42 +00:00
using osu.Framework.Testing;
2020-07-11 04:47:17 +00:00
namespace osu.Game.Tests.Visual.UserInterface
{
public partial class TestSceneCommentRepliesButton : OsuTestScene
{
[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
2020-07-12 10:19:28 +00:00
private readonly TestButton button;
2020-07-11 04:47:17 +00: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 10:19:28 +00:00
button = new TestButton(),
new LoadRepliesButton
{
Action = () => { }
},
2020-07-11 05:13:11 +00:00
new ShowRepliesButton(1),
2020-07-11 04:47:17 +00:00
new ShowRepliesButton(2)
}
};
}
2020-07-12 10:19:28 +00:00
[Test]
2020-07-14 00:01:14 +00:00
public void TestArrowDirection()
2020-07-12 10:19:28 +00:00
{
2020-07-14 00:01:14 +00:00
AddStep("Set upwards", () => button.SetIconDirection(true));
2024-07-08 08:00:36 +00:00
AddUntilStep("Icon facing upwards", () => button.Icon.Scale.Y == -1);
2020-07-14 00:01:14 +00:00
AddStep("Set downwards", () => button.SetIconDirection(false));
2024-07-08 08:00:36 +00:00
AddUntilStep("Icon facing downwards", () => button.Icon.Scale.Y == 1);
2020-07-12 10:19:28 +00:00
}
2020-07-11 04:47:17 +00:00
private partial class TestButton : CommentRepliesButton
{
2020-07-12 10:36:42 +00:00
public SpriteIcon Icon => this.ChildrenOfType<SpriteIcon>().First();
2020-07-12 10:19:28 +00:00
2020-07-12 09:27:26 +00:00
public TestButton()
{
Text = "sample text";
}
2020-07-12 10:19:28 +00:00
2020-07-14 00:01:14 +00:00
public new void SetIconDirection(bool upwards) => base.SetIconDirection(upwards);
2020-07-11 04:47:17 +00:00
}
}
}