Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions osu.Android/OsuGameActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ public OsuGameActivity()
initialise();
}

protected OsuGameActivity(IntPtr handle, JniHandleOwnership transfer)
: base()
{
initialise();
}

[UnconditionalSuppressMessage("Trimming", "IL2026, IL2067, IL2070, IL2072, IL2075, IL2080, IL2106", Justification = "Preserved in Linker.xml")]
private void initialise()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public void TestNotifications()
};

AddStep("add room", () => API.Perform(new CreateRoomRequest(room)));
AddStep("set daily challenge info", () => metadataClient.DailyChallengeInfo.Value = new DailyChallengeInfo { RoomID = room.RoomID!.Value });
AddStep("set daily challenge info", () => metadataClient.DailyChallengeInfo.Value = new DailyChallengeInfo { RoomID = room.RoomID ?? 1 });

Screens.OnlinePlay.DailyChallenge.DailyChallenge screen = null!;
AddStep("push screen", () => LoadScreen(screen = new Screens.OnlinePlay.DailyChallenge.DailyChallenge(room)));
Expand Down Expand Up @@ -139,7 +139,7 @@ public void TestConclusionNotificationDoesNotFireOnDisconnect()
};

AddStep("add room", () => API.Perform(new CreateRoomRequest(room)));
AddStep("set daily challenge info", () => metadataClient.DailyChallengeInfo.Value = new DailyChallengeInfo { RoomID = room.RoomID!.Value });
AddStep("set daily challenge info", () => metadataClient.DailyChallengeInfo.Value = new DailyChallengeInfo { RoomID = room.RoomID ?? 1 });

Screens.OnlinePlay.DailyChallenge.DailyChallenge screen = null!;
AddStep("push screen", () => LoadScreen(screen = new Screens.OnlinePlay.DailyChallenge.DailyChallenge(room)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private void startChallenge()
Category = RoomCategory.DailyChallenge
}));
});
AddStep("signal client", () => metadataClient.DailyChallengeUpdated(new DailyChallengeInfo { RoomID = room.RoomID!.Value }));
AddStep("signal client", () => metadataClient.DailyChallengeUpdated(new DailyChallengeInfo { RoomID = room.RoomID ?? 1 }));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ public void TestChangeRulesetImmediatelyAfterLoadComplete()

AddStep("create song select", () =>
{
room.Playlist.Single().RulesetID = 2;
songSelect = new TestMultiplayerMatchSongSelect(room, room.Playlist.Single());
room.Playlist.First().RulesetID = 2;
songSelect = new TestMultiplayerMatchSongSelect(room, room.Playlist.First());
songSelect.OnLoadComplete += _ => Ruleset.Value = new TaikoRuleset().RulesetInfo;
LoadScreen(songSelect);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public void TestPlaylistItemSelectedOnCreate()
];
});

AddAssert("first playlist item selected", () => match.SelectedItem.Value == room.Playlist[0]);
AddUntilStep("first playlist item selected", () => room.Playlist.Count > 0 && match.SelectedItem.Value == room.Playlist[0]);
}

[Test]
Expand Down
17 changes: 14 additions & 3 deletions osu.Game.Tests/Visual/Playlists/TestScenePlaylistsRoomSubScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,26 @@ public void TestBeatmapAndRuleset_FollowSelection()
AddStep("load screen", () => LoadScreen(new TestPlaylistsScreen(screen = new TestPlaylistsRoomSubScreen(room))));
AddUntilStep("wait for load", () => screen.IsLoaded);

AddStep("select first item", () => screen.SelectedItem.Value = room.Playlist[0]);
AddUntilStep("select first item", () =>
{
if (room.Playlist.Count == 0) return false;

screen.SelectedItem.Value = room.Playlist[0];
return true;
});
AddUntilStep("first beatmap selected", () => Beatmap.Value.BeatmapInfo.Equals(importedSet.Beatmaps[0]));
AddUntilStep("osu ruleset selected", () => Ruleset.Value.Equals(new OsuRuleset().RulesetInfo));

AddStep("select second item", () => screen.SelectedItem.Value = room.Playlist[1]);
AddUntilStep("select second item", () =>
{
if (room.Playlist.Count < 2) return false;

screen.SelectedItem.Value = room.Playlist[1];
return true;
});
AddUntilStep("second beatmap selected", () => Beatmap.Value.BeatmapInfo.Equals(importedSet.Beatmaps[1]));
AddUntilStep("taiko ruleset selected", () => Ruleset.Value.Equals(new TaikoRuleset().RulesetInfo));
}

/// <summary>
/// Tests that the beatmap style is reset when the selected item is changed.
/// </summary>
Expand Down
10 changes: 7 additions & 3 deletions osu.Game.Tests/Visual/UserInterface/TestSceneDeleteLocalScore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,15 @@
// Ensure the context menu has finished showing
AddStep("finish transforms", () => leaderboard.FinishTransforms(true));

AddStep("click delete option", () =>
AddUntilStep("click delete option", () =>
{
InputManager.MoveMouseTo(leaderboard.ChildrenOfType<DrawableOsuMenuItem>()
.First(i => string.Equals(i.Item.Text.Value.ToString(), "delete", System.StringComparison.OrdinalIgnoreCase)));
var item = leaderboard.ChildrenOfType<DrawableOsuMenuItem>()
.FirstOrDefault(i => string.Equals(i.Item.Text.Value.ToString(), "delete", System.StringComparison.OrdinalIgnoreCase));
if (item == null) return false;

InputManager.MoveMouseTo(item);
InputManager.Click(MouseButton.Left);
return true;
});

// Ensure the dialog has finished showing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
{
this.room = room;

playlistItem = room.Playlist.Single();
playlistItem = room.Playlist.FirstOrDefault() ?? new PlaylistItem(new osu.Game.Beatmaps.BeatmapInfo());
Padding = new MarginPadding { Horizontal = -HORIZONTAL_OVERFLOW_PADDING };

beatmapAvailabilityTracker = new DailyChallengeBeatmapAvailabilityTracker(playlistItem);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
public DailyChallengeIntro(Room room)
{
this.room = room;
item = room.Playlist.Single();
item = room.Playlist.FirstOrDefault() ?? new PlaylistItem(new osu.Game.Beatmaps.BeatmapInfo());

ValidForResume = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ public NewDailyChallengeNotification(Room room)
private void load(OsuGame? game, SessionStatics statics)
{
Text = DailyChallengeStrings.ChallengeLiveNotification;
Content.Add(card = new BeatmapCardNano((APIBeatmapSet)room.Playlist.Single().Beatmap.BeatmapSet!));
var playlistItem = room.Playlist.FirstOrDefault();
if (playlistItem?.Beatmap.BeatmapSet is APIBeatmapSet beatmapSet)
Content.Add(card = new BeatmapCardNano(beatmapSet));
Activated = () =>
{
if (statics.Get<bool>(Static.DailyChallengeIntroPlayed))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@ public void PresentBeatmap(WorkingBeatmap beatmap, RulesetInfo ruleset)
return;

// If there's only one playlist item and we are the host / a referee, assume we want to change it. Else add a new one.
PlaylistItem? itemToEdit = (client.IsHost || client.IsReferee) && room.Playlist.Count == 1 ? room.Playlist.Single() : null;
PlaylistItem? itemToEdit = (client.IsHost || client.IsReferee) && room.Playlist.Count == 1 ? room.Playlist.First() : null;

ShowSongSelect(itemToEdit);

Expand Down
Loading