mirror of https://github.com/ppy/osu
Add failing test
This commit is contained in:
parent
616c2aeefc
commit
9d1eb842a7
|
@ -82,5 +82,36 @@ public void TestNotifications()
|
||||||
AddUntilStep("wait for screen", () => screen.IsCurrentScreen());
|
AddUntilStep("wait for screen", () => screen.IsCurrentScreen());
|
||||||
AddStep("daily challenge ended", () => metadataClient.DailyChallengeInfo.Value = null);
|
AddStep("daily challenge ended", () => metadataClient.DailyChallengeInfo.Value = null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestConclusionNotificationDoesNotFireOnDisconnect()
|
||||||
|
{
|
||||||
|
var room = new Room
|
||||||
|
{
|
||||||
|
RoomID = { Value = 1234 },
|
||||||
|
Name = { Value = "Daily Challenge: June 4, 2024" },
|
||||||
|
Playlist =
|
||||||
|
{
|
||||||
|
new PlaylistItem(TestResources.CreateTestBeatmapSetInfo().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("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("disconnect from metadata server", () => metadataClient.Disconnect());
|
||||||
|
AddUntilStep("wait for disconnection", () => metadataClient.DailyChallengeInfo.Value, () => Is.Null);
|
||||||
|
AddAssert("no notification posted", () => notificationOverlay.AllNotifications, () => Is.Empty);
|
||||||
|
AddStep("reconnect to metadata server", () => metadataClient.Reconnect());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,8 @@ namespace osu.Game.Tests.Visual.Metadata
|
||||||
{
|
{
|
||||||
public partial class TestMetadataClient : MetadataClient
|
public partial class TestMetadataClient : MetadataClient
|
||||||
{
|
{
|
||||||
public override IBindable<bool> IsConnected => new BindableBool(true);
|
public override IBindable<bool> IsConnected => isConnected;
|
||||||
|
private readonly BindableBool isConnected = new BindableBool(true);
|
||||||
|
|
||||||
public override IBindable<bool> IsWatchingUserPresence => isWatchingUserPresence;
|
public override IBindable<bool> IsWatchingUserPresence => isWatchingUserPresence;
|
||||||
private readonly BindableBool isWatchingUserPresence = new BindableBool();
|
private readonly BindableBool isWatchingUserPresence = new BindableBool();
|
||||||
|
@ -98,5 +99,16 @@ public override Task<MultiplayerPlaylistItemStats[]> BeginWatchingMultiplayerRoo
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Task EndWatchingMultiplayerRoom(long id) => Task.CompletedTask;
|
public override Task EndWatchingMultiplayerRoom(long id) => Task.CompletedTask;
|
||||||
|
|
||||||
|
public void Disconnect()
|
||||||
|
{
|
||||||
|
isConnected.Value = false;
|
||||||
|
dailyChallengeInfo.Value = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Reconnect()
|
||||||
|
{
|
||||||
|
isConnected.Value = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue