mirror of
https://github.com/ppy/osu.git
synced 2026-05-31 13:51:03 +08:00
Rewrite test to contain asserts
This commit is contained in:
@@ -1,10 +1,14 @@
|
||||
// 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 System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers.Markdown;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Graphics.Containers.Markdown;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Online
|
||||
@@ -17,31 +21,23 @@ namespace osu.Game.Tests.Visual.Online
|
||||
[Test]
|
||||
public void TestExternalImageLink()
|
||||
{
|
||||
AddStep("load image", () => Child = new OsuMarkdownContainer
|
||||
MarkdownContainer markdown = null!;
|
||||
|
||||
// use base MarkdownContainer as a method of directly attempting to load an image without proxying logic.
|
||||
AddStep("load external without proxying", () => Child = markdown = new MarkdownContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Text = "",
|
||||
});
|
||||
}
|
||||
AddWaitStep("wait", 5);
|
||||
AddAssert("image not loaded", () => markdown.ChildrenOfType<Sprite>().Single().Texture == null);
|
||||
|
||||
[Test]
|
||||
public void TestLocalImageLink()
|
||||
{
|
||||
AddStep("load image", () => Child = new OsuMarkdownContainer
|
||||
AddStep("load external with proxying", () => Child = markdown = new OsuMarkdownContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Text = "",
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestInvalidImageLink()
|
||||
{
|
||||
AddStep("load image", () => Child = new OsuMarkdownContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Text = "",
|
||||
Text = "",
|
||||
});
|
||||
AddUntilStep("image loaded", () => markdown.ChildrenOfType<Sprite>().SingleOrDefault()?.Texture != null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user