mirror of
https://github.com/ppy/osu.git
synced 2025-03-21 18:07:19 +08:00
Add test
This commit is contained in:
parent
34ff072a9b
commit
194bb02c28
@ -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", () =>
|
||||
|
Loading…
x
Reference in New Issue
Block a user