mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 22:12:53 +08:00
Add test scene using OsuOnlineStore
to test lookups
This commit is contained in:
parent
2417d4de83
commit
2a7133d6d3
63
osu.Game.Tests/Visual/Online/TestSceneMediaProxying.cs
Normal file
63
osu.Game.Tests/Visual/Online/TestSceneMediaProxying.cs
Normal file
@ -0,0 +1,63 @@
|
||||
// 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;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Graphics.Containers.Markdown;
|
||||
using osu.Game.Online;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
public partial class TestSceneMediaProxying : OsuTestScene
|
||||
{
|
||||
[Resolved]
|
||||
private GameHost host { get; set; } = null!;
|
||||
|
||||
[Test]
|
||||
public void TestExternalImageLink()
|
||||
{
|
||||
AddStep("load image", () => setup(new OsuMarkdownContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Text = "",
|
||||
}));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestLocalImageLink()
|
||||
{
|
||||
AddStep("load image", () => setup(new OsuMarkdownContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Text = "",
|
||||
}));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestInvalidImageLink()
|
||||
{
|
||||
AddStep("load image", () => setup(new OsuMarkdownContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Text = "",
|
||||
}));
|
||||
}
|
||||
|
||||
private void setup(Drawable drawable)
|
||||
{
|
||||
var onlineStore = new OsuOnlineStore(@"https://osu.ppy.sh");
|
||||
var textureStore = new TextureStore(host.Renderer, host.CreateTextureLoaderStore(onlineStore));
|
||||
|
||||
Child = new DependencyProvidingContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
CachedDependencies = new (Type, object)[] { (typeof(TextureStore), textureStore) },
|
||||
Child = drawable,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user