mirror of
https://github.com/ppy/osu
synced 2024-12-12 01:48:49 +00:00
Add visual test case for report button
Makes it much easier to test button/popover design changes
This commit is contained in:
parent
6c82bc36ed
commit
90a9961a69
46
osu.Game.Tests/Visual/Online/TestSceneCommentReportButton.cs
Normal file
46
osu.Game.Tests/Visual/Online/TestSceneCommentReportButton.cs
Normal file
@ -0,0 +1,46 @@
|
||||
// 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.Framework.Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Overlays.Comments;
|
||||
using osu.Game.Tests.Visual.UserInterface;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
public class TestSceneCommentReportButton : ThemeComparisonTestScene
|
||||
{
|
||||
[SetUpSteps]
|
||||
public void SetUpSteps()
|
||||
{
|
||||
AddStep("setup API", () => ((DummyAPIAccess)API).HandleRequest += req =>
|
||||
{
|
||||
switch (req)
|
||||
{
|
||||
case CommentReportRequest report:
|
||||
Scheduler.AddDelayed(report.TriggerSuccess, 1000);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
protected override Drawable CreateContent() => new PopoverContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = new CommentReportButton(new Comment { User = new APIUser { Username = "Someone" } })
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Scale = new Vector2(2f),
|
||||
}.With(b => Schedule(b.ShowPopover)),
|
||||
};
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user