1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-21 15:53:00 +08:00
osu-lazer/osu.Game.Tests/Visual/Online/TestSceneChangelogOverlay.cs

102 lines
3.4 KiB
C#
Raw Normal View History

2019-05-12 23:36:05 +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.
using System;
using System.Collections.Generic;
2018-07-17 05:50:22 +08:00
using NUnit.Framework;
2018-07-25 20:31:41 +08:00
using osu.Game.Online.API.Requests.Responses;
2018-07-17 05:50:22 +08:00
using osu.Game.Overlays;
using osu.Game.Overlays.Changelog;
2018-07-17 05:50:22 +08:00
2019-05-15 17:30:02 +08:00
namespace osu.Game.Tests.Visual.Online
2018-07-17 05:50:22 +08:00
{
[TestFixture]
2019-05-15 17:30:02 +08:00
public class TestSceneChangelogOverlay : OsuTestScene
2018-07-17 05:50:22 +08:00
{
private ChangelogOverlay changelog;
public override IReadOnlyList<Type> RequiredTypes => new[]
{
2019-05-22 18:51:16 +08:00
typeof(UpdateStreamBadgeArea),
typeof(UpdateStreamBadge),
typeof(ChangelogHeader),
typeof(ChangelogContent),
typeof(ChangelogListing),
typeof(ChangelogSingleBuild),
typeof(ChangelogBuild),
typeof(Comments),
};
protected override bool UseOnlineAPI => true;
2019-08-01 03:44:44 +08:00
2018-07-17 05:50:22 +08:00
protected override void LoadComplete()
{
base.LoadComplete();
Add(changelog = new ChangelogOverlay());
2018-07-23 03:00:29 +08:00
AddStep(@"Show", changelog.Show);
2018-07-25 20:31:41 +08:00
AddStep(@"Hide", changelog.Hide);
AddWaitStep("wait for hide", 3);
2018-07-25 20:31:41 +08:00
AddStep(@"Show with Lazer 2018.712.0", () =>
{
2019-05-15 17:08:19 +08:00
changelog.ShowBuild(new APIChangelogBuild
2018-07-25 20:31:41 +08:00
{
Version = "2018.712.0",
2019-05-21 13:46:12 +08:00
DisplayVersion = "2018.712.0",
2019-06-03 12:16:05 +08:00
UpdateStream = new APIUpdateStream { Name = OsuGameBase.CLIENT_STREAM_NAME },
2019-05-22 12:28:41 +08:00
ChangelogEntries = new List<APIChangelogEntry>
2019-05-21 13:46:12 +08:00
{
new APIChangelogEntry
{
Category = "Test",
Title = "Title",
MessageHtml = "Message",
}
}
2018-07-25 20:31:41 +08:00
});
changelog.Show();
});
AddWaitStep("wait for show", 3);
2018-07-25 20:31:41 +08:00
AddStep(@"Hide", changelog.Hide);
AddWaitStep("wait for hide", 3);
2018-07-25 20:31:41 +08:00
AddStep(@"Show with listing", () =>
{
changelog.ShowListing();
changelog.Show();
});
AddStep(@"Ensure HTML string unescaping", () =>
{
changelog.ShowBuild(new APIChangelogBuild
{
Version = "2019.920.0",
DisplayVersion = "2019.920.0",
UpdateStream = new APIUpdateStream
{
Name = "Test",
DisplayName = "Test"
},
ChangelogEntries = new List<APIChangelogEntry>
{
new APIChangelogEntry
{
Category = "Testing HTML strings unescaping",
Title = "Ensuring HTML strings are being unescaped",
MessageHtml = "&quot;&quot;&quot;This text should appear triple-quoted&quot;&quot;&quot; &gt;_&lt;",
GithubUser = new APIChangelogUser
{
DisplayName = "Dummy",
OsuUsername = "Dummy",
}
},
}
});
});
2018-07-17 05:50:22 +08:00
}
}
}