Skip to content

Commit

Permalink
Simplify DailyChallengeIntro test scene
Browse files Browse the repository at this point in the history
Seems like some bad copy-paste in the past. Most of this is already
being done in `TestSceneDailyChallenge`.
  • Loading branch information
peppy committed Aug 22, 2024
1 parent 922814f commit 105daeb
Showing 1 changed file with 8 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Screens;
using osu.Framework.Testing;
using osu.Game.Online.API;
using osu.Game.Online.Metadata;
using osu.Game.Online.Rooms;
using osu.Game.Overlays;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Tests.Resources;
using osu.Game.Screens.OnlinePlay.DailyChallenge;
using osu.Game.Tests.Visual.Metadata;
using osu.Game.Tests.Visual.OnlinePlay;
using CreateRoomRequest = osu.Game.Online.Rooms.CreateRoomRequest;
Expand All @@ -27,6 +25,8 @@ public partial class TestSceneDailyChallengeIntro : OnlinePlayTestScene
[Cached(typeof(INotificationOverlay))]
private NotificationOverlay notificationOverlay = new NotificationOverlay();

private Room room = null!;

[BackgroundDependencyLoader]
private void load()
{
Expand All @@ -35,39 +35,21 @@ private void load()
}

[Test]
[Solo]
public void TestDailyChallenge()
{
var room = new 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)));
startChallenge();
AddStep("push screen", () => LoadScreen(new DailyChallengeIntro(room)));
}

[Test]
public void TestNotifications()
private void startChallenge()
{
var room = new Room
room = new Room
{
RoomID = { Value = 1234 },
Name = { Value = "Daily Challenge: June 4, 2024" },
Playlist =
{
new PlaylistItem(TestResources.CreateTestBeatmapSetInfo().Beatmaps.First())
new PlaylistItem(CreateAPIBeatmapSet().Beatmaps.First())
{
RequiredMods = [new APIMod(new OsuModTraceable())],
AllowedMods = [new APIMod(new OsuModDoubleTime())]
Expand All @@ -78,12 +60,6 @@ public void TestNotifications()
};

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);
}
}
}

0 comments on commit 105daeb

Please sign in to comment.