mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Fix potential test failures due to Setup/SetUpSteps ordering
This commit is contained in:
@ -19,8 +19,11 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
private DrawableRoomParticipantsList list;
|
||||
|
||||
[SetUp]
|
||||
public new void Setup() => Schedule(() =>
|
||||
public override void SetUpSteps()
|
||||
{
|
||||
base.SetUpSteps();
|
||||
|
||||
AddStep("create list", () =>
|
||||
{
|
||||
SelectedRoom.Value = new Room
|
||||
{
|
||||
@ -42,6 +45,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
NumberOfCircles = 4
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCircleCountNearLimit()
|
||||
|
@ -25,8 +25,11 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
private RoomsContainer container;
|
||||
|
||||
[SetUp]
|
||||
public new void Setup() => Schedule(() =>
|
||||
public override void SetUpSteps()
|
||||
{
|
||||
base.SetUpSteps();
|
||||
|
||||
AddStep("create container", () =>
|
||||
{
|
||||
Child = new PopoverContainer
|
||||
{
|
||||
@ -42,6 +45,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestBasicListChanges()
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.Rooms;
|
||||
@ -18,8 +17,11 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
public class TestSceneMatchBeatmapDetailArea : OnlinePlayTestScene
|
||||
{
|
||||
[SetUp]
|
||||
public new void Setup() => Schedule(() =>
|
||||
public override void SetUpSteps()
|
||||
{
|
||||
base.SetUpSteps();
|
||||
|
||||
AddStep("create area", () =>
|
||||
{
|
||||
SelectedRoom.Value = new Room();
|
||||
|
||||
@ -31,6 +33,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
CreateNewItem = createNewItem
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
private void createNewItem()
|
||||
{
|
||||
|
@ -4,8 +4,6 @@
|
||||
#nullable disable
|
||||
|
||||
using System.Collections.Generic;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
@ -19,8 +17,11 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
public class TestSceneMatchLeaderboard : OnlinePlayTestScene
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
public override void SetUpSteps()
|
||||
{
|
||||
base.SetUpSteps();
|
||||
|
||||
AddStep("setup API", () =>
|
||||
{
|
||||
((DummyAPIAccess)API).HandleRequest = r =>
|
||||
{
|
||||
@ -58,10 +59,9 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
return false;
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
[SetUp]
|
||||
public new void Setup() => Schedule(() =>
|
||||
AddStep("create leaderboard", () =>
|
||||
{
|
||||
SelectedRoom.Value = new Room { RoomID = { Value = 3 } };
|
||||
|
||||
@ -74,4 +74,5 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,8 +22,10 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
private MultiSpectatorLeaderboard leaderboard;
|
||||
|
||||
[SetUpSteps]
|
||||
public new void SetUpSteps()
|
||||
public override void SetUpSteps()
|
||||
{
|
||||
base.SetUpSteps();
|
||||
|
||||
AddStep("reset", () =>
|
||||
{
|
||||
leaderboard?.RemoveAndDisposeImmediately();
|
||||
|
@ -56,8 +56,12 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
importedBeatmapId = importedBeatmap.OnlineID;
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public new void Setup() => Schedule(() => playingUsers.Clear());
|
||||
public override void SetUpSteps()
|
||||
{
|
||||
base.SetUpSteps();
|
||||
|
||||
AddStep("clear playing users", () => playingUsers.Clear());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDelayedStart()
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
@ -13,8 +12,11 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
public class TestSceneMultiplayerMatchFooter : MultiplayerTestScene
|
||||
{
|
||||
[SetUp]
|
||||
public new void Setup() => Schedule(() =>
|
||||
public override void SetUpSteps()
|
||||
{
|
||||
base.SetUpSteps();
|
||||
|
||||
AddStep("create footer", () =>
|
||||
{
|
||||
Child = new PopoverContainer
|
||||
{
|
||||
@ -32,4 +34,5 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -59,16 +59,15 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
importedSet = beatmaps.GetAllUsableBeatmapSets().First();
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public new void Setup() => Schedule(() =>
|
||||
{
|
||||
SelectedRoom.Value = new Room { Name = { Value = "Test Room" } };
|
||||
});
|
||||
|
||||
[SetUpSteps]
|
||||
public void SetupSteps()
|
||||
{
|
||||
AddStep("load match", () => LoadScreen(screen = new MultiplayerMatchSubScreen(SelectedRoom.Value)));
|
||||
AddStep("load match", () =>
|
||||
{
|
||||
SelectedRoom.Value = new Room { Name = { Value = "Test Room" } };
|
||||
LoadScreen(screen = new MultiplayerMatchSubScreen(SelectedRoom.Value));
|
||||
});
|
||||
|
||||
AddUntilStep("wait for load", () => screen.IsCurrentScreen());
|
||||
}
|
||||
|
||||
|
@ -42,8 +42,12 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
Dependencies.Cache(Realm);
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public new void Setup() => Schedule(() =>
|
||||
[SetUpSteps]
|
||||
public override void SetUpSteps()
|
||||
{
|
||||
base.SetUpSteps();
|
||||
|
||||
AddStep("create list", () =>
|
||||
{
|
||||
Child = list = new MultiplayerPlaylist
|
||||
{
|
||||
@ -54,9 +58,6 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
};
|
||||
});
|
||||
|
||||
[SetUpSteps]
|
||||
public new void SetUpSteps()
|
||||
{
|
||||
AddStep("import beatmap", () =>
|
||||
{
|
||||
beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()).WaitSafely();
|
||||
|
@ -46,8 +46,11 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()).WaitSafely();
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public new void Setup() => Schedule(() =>
|
||||
public override void SetUpSteps()
|
||||
{
|
||||
base.SetUpSteps();
|
||||
|
||||
AddStep("create button", () =>
|
||||
{
|
||||
AvailabilityTracker.SelectedItem.BindTo(selectedItem);
|
||||
|
||||
@ -83,6 +86,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
[TestCase(MultiplayerRoomState.Open)]
|
||||
[TestCase(MultiplayerRoomState.WaitingForLoad)]
|
||||
|
@ -14,8 +14,11 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
public class TestSceneStarRatingRangeDisplay : OnlinePlayTestScene
|
||||
{
|
||||
[SetUp]
|
||||
public new void Setup() => Schedule(() =>
|
||||
public override void SetUpSteps()
|
||||
{
|
||||
base.SetUpSteps();
|
||||
|
||||
AddStep("create display", () =>
|
||||
{
|
||||
SelectedRoom.Value = new Room();
|
||||
|
||||
@ -25,6 +28,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
Origin = Anchor.Centre
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRange([Values(0, 2, 3, 4, 6, 7)] double min, [Values(0, 2, 3, 4, 6, 7)] double max)
|
||||
|
@ -25,8 +25,11 @@ namespace osu.Game.Tests.Visual.Playlists
|
||||
|
||||
protected override OnlinePlayTestSceneDependencies CreateOnlinePlayDependencies() => new TestDependencies();
|
||||
|
||||
[SetUp]
|
||||
public new void Setup() => Schedule(() =>
|
||||
public override void SetUpSteps()
|
||||
{
|
||||
base.SetUpSteps();
|
||||
|
||||
AddStep("create overlay", () =>
|
||||
{
|
||||
SelectedRoom.Value = new Room();
|
||||
|
||||
@ -36,6 +39,7 @@ namespace osu.Game.Tests.Visual.Playlists
|
||||
State = { Value = Visibility.Visible }
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestButtonEnabledOnlyWithNameAndBeatmap()
|
||||
|
@ -15,8 +15,11 @@ namespace osu.Game.Tests.Visual.Playlists
|
||||
{
|
||||
public class TestScenePlaylistsParticipantsList : OnlinePlayTestScene
|
||||
{
|
||||
[SetUp]
|
||||
public new void Setup() => Schedule(() =>
|
||||
public override void SetUpSteps()
|
||||
{
|
||||
base.SetUpSteps();
|
||||
|
||||
AddStep("create list", () =>
|
||||
{
|
||||
SelectedRoom.Value = new Room { RoomID = { Value = 7 } };
|
||||
|
||||
@ -30,6 +33,7 @@ namespace osu.Game.Tests.Visual.Playlists
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestHorizontalLayout()
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osu.Game.Tests.Beatmaps;
|
||||
using osu.Game.Tests.Visual.OnlinePlay;
|
||||
@ -34,13 +33,6 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
this.joinRoom = joinRoom;
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public new void Setup() => Schedule(() =>
|
||||
{
|
||||
if (joinRoom)
|
||||
SelectedRoom.Value = CreateRoom();
|
||||
});
|
||||
|
||||
protected virtual Room CreateRoom()
|
||||
{
|
||||
return new Room
|
||||
@ -63,7 +55,12 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
if (joinRoom)
|
||||
{
|
||||
AddStep("join room", () => RoomManager.CreateRoom(SelectedRoom.Value));
|
||||
AddStep("join room", () =>
|
||||
{
|
||||
SelectedRoom.Value = CreateRoom();
|
||||
RoomManager.CreateRoom(SelectedRoom.Value);
|
||||
});
|
||||
|
||||
AddUntilStep("wait for room join", () => RoomJoined);
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,6 @@
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
@ -56,8 +55,11 @@ namespace osu.Game.Tests.Visual.OnlinePlay
|
||||
return dependencies;
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public void Setup() => Schedule(() =>
|
||||
public override void SetUpSteps()
|
||||
{
|
||||
base.SetUpSteps();
|
||||
|
||||
AddStep("setup dependencies", () =>
|
||||
{
|
||||
// Reset the room dependencies to a fresh state.
|
||||
drawableDependenciesContainer.Clear();
|
||||
@ -86,9 +88,10 @@ namespace osu.Game.Tests.Visual.OnlinePlay
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates the room dependencies. Called every <see cref="Setup"/>.
|
||||
/// Creates the room dependencies. Called every <see cref="SetUpSteps"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Any custom dependencies required for online play sub-classes should be added here.
|
||||
|
Reference in New Issue
Block a user