1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 16:02:55 +08:00

Simplify DailyChallengeIntro test scene

Seems like some bad copy-paste in the past. Most of this is already
being done in `TestSceneDailyChallenge`.
This commit is contained in:
Dean Herbert 2024-08-22 15:11:23 +09:00
parent 922814fab3
commit 236a273e09
No known key found for this signature in database

View File

@ -5,13 +5,12 @@ using System;
using System.Linq; using System.Linq;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Screens;
using osu.Framework.Testing;
using osu.Game.Online.API; using osu.Game.Online.API;
using osu.Game.Online.Metadata; using osu.Game.Online.Metadata;
using osu.Game.Online.Rooms; using osu.Game.Online.Rooms;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Rulesets.Osu.Mods; using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Screens.OnlinePlay.DailyChallenge;
using osu.Game.Tests.Resources; using osu.Game.Tests.Resources;
using osu.Game.Tests.Visual.Metadata; using osu.Game.Tests.Visual.Metadata;
using osu.Game.Tests.Visual.OnlinePlay; using osu.Game.Tests.Visual.OnlinePlay;
@ -27,6 +26,8 @@ namespace osu.Game.Tests.Visual.DailyChallenge
[Cached(typeof(INotificationOverlay))] [Cached(typeof(INotificationOverlay))]
private NotificationOverlay notificationOverlay = new NotificationOverlay(); private NotificationOverlay notificationOverlay = new NotificationOverlay();
private Room room = null!;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
@ -35,33 +36,15 @@ namespace osu.Game.Tests.Visual.DailyChallenge
} }
[Test] [Test]
[Solo]
public void TestDailyChallenge() public void TestDailyChallenge()
{ {
var room = new Room startChallenge();
{ AddStep("push screen", () => LoadScreen(new DailyChallengeIntro(room)));
RoomID = { Value = 1234 },
Name = { Value = "Daily Challenge: June 4, 2024" },
Playlist =
{
new PlaylistItem(CreateAPIBeatmapSet().Beatmaps.First())
{
RequiredMods = [new APIMod(new OsuModTraceable())],
AllowedMods = [new APIMod(new OsuModDoubleTime())]
}
},
EndDate = { Value = DateTimeOffset.Now.AddHours(12) },
Category = { Value = RoomCategory.DailyChallenge }
};
AddStep("add room", () => API.Perform(new CreateRoomRequest(room)));
AddStep("push screen", () => LoadScreen(new Screens.OnlinePlay.DailyChallenge.DailyChallengeIntro(room)));
} }
[Test] private void startChallenge()
public void TestNotifications()
{ {
var room = new Room room = new Room
{ {
RoomID = { Value = 1234 }, RoomID = { Value = 1234 },
Name = { Value = "Daily Challenge: June 4, 2024" }, Name = { Value = "Daily Challenge: June 4, 2024" },
@ -78,12 +61,6 @@ namespace osu.Game.Tests.Visual.DailyChallenge
}; };
AddStep("add room", () => API.Perform(new CreateRoomRequest(room))); AddStep("add room", () => API.Perform(new CreateRoomRequest(room)));
AddStep("set daily challenge info", () => metadataClient.DailyChallengeInfo.Value = new DailyChallengeInfo { RoomID = 1234 });
Screens.OnlinePlay.DailyChallenge.DailyChallenge screen = null!;
AddStep("push screen", () => LoadScreen(screen = new Screens.OnlinePlay.DailyChallenge.DailyChallenge(room)));
AddUntilStep("wait for screen", () => screen.IsCurrentScreen());
AddStep("daily challenge ended", () => metadataClient.DailyChallengeInfo.Value = null);
} }
} }
} }