1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-21 22:27:23 +08:00
This commit is contained in:
ansel 2022-10-13 22:47:53 +03:00
parent 34ff072a9b
commit 194bb02c28

View File

@ -10,6 +10,7 @@ using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Platform;
using osu.Framework.Testing;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
@ -35,6 +36,9 @@ namespace osu.Game.Tests.Visual.Online
[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple);
[Resolved]
private GameHost host { get; set; } = null!;
private CommentsContainer commentsContainer = null!;
[BackgroundDependencyLoader]
@ -204,6 +208,22 @@ namespace osu.Game.Tests.Visual.Online
});
}
[Test]
public void TestCopyLink()
{
addTestComments();
AddUntilStep("Comments loaded", () => this.ChildrenOfType<DrawableComment>().Count() == 2);
AddStep("Click copy link", () =>
{
var comment = this.ChildrenOfType<DrawableComment>().First();
var links = comment.ChildrenOfType<LinkFlowContainer>().Single(x => x.Name == @"Actions buttons");
var btn = links.ChildrenOfType<OsuSpriteText>().Single(x => x.Text.ToString().StartsWith("Copy"));
InputManager.MoveMouseTo(btn);
InputManager.Click(MouseButton.Left);
});
AddUntilStep("Link copied", () => host.GetClipboard()?.GetText() == "https://osu.ppy.sh/comments/1");
}
private void addTestComments()
{
AddStep("set up response", () =>