mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 15:23:14 +08:00
Fix test failures
This commit is contained in:
parent
5282c8b8c6
commit
4013c96ca5
@ -34,9 +34,9 @@ namespace osu.Game.Tests.Visual.Online
|
||||
[SetUpSteps]
|
||||
public void SetUp()
|
||||
{
|
||||
API.Login("test", "test");
|
||||
Schedule(() =>
|
||||
{
|
||||
API.Login("test", "test");
|
||||
if (dialogOverlay.Parent != null) Remove(dialogOverlay, false);
|
||||
Children = new Container<Drawable>[]
|
||||
{
|
||||
@ -55,11 +55,11 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
addTestComments();
|
||||
|
||||
AddAssert("First comment has button", () =>
|
||||
AddUntilStep("First comment has button", () =>
|
||||
{
|
||||
var comments = this.ChildrenOfType<DrawableComment>();
|
||||
var ourComment = comments.Single(x => x.Comment.Id == 1);
|
||||
return ourComment.ChildrenOfType<OsuSpriteText>().Any(x => x.Text == "Delete");
|
||||
var ourComment = comments.SingleOrDefault(x => x.Comment.Id == 1);
|
||||
return ourComment != null && ourComment.ChildrenOfType<OsuSpriteText>().Any(x => x.Text == "Delete");
|
||||
});
|
||||
|
||||
AddAssert("Second doesn't", () =>
|
||||
@ -73,14 +73,15 @@ namespace osu.Game.Tests.Visual.Online
|
||||
[Test]
|
||||
public void TestDeletion()
|
||||
{
|
||||
DrawableComment ourComment = null!;
|
||||
DrawableComment? ourComment = null;
|
||||
bool delete = false;
|
||||
|
||||
addTestComments();
|
||||
AddStep("Comment exists", () =>
|
||||
AddUntilStep("Comment exists", () =>
|
||||
{
|
||||
var comments = this.ChildrenOfType<DrawableComment>();
|
||||
ourComment = comments.Single(x => x.Comment.Id == 1);
|
||||
ourComment = comments.SingleOrDefault(x => x.Comment.Id == 1);
|
||||
return ourComment != null;
|
||||
});
|
||||
AddStep("It has delete button", () =>
|
||||
{
|
||||
|
@ -25,17 +25,27 @@ namespace osu.Game.Tests.Visual.Online
|
||||
[Cached]
|
||||
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple);
|
||||
|
||||
[Cached]
|
||||
private readonly DialogOverlay dialogOverlay = new DialogOverlay();
|
||||
|
||||
private DummyAPIAccess dummyAPI => (DummyAPIAccess)API;
|
||||
|
||||
private CommentsContainer commentsContainer;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp() => Schedule(() =>
|
||||
Child = new BasicScrollContainer
|
||||
{
|
||||
if (dialogOverlay.Parent != null) Remove(dialogOverlay, false);
|
||||
Children = new Drawable[]
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = commentsContainer = new CommentsContainer()
|
||||
});
|
||||
new BasicScrollContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = commentsContainer = new CommentsContainer()
|
||||
},
|
||||
dialogOverlay
|
||||
};
|
||||
});
|
||||
|
||||
[Test]
|
||||
public void TestIdleState()
|
||||
@ -139,7 +149,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
};
|
||||
});
|
||||
|
||||
private CommentBundle getExampleComments(bool withPinned = false)
|
||||
private static CommentBundle getExampleComments(bool withPinned = false)
|
||||
{
|
||||
var bundle = new CommentBundle
|
||||
{
|
||||
|
@ -20,11 +20,15 @@ namespace osu.Game.Tests.Visual.Online
|
||||
[Cached]
|
||||
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Purple);
|
||||
|
||||
[Cached]
|
||||
private readonly DialogOverlay dialogOverlay = new DialogOverlay();
|
||||
|
||||
private Container container;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp() => Schedule(() =>
|
||||
{
|
||||
if (dialogOverlay.Parent != null) Remove(dialogOverlay, false);
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
@ -37,6 +41,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
},
|
||||
dialogOverlay
|
||||
};
|
||||
});
|
||||
|
||||
|
@ -24,17 +24,22 @@ namespace osu.Game.Tests.Visual.Online
|
||||
[Cached]
|
||||
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
|
||||
|
||||
[Cached]
|
||||
private readonly DialogOverlay dialogOverlay = new DialogOverlay();
|
||||
|
||||
private TestCommentsContainer comments;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp() => Schedule(() =>
|
||||
{
|
||||
if (dialogOverlay.Parent != null) Remove(dialogOverlay, false);
|
||||
Clear();
|
||||
Add(new BasicScrollContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = comments = new TestCommentsContainer()
|
||||
});
|
||||
Add(dialogOverlay);
|
||||
});
|
||||
|
||||
[Test]
|
||||
|
Loading…
Reference in New Issue
Block a user