1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-16 14:17:27 +08:00
osu-lazer/osu.Game.Tests/Visual/Online/TestSceneBeatmapAvailability.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

85 lines
2.4 KiB
C#
Raw Normal View History

2019-06-11 19:58:46 +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-06-19 22:55:36 +08:00
using NUnit.Framework;
2019-06-11 19:58:46 +08:00
using osu.Game.Beatmaps;
using osu.Game.Online.API.Requests.Responses;
2019-06-11 19:58:46 +08:00
using osu.Game.Overlays.BeatmapSet;
namespace osu.Game.Tests.Visual.Online
{
2019-06-19 22:55:36 +08:00
[TestFixture]
2019-06-27 10:40:22 +08:00
public partial class TestSceneBeatmapAvailability : OsuTestScene
2019-06-11 19:58:46 +08:00
{
2019-06-27 10:40:22 +08:00
private readonly BeatmapAvailability container;
2019-06-19 22:55:36 +08:00
2019-06-27 10:40:22 +08:00
public TestSceneBeatmapAvailability()
2019-06-11 19:58:46 +08:00
{
2019-06-27 10:40:22 +08:00
Add(container = new BeatmapAvailability());
2019-06-19 22:55:36 +08:00
}
2019-06-11 19:58:46 +08:00
2019-06-19 22:55:36 +08:00
[Test]
public void TestUndownloadableWithLink()
{
AddStep("set undownloadable beatmapset with link", () => container.BeatmapSet = new APIBeatmapSet
2019-06-19 22:55:36 +08:00
{
Availability = new BeatmapSetOnlineAvailability
2019-06-19 22:55:36 +08:00
{
DownloadDisabled = true,
ExternalLink = @"https://osu.ppy.sh",
2019-06-19 22:55:36 +08:00
},
});
2021-12-10 13:04:31 +08:00
visibilityAssert(true);
2019-06-19 22:55:36 +08:00
}
2019-06-11 19:58:46 +08:00
2019-06-19 22:55:36 +08:00
[Test]
public void TestUndownloadableNoLink()
{
AddStep("set undownloadable beatmapset without link", () => container.BeatmapSet = new APIBeatmapSet
2019-06-11 19:58:46 +08:00
{
Availability = new BeatmapSetOnlineAvailability
2019-06-11 19:58:46 +08:00
{
DownloadDisabled = true,
2019-06-11 19:58:46 +08:00
},
});
2021-12-10 13:04:31 +08:00
visibilityAssert(true);
2019-06-19 22:55:36 +08:00
}
[Test]
public void TestPartsRemovedWithLink()
{
AddStep("set parts-removed beatmapset with link", () => container.BeatmapSet = new APIBeatmapSet
2019-06-11 19:58:46 +08:00
{
Availability = new BeatmapSetOnlineAvailability
2019-06-11 19:58:46 +08:00
{
DownloadDisabled = false,
ExternalLink = @"https://osu.ppy.sh",
2019-06-11 19:58:46 +08:00
},
});
2021-12-10 13:04:31 +08:00
visibilityAssert(true);
2019-06-19 22:55:36 +08:00
}
[Test]
public void TestNormal()
{
AddStep("set normal beatmapset", () => container.BeatmapSet = new APIBeatmapSet
2019-06-11 19:58:46 +08:00
{
Availability = new BeatmapSetOnlineAvailability
2019-06-19 22:55:36 +08:00
{
DownloadDisabled = false,
2019-06-19 22:55:36 +08:00
},
2019-06-11 19:58:46 +08:00
});
2021-12-10 13:04:31 +08:00
visibilityAssert(false);
2019-06-19 22:55:36 +08:00
}
2021-12-10 13:04:31 +08:00
private void visibilityAssert(bool shown)
2019-06-19 22:55:36 +08:00
{
AddAssert($"is container {(shown ? "visible" : "hidden")}", () => container.Alpha == (shown ? 1 : 0));
2019-06-11 19:58:46 +08:00
}
}
}