mirror of
https://github.com/ppy/osu
synced 2025-01-10 08:09:40 +00:00
Fix up tests
This commit is contained in:
parent
788ecc1e7b
commit
9f08b37792
@ -1,8 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Moq;
|
using Moq;
|
||||||
@ -36,15 +34,18 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
private readonly Bindable<BeatmapAvailability> beatmapAvailability = new Bindable<BeatmapAvailability>();
|
private readonly Bindable<BeatmapAvailability> beatmapAvailability = new Bindable<BeatmapAvailability>();
|
||||||
private readonly Bindable<Room> room = new Bindable<Room>();
|
private readonly Bindable<Room> room = new Bindable<Room>();
|
||||||
|
|
||||||
private MultiplayerRoom multiplayerRoom;
|
private MultiplayerRoom multiplayerRoom = null!;
|
||||||
private MultiplayerRoomUser localUser;
|
private MultiplayerRoomUser localUser = null!;
|
||||||
private OngoingOperationTracker ongoingOperationTracker;
|
private OngoingOperationTracker ongoingOperationTracker = null!;
|
||||||
|
|
||||||
private PopoverContainer content;
|
private PopoverContainer content = null!;
|
||||||
private MatchStartControl control;
|
private MatchStartControl control = null!;
|
||||||
|
|
||||||
private OsuButton readyButton => control.ChildrenOfType<OsuButton>().Single();
|
private OsuButton readyButton => control.ChildrenOfType<OsuButton>().Single();
|
||||||
|
|
||||||
|
[Cached(typeof(IBindable<PlaylistItem>))]
|
||||||
|
private readonly Bindable<PlaylistItem> currentItem = new Bindable<PlaylistItem>();
|
||||||
|
|
||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) =>
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) =>
|
||||||
new CachedModelDependencyContainer<Room>(base.CreateChildDependencies(parent)) { Model = { BindTarget = room } };
|
new CachedModelDependencyContainer<Room>(base.CreateChildDependencies(parent)) { Model = { BindTarget = room } };
|
||||||
|
|
||||||
@ -112,15 +113,15 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
|
|
||||||
beatmapAvailability.Value = BeatmapAvailability.LocallyAvailable();
|
beatmapAvailability.Value = BeatmapAvailability.LocallyAvailable();
|
||||||
|
|
||||||
var playlistItem = new PlaylistItem(Beatmap.Value.BeatmapInfo)
|
currentItem.Value = new PlaylistItem(Beatmap.Value.BeatmapInfo)
|
||||||
{
|
{
|
||||||
RulesetID = Beatmap.Value.BeatmapInfo.Ruleset.OnlineID
|
RulesetID = Beatmap.Value.BeatmapInfo.Ruleset.OnlineID
|
||||||
};
|
};
|
||||||
|
|
||||||
room.Value = new Room
|
room.Value = new Room
|
||||||
{
|
{
|
||||||
Playlist = { playlistItem },
|
Playlist = { currentItem.Value },
|
||||||
CurrentPlaylistItem = { Value = playlistItem }
|
CurrentPlaylistItem = { BindTarget = currentItem }
|
||||||
};
|
};
|
||||||
|
|
||||||
localUser = new MultiplayerRoomUser(API.LocalUser.Value.Id) { User = API.LocalUser.Value };
|
localUser = new MultiplayerRoomUser(API.LocalUser.Value.Id) { User = API.LocalUser.Value };
|
||||||
@ -129,7 +130,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
{
|
{
|
||||||
Playlist =
|
Playlist =
|
||||||
{
|
{
|
||||||
TestMultiplayerClient.CreateMultiplayerPlaylistItem(playlistItem),
|
TestMultiplayerClient.CreateMultiplayerPlaylistItem(currentItem.Value),
|
||||||
},
|
},
|
||||||
Users = { localUser },
|
Users = { localUser },
|
||||||
Host = localUser,
|
Host = localUser,
|
||||||
|
@ -1,15 +1,21 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
|
using osu.Game.Online.Rooms;
|
||||||
using osu.Game.Screens.OnlinePlay.Multiplayer.Match;
|
using osu.Game.Screens.OnlinePlay.Multiplayer.Match;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Multiplayer
|
namespace osu.Game.Tests.Visual.Multiplayer
|
||||||
{
|
{
|
||||||
public partial class TestSceneMultiplayerMatchFooter : MultiplayerTestScene
|
public partial class TestSceneMultiplayerMatchFooter : MultiplayerTestScene
|
||||||
{
|
{
|
||||||
|
[Cached(typeof(IBindable<PlaylistItem>))]
|
||||||
|
private readonly Bindable<PlaylistItem> currentItem = new Bindable<PlaylistItem>();
|
||||||
|
|
||||||
public override void SetUpSteps()
|
public override void SetUpSteps()
|
||||||
{
|
{
|
||||||
base.SetUpSteps();
|
base.SetUpSteps();
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using System;
|
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.Audio;
|
using osu.Framework.Audio;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
@ -29,10 +28,13 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
{
|
{
|
||||||
public partial class TestSceneMultiplayerPlaylist : MultiplayerTestScene
|
public partial class TestSceneMultiplayerPlaylist : MultiplayerTestScene
|
||||||
{
|
{
|
||||||
private MultiplayerPlaylist list;
|
[Cached(typeof(IBindable<PlaylistItem>))]
|
||||||
private BeatmapManager beatmaps;
|
private readonly Bindable<PlaylistItem> currentItem = new Bindable<PlaylistItem>();
|
||||||
private BeatmapSetInfo importedSet;
|
|
||||||
private BeatmapInfo importedBeatmap;
|
private MultiplayerPlaylist list = null!;
|
||||||
|
private BeatmapManager beatmaps = null!;
|
||||||
|
private BeatmapSetInfo importedSet = null!;
|
||||||
|
private BeatmapInfo importedBeatmap = null!;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(GameHost host, AudioManager audio)
|
private void load(GameHost host, AudioManager audio)
|
||||||
@ -198,7 +200,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
addItemStep();
|
addItemStep();
|
||||||
addItemStep();
|
addItemStep();
|
||||||
|
|
||||||
DrawableRoomPlaylistItem[] drawableItems = null;
|
DrawableRoomPlaylistItem[] drawableItems = null!;
|
||||||
AddStep("get drawable items", () => drawableItems = this.ChildrenOfType<DrawableRoomPlaylistItem>().ToArray());
|
AddStep("get drawable items", () => drawableItems = this.ChildrenOfType<DrawableRoomPlaylistItem>().ToArray());
|
||||||
|
|
||||||
// Add 1 item for another user.
|
// Add 1 item for another user.
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
@ -28,13 +26,14 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
{
|
{
|
||||||
public partial class TestSceneMultiplayerSpectateButton : MultiplayerTestScene
|
public partial class TestSceneMultiplayerSpectateButton : MultiplayerTestScene
|
||||||
{
|
{
|
||||||
private MultiplayerSpectateButton spectateButton;
|
[Cached(typeof(IBindable<PlaylistItem>))]
|
||||||
private MatchStartControl startControl;
|
private readonly Bindable<PlaylistItem> currentItem = new Bindable<PlaylistItem>();
|
||||||
|
|
||||||
private readonly Bindable<PlaylistItem> selectedItem = new Bindable<PlaylistItem>();
|
private MultiplayerSpectateButton spectateButton = null!;
|
||||||
|
private MatchStartControl startControl = null!;
|
||||||
|
|
||||||
private BeatmapSetInfo importedSet;
|
private BeatmapSetInfo importedSet = null!;
|
||||||
private BeatmapManager beatmaps;
|
private BeatmapManager beatmaps = null!;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(GameHost host, AudioManager audio)
|
private void load(GameHost host, AudioManager audio)
|
||||||
@ -52,14 +51,12 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
|
|
||||||
AddStep("create button", () =>
|
AddStep("create button", () =>
|
||||||
{
|
{
|
||||||
AvailabilityTracker.SelectedItem.BindTo(selectedItem);
|
AvailabilityTracker.SelectedItem.BindTo(currentItem);
|
||||||
|
|
||||||
importedSet = beatmaps.GetAllUsableBeatmapSets().First();
|
importedSet = beatmaps.GetAllUsableBeatmapSets().First();
|
||||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First());
|
Beatmap.Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First());
|
||||||
selectedItem.Value = new PlaylistItem(Beatmap.Value.BeatmapInfo)
|
|
||||||
{
|
currentItem.Value = SelectedRoom.Value.Playlist.First();
|
||||||
RulesetID = Beatmap.Value.BeatmapInfo.Ruleset.OnlineID,
|
|
||||||
};
|
|
||||||
|
|
||||||
Child = new PopoverContainer
|
Child = new PopoverContainer
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user