mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 22:33:05 +08:00
Fix tests
This commit is contained in:
parent
e146c8e230
commit
041c70e4eb
@ -48,6 +48,7 @@ namespace osu.Game.Tests.Visual.Menus
|
||||
{
|
||||
new PlaylistItem(beatmap)
|
||||
},
|
||||
StartDate = { Value = DateTimeOffset.Now.AddMinutes(-30) },
|
||||
EndDate = { Value = DateTimeOffset.Now.AddSeconds(60) }
|
||||
});
|
||||
return true;
|
||||
|
@ -58,6 +58,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
new PlaylistItem(beatmap)
|
||||
},
|
||||
StartDate = { Value = DateTimeOffset.Now.AddMinutes(-5) },
|
||||
EndDate = { Value = DateTimeOffset.Now.AddSeconds(30) }
|
||||
});
|
||||
return true;
|
||||
@ -95,8 +96,13 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
},
|
||||
};
|
||||
});
|
||||
AddAssert("no notification posted", () => notificationOverlay.AllNotifications.Count(), () => Is.Zero);
|
||||
AddAssert("notification posted", () => notificationOverlay.AllNotifications.Count(), () => Is.EqualTo(1));
|
||||
|
||||
AddStep("clear notifications", () =>
|
||||
{
|
||||
foreach (var notification in notificationOverlay.AllNotifications)
|
||||
notification.Close(runFlingAnimation: false);
|
||||
});
|
||||
AddStep("beatmap of the day not active", () => metadataClient.DailyChallengeUpdated(null));
|
||||
AddAssert("no notification posted", () => notificationOverlay.AllNotifications.Count(), () => Is.Zero);
|
||||
|
||||
@ -105,7 +111,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
RoomID = 1234,
|
||||
}));
|
||||
AddAssert("notification posted", () => notificationOverlay.AllNotifications.Count(), () => Is.EqualTo(1));
|
||||
AddAssert("no notification posted", () => notificationOverlay.AllNotifications.Count(), () => Is.Zero);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -154,7 +154,9 @@ namespace osu.Game.Screens.Menu
|
||||
cover.OnlineInfo = TooltipContent = room.Playlist.FirstOrDefault()?.Beatmap.BeatmapSet as APIBeatmapSet;
|
||||
|
||||
// We only want to notify the user if a new challenge recently went live.
|
||||
if (Math.Abs((DateTimeOffset.Now - room.StartDate.Value!.Value).TotalSeconds) < 600 && room.RoomID.Value != lastNotifiedDailyChallengeRoomId)
|
||||
if (room.StartDate.Value != null
|
||||
&& Math.Abs((DateTimeOffset.Now - room.StartDate.Value!.Value).TotalSeconds) < 600
|
||||
&& room.RoomID.Value != lastNotifiedDailyChallengeRoomId)
|
||||
{
|
||||
lastNotifiedDailyChallengeRoomId = room.RoomID.Value;
|
||||
notificationOverlay?.Post(new NewDailyChallengeNotification(room));
|
||||
|
Loading…
Reference in New Issue
Block a user