tidy up sidebar test

This commit is contained in:
Gagah Pangeran Rosfatiputra 2021-06-04 16:00:26 +07:00
parent 3bf70dea60
commit a82eeb6daf
No known key found for this signature in database
GPG Key ID: 25F6F17FD29031E2

View File

@ -6,7 +6,6 @@ using Markdig.Syntax;
using Markdig.Syntax.Inlines; using Markdig.Syntax.Inlines;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics.Containers.Markdown;
using osu.Game.Graphics.Containers.Markdown; using osu.Game.Graphics.Containers.Markdown;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Overlays.Wiki; using osu.Game.Overlays.Wiki;
@ -54,16 +53,13 @@ namespace osu.Game.Tests.Visual.Online
private void addTitle(string text, bool subtitle = false) private void addTitle(string text, bool subtitle = false)
{ {
var headingBlock = createHeadingBlock(text, subtitle ? 3 : 2); var headingBlock = new HeadingBlock(new HeadingBlockParser())
sidebar.AddToc(headingBlock, createHeading(headingBlock)); {
Inline = new ContainerInline().AppendChild(new LiteralInline(text)),
Level = subtitle ? 3 : 2,
};
var heading = new OsuMarkdownHeading(headingBlock);
sidebar.AddToc(headingBlock, heading);
} }
private HeadingBlock createHeadingBlock(string text, int level = 2) => new HeadingBlock(new HeadingBlockParser())
{
Inline = new ContainerInline().AppendChild(new LiteralInline(text)),
Level = level,
};
private MarkdownHeading createHeading(HeadingBlock headingBlock) => new OsuMarkdownHeading(headingBlock);
} }
} }