1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-12 00:27:25 +08:00
osu-lazer/osu.Game.Tests/Visual/Online/TestSceneWikiSidebar.cs
Gagah Pangeran Rosfatiputra 6c1fede18e
add wiki sidebar test scene
2021-06-04 13:11:37 +07:00

60 lines
1.7 KiB
C#

// 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 Markdig.Parsers;
using Markdig.Syntax;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Containers.Markdown;
using osu.Game.Overlays;
using osu.Game.Overlays.Wiki;
namespace osu.Game.Tests.Visual.Online
{
public class TestSceneWikiSidebar : OsuTestScene
{
[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Orange);
[Cached]
private readonly OverlayScrollContainer scrollContainer = new OverlayScrollContainer();
private WikiSidebar sidebar;
private readonly MarkdownHeading dummyHeading = new MarkdownHeading(new HeadingBlock(new HeadingBlockParser()));
[SetUp]
public void SetUp() => Schedule(() => Child = sidebar = new WikiSidebar());
[Test]
public void TestNoContent()
{
AddStep("No Content", () => { });
}
[Test]
public void TestOnlyMainTitle()
{
AddStep("Add TOC", () =>
{
for (var i = 0; i < 10; i++)
{
sidebar.AddToc($"This is a very long title {i + 1}", dummyHeading, 2);
}
});
}
[Test]
public void TestWithSubtitle()
{
AddStep("Add TOC", () =>
{
for (var i = 0; i < 20; i++)
{
sidebar.AddToc($"This is a very long title {i + 1}", dummyHeading, i % 4 == 0 ? 2 : 3);
}
});
}
}
}