1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-30 08:33:20 +08:00
osu-lazer/osu.Game.Tests/Visual/Online/TestSceneNewsCard.cs

56 lines
2.2 KiB
C#
Raw Normal View History

2020-07-06 12:27:53 +08:00
// 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.
2022-06-17 15:37:17 +08:00
#nullable disable
2020-07-06 12:27:53 +08:00
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics;
using osu.Game.Overlays.News;
using osu.Game.Online.API.Requests.Responses;
using osu.Framework.Allocation;
using osu.Game.Overlays;
using osuTK;
using System;
namespace osu.Game.Tests.Visual.Online
{
public class TestSceneNewsCard : OsuTestScene
{
[Cached]
private readonly OverlayColourProvider overlayColour = new OverlayColourProvider(OverlayColourScheme.Purple);
public TestSceneNewsCard()
{
Add(new FillFlowContainer<NewsCard>
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Direction = FillDirection.Vertical,
Width = 500,
AutoSizeAxes = Axes.Y,
Spacing = new Vector2(0, 20),
Children = new[]
{
2020-07-06 12:28:44 +08:00
new NewsCard(new APINewsPost
2020-07-06 12:27:53 +08:00
{
2020-07-16 20:18:01 +08:00
Title = "This post has an image which starts with \"/\" and has many authors! (clickable)",
2020-07-06 12:27:53 +08:00
Preview = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
Author = "someone, someone1, someone2, someone3, someone4",
FirstImage = "/help/wiki/shared/news/banners/monthly-beatmapping-contest.png",
2020-07-16 20:18:01 +08:00
PublishedAt = DateTimeOffset.Now,
Slug = "2020-07-16-summer-theme-park-2020-voting-open"
2020-07-06 12:27:53 +08:00
}),
2020-07-06 12:28:44 +08:00
new NewsCard(new APINewsPost
2020-07-06 12:27:53 +08:00
{
2020-07-16 20:18:01 +08:00
Title = "This post has a full-url image! (HTML entity: &amp;) (non-clickable)",
Preview = "boom (HTML entity: &amp;)",
Author = "user (HTML entity: &amp;)",
2020-07-06 12:27:53 +08:00
FirstImage = "https://assets.ppy.sh/artists/88/header.jpg",
2020-07-07 04:55:20 +08:00
PublishedAt = DateTimeOffset.Now
2020-07-06 12:27:53 +08:00
})
}
});
}
}
}