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.
|
|
|
|
|
|
2019-05-17 09:29:43 +08:00
|
|
|
|
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;
|
2019-05-17 09:29:43 +08:00
|
|
|
|
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
|
|
|
|
{
|
2020-01-27 13:50:24 +08:00
|
|
|
|
private TestChangelogOverlay changelog;
|
2018-07-17 05:50:22 +08:00
|
|
|
|
|
2019-09-13 16:15:33 +08:00
|
|
|
|
protected override bool UseOnlineAPI => true;
|
2019-08-01 03:44:44 +08:00
|
|
|
|
|
2020-01-27 13:50:24 +08:00
|
|
|
|
[SetUp]
|
|
|
|
|
public void SetUp() => Schedule(() =>
|
2018-07-17 05:50:22 +08:00
|
|
|
|
{
|
2020-01-27 13:50:24 +08:00
|
|
|
|
Child = changelog = new TestChangelogOverlay();
|
|
|
|
|
});
|
2018-07-17 05:50:22 +08:00
|
|
|
|
|
2020-01-27 13:50:24 +08:00
|
|
|
|
[Test]
|
|
|
|
|
public void ShowWithNoFetch()
|
|
|
|
|
{
|
|
|
|
|
AddStep(@"Show", () => changelog.Show());
|
|
|
|
|
AddUntilStep(@"wait for streams", () => changelog.Streams?.Count > 0);
|
|
|
|
|
AddAssert(@"listing displayed", () => changelog.Current.Value == null);
|
|
|
|
|
AddAssert(@"no stream selected", () => changelog.Header.Streams.Current.Value == null);
|
|
|
|
|
}
|
2019-05-12 23:46:22 +08:00
|
|
|
|
|
2020-01-27 13:50:24 +08:00
|
|
|
|
[Test]
|
|
|
|
|
public void ShowWithListing()
|
|
|
|
|
{
|
|
|
|
|
AddStep(@"Show with listing", () => changelog.ShowListing());
|
|
|
|
|
AddUntilStep(@"wait for streams", () => changelog.Streams?.Count > 0);
|
|
|
|
|
AddAssert(@"listing displayed", () => changelog.Current.Value == null);
|
|
|
|
|
AddAssert(@"no stream selected", () => changelog.Header.Streams.Current.Value == null);
|
|
|
|
|
}
|
2019-05-12 23:46:22 +08:00
|
|
|
|
|
2020-01-27 13:50:24 +08:00
|
|
|
|
[Test]
|
|
|
|
|
public void ShowWithBuild()
|
|
|
|
|
{
|
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",
|
2020-01-27 13:50:24 +08:00
|
|
|
|
UpdateStream = new APIUpdateStream { Id = 7, 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
|
|
|
|
});
|
|
|
|
|
});
|
2019-05-12 23:46:22 +08:00
|
|
|
|
|
2020-01-27 13:50:24 +08:00
|
|
|
|
AddUntilStep(@"wait for streams", () => changelog.Streams?.Count > 0);
|
|
|
|
|
AddAssert(@"correct build displayed", () => changelog.Current.Value.Version == "2018.712.0");
|
|
|
|
|
AddAssert(@"correct stream selected", () => changelog.Header.Streams.Current.Value.Id == 7);
|
|
|
|
|
}
|
2019-09-21 03:35:26 +08:00
|
|
|
|
|
2020-01-27 13:50:24 +08:00
|
|
|
|
[Test]
|
|
|
|
|
public void TestHTMLUnescaping()
|
|
|
|
|
{
|
2019-09-21 03:35:26 +08:00
|
|
|
|
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 = """"This text should appear triple-quoted""" >_<",
|
|
|
|
|
GithubUser = new APIChangelogUser
|
|
|
|
|
{
|
|
|
|
|
DisplayName = "Dummy",
|
|
|
|
|
OsuUsername = "Dummy",
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
2018-07-17 05:50:22 +08:00
|
|
|
|
}
|
2020-01-27 13:50:24 +08:00
|
|
|
|
|
|
|
|
|
private class TestChangelogOverlay : ChangelogOverlay
|
|
|
|
|
{
|
|
|
|
|
public new List<APIUpdateStream> Streams => base.Streams;
|
|
|
|
|
|
|
|
|
|
public new ChangelogHeader Header => base.Header;
|
|
|
|
|
}
|
2018-07-17 05:50:22 +08:00
|
|
|
|
}
|
|
|
|
|
}
|