Merge remote-tracking branch 'upstream/master' into fix-op-non-current-onexiting

This commit is contained in:
Joseph Madamba
2022-12-24 14:01:11 -08:00
3098 changed files with 41866 additions and 31216 deletions

View File

@ -1,63 +0,0 @@
// 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.
#nullable disable
using System.Linq;
using System.Runtime.InteropServices;
using NUnit.Framework;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.Models;
using osu.Game.Scoring;
using osu.Game.Skinning;
using osu.Game.Tests.Resources;
namespace osu.Game.Tests.Visual.Navigation
{
public class TestEFToRealmMigration : OsuGameTestScene
{
public override void RecycleLocalStorage(bool isDisposing)
{
base.RecycleLocalStorage(isDisposing);
if (isDisposing)
return;
using (var outStream = LocalStorage.CreateFileSafely(DatabaseContextFactory.DATABASE_NAME))
using (var stream = TestResources.OpenResource(DatabaseContextFactory.DATABASE_NAME))
stream.CopyTo(outStream);
}
[SetUp]
public void SetUp()
{
if (RuntimeInfo.OS == RuntimeInfo.Platform.macOS && RuntimeInformation.OSArchitecture == Architecture.Arm64)
Assert.Ignore("EF-to-realm migrations are not supported on M1 ARM architectures.");
}
public override void SetUpSteps()
{
// base SetUpSteps are executed before the above SetUp, therefore early-return to allow ignoring test properly.
// attempting to ignore here would yield a TargetInvocationException instead.
if (RuntimeInfo.OS == RuntimeInfo.Platform.macOS && RuntimeInformation.OSArchitecture == Architecture.Arm64)
return;
base.SetUpSteps();
}
[Test]
public void TestMigration()
{
// Numbers are taken from the test database (see commit f03de16ee5a46deac3b5f2ca1edfba5c4c5dca7d).
AddAssert("Check beatmaps", () => Game.Dependencies.Get<RealmAccess>().Run(r => r.All<BeatmapSetInfo>().Count(s => !s.Protected) == 1));
AddAssert("Check skins", () => Game.Dependencies.Get<RealmAccess>().Run(r => r.All<SkinInfo>().Count(s => !s.Protected) == 1));
AddAssert("Check scores", () => Game.Dependencies.Get<RealmAccess>().Run(r => r.All<ScoreInfo>().Count() == 1));
// One extra file is created during realm migration / startup due to the circles intro import.
AddAssert("Check files", () => Game.Dependencies.Get<RealmAccess>().Run(r => r.All<RealmFile>().Count() == 271));
}
}
}

View File

@ -12,7 +12,7 @@ using osuTK.Input;
namespace osu.Game.Tests.Visual.Navigation
{
public class TestSceneButtonSystemNavigation : OsuGameTestScene
public partial class TestSceneButtonSystemNavigation : OsuGameTestScene
{
private ButtonSystem buttons => ((MainMenu)Game.ScreenStack.CurrentScreen).ChildrenOfType<ButtonSystem>().Single();

View File

@ -20,7 +20,7 @@ using osuTK.Input;
namespace osu.Game.Tests.Visual.Navigation
{
public class TestSceneChangeAndUseGameplayBindings : OsuGameTestScene
public partial class TestSceneChangeAndUseGameplayBindings : OsuGameTestScene
{
[Test]
public void TestGameplayKeyBindings()
@ -56,6 +56,7 @@ namespace osu.Game.Tests.Visual.Navigation
PushAndConfirm(() => new PlaySongSelect());
AddUntilStep("wait for selection", () => !Game.Beatmap.IsDefault);
AddUntilStep("wait for carousel load", () => songSelect.BeatmapSetsLoaded);
AddStep("enter gameplay", () => InputManager.Key(Key.Enter));
@ -92,6 +93,8 @@ namespace osu.Game.Tests.Visual.Navigation
.AsEnumerable()
.First(k => k.RulesetName == "osu" && k.ActionInt == 0);
private Screens.Select.SongSelect songSelect => Game.ScreenStack.CurrentScreen as Screens.Select.SongSelect;
private Player player => Game.ScreenStack.CurrentScreen as Player;
private KeyCounter keyCounter => player.ChildrenOfType<KeyCounter>().First();

View File

@ -13,7 +13,7 @@ using osu.Game.Skinning.Editor;
namespace osu.Game.Tests.Visual.Navigation
{
public class TestSceneEditDefaultSkin : OsuGameTestScene
public partial class TestSceneEditDefaultSkin : OsuGameTestScene
{
private SkinManager skinManager => Game.Dependencies.Get<SkinManager>();
private SkinEditorOverlay skinEditor => Game.Dependencies.Get<SkinEditorOverlay>();
@ -21,7 +21,7 @@ namespace osu.Game.Tests.Visual.Navigation
[Test]
public void TestEditDefaultSkin()
{
AddAssert("is default skin", () => skinManager.CurrentSkinInfo.Value.ID == SkinInfo.DEFAULT_SKIN);
AddAssert("is default skin", () => skinManager.CurrentSkinInfo.Value.ID == SkinInfo.ARGON_SKIN);
AddStep("open settings", () => { Game.Settings.Show(); });
@ -32,7 +32,7 @@ namespace osu.Game.Tests.Visual.Navigation
AddStep("open skin editor", () => skinEditor.Show());
// Until step required as the skin editor may take time to load (and an extra scheduled frame for the mutable part).
AddUntilStep("is modified default skin", () => skinManager.CurrentSkinInfo.Value.ID != SkinInfo.DEFAULT_SKIN);
AddUntilStep("is modified default skin", () => skinManager.CurrentSkinInfo.Value.ID != SkinInfo.ARGON_SKIN);
AddAssert("is not protected", () => skinManager.CurrentSkinInfo.Value.PerformRead(s => !s.Protected));
AddUntilStep("export button enabled", () => Game.Settings.ChildrenOfType<SkinSection.ExportSkinButton>().SingleOrDefault()?.Enabled.Value == true);

View File

@ -13,7 +13,7 @@ using osu.Game.Overlays.Notifications;
namespace osu.Game.Tests.Visual.Navigation
{
[System.ComponentModel.Description("game with first-run setup overlay")]
public class TestSceneFirstRunGame : OsuGameTestScene
public partial class TestSceneFirstRunGame : OsuGameTestScene
{
public override void SetUpSteps()
{
@ -26,22 +26,13 @@ namespace osu.Game.Tests.Visual.Navigation
public void TestImportantNotificationDoesntInterruptSetup()
{
AddStep("post important notification", () => Game.Notifications.Post(new SimpleNotification { Text = "Important notification" }));
AddAssert("no notification posted", () => Game.Notifications.UnreadCount.Value == 0);
AddAssert("first-run setup still visible", () => Game.FirstRunOverlay.State.Value == Visibility.Visible);
AddUntilStep("finish first-run setup", () =>
{
Game.FirstRunOverlay.NextButton.TriggerClick();
return Game.FirstRunOverlay.State.Value == Visibility.Hidden;
});
AddWaitStep("wait for post delay", 5);
AddAssert("notifications shown", () => Game.Notifications.State.Value == Visibility.Visible);
AddAssert("notification posted", () => Game.Notifications.UnreadCount.Value == 1);
}
protected override TestOsuGame CreateTestGame() => new FirstRunGame(LocalStorage, API);
private class FirstRunGame : TestOsuGame
private partial class FirstRunGame : TestOsuGame
{
public FirstRunGame(Storage storage, IAPIProvider api, string[] args = null)
: base(storage, api, args)

View File

@ -19,7 +19,7 @@ namespace osu.Game.Tests.Visual.Navigation
{
[TestFixture]
[Ignore("This test cannot be run headless, as it requires the game host running the nested game to have IPC bound.")]
public class TestSceneInterProcessCommunication : OsuGameTestScene
public partial class TestSceneInterProcessCommunication : OsuGameTestScene
{
private HeadlessGameHost ipcSenderHost = null!;

View File

@ -12,7 +12,7 @@ using osuTK.Input;
namespace osu.Game.Tests.Visual.Navigation
{
public class TestSceneMouseWheelVolumeAdjust : OsuGameTestScene
public partial class TestSceneMouseWheelVolumeAdjust : OsuGameTestScene
{
public override void SetUpSteps()
{

View File

@ -25,11 +25,12 @@ using osu.Game.Rulesets.Mods;
using osu.Game.Scoring;
using osu.Game.Screens.Menu;
using osu.Game.Skinning;
using osuTK.Input;
namespace osu.Game.Tests.Visual.Navigation
{
[TestFixture]
public class TestSceneOsuGame : OsuGameTestScene
public partial class TestSceneOsuGame : OsuGameTestScene
{
private IReadOnlyList<Type> requiredGameDependencies => new[]
{
@ -79,6 +80,16 @@ namespace osu.Game.Tests.Visual.Navigation
[Resolved]
private OsuGameBase gameBase { get; set; }
[Test]
public void TestCursorHidesWhenIdle()
{
AddStep("click mouse", () => InputManager.Click(MouseButton.Left));
AddUntilStep("wait until idle", () => Game.IsIdle.Value);
AddUntilStep("menu cursor hidden", () => Game.GlobalCursorDisplay.MenuCursor.ActiveCursor.Alpha == 0);
AddStep("click mouse", () => InputManager.Click(MouseButton.Left));
AddUntilStep("menu cursor shown", () => Game.GlobalCursorDisplay.MenuCursor.ActiveCursor.Alpha == 1);
}
[Test]
public void TestNullRulesetHandled()
{

View File

@ -4,6 +4,7 @@
#nullable disable
using System.Linq;
using System.Threading;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Extensions;
@ -21,7 +22,7 @@ using static osu.Game.Tests.Visual.Navigation.TestSceneScreenNavigation;
namespace osu.Game.Tests.Visual.Navigation
{
public class TestScenePerformFromScreen : OsuGameTestScene
public partial class TestScenePerformFromScreen : OsuGameTestScene
{
private bool actionPerformed;
@ -85,6 +86,19 @@ namespace osu.Game.Tests.Visual.Navigation
AddAssert("did perform", () => actionPerformed);
}
[Test]
public void TestPerformEnsuresScreenIsLoaded()
{
TestLoadBlockingScreen screen = null;
AddStep("push blocking screen", () => Game.ScreenStack.Push(screen = new TestLoadBlockingScreen()));
AddStep("perform", () => Game.PerformFromScreen(_ => actionPerformed = true, new[] { typeof(TestLoadBlockingScreen) }));
AddAssert("action not performed", () => !actionPerformed);
AddStep("allow load", () => screen.LoadEvent.Set());
AddUntilStep("action performed", () => actionPerformed);
}
[Test]
public void TestOverlaysAlwaysClosed()
{
@ -223,7 +237,7 @@ namespace osu.Game.Tests.Visual.Navigation
AddUntilStep("beatmap updated", () => Game.Beatmap.Value.BeatmapSetInfo.OnlineID == 241526);
}
public class DialogBlockingScreen : OsuScreen
public partial class DialogBlockingScreen : OsuScreen
{
[Resolved]
private IDialogOverlay dialogOverlay { get; set; }
@ -246,7 +260,7 @@ namespace osu.Game.Tests.Visual.Navigation
}
}
public class TestScreenWithNestedStack : OsuScreen, IHasSubScreenStack
public partial class TestScreenWithNestedStack : OsuScreen, IHasSubScreenStack
{
public DialogBlockingScreen Blocker { get; private set; }
@ -270,5 +284,16 @@ namespace osu.Game.Tests.Visual.Navigation
return base.OnExiting(e);
}
}
public partial class TestLoadBlockingScreen : OsuScreen
{
public readonly ManualResetEventSlim LoadEvent = new ManualResetEventSlim();
[BackgroundDependencyLoader]
private void load()
{
LoadEvent.Wait(10000);
}
}
}
}

View File

@ -7,16 +7,20 @@ using System;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Screens;
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Extensions;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Catch;
using osu.Game.Rulesets.Mania;
using osu.Game.Rulesets.Osu;
using osu.Game.Screens.Menu;
using osu.Game.Screens.Select;
namespace osu.Game.Tests.Visual.Navigation
{
public class TestScenePresentBeatmap : OsuGameTestScene
public partial class TestScenePresentBeatmap : OsuGameTestScene
{
[Test]
public void TestFromMainMenu()
@ -55,6 +59,7 @@ namespace osu.Game.Tests.Visual.Navigation
presentAndConfirm(firstImport);
var secondImport = importBeatmap(3);
confirmBeatmapInSongSelect(secondImport);
presentAndConfirm(secondImport);
// Test presenting same beatmap more than once
@ -68,16 +73,51 @@ namespace osu.Game.Tests.Visual.Navigation
}
[Test]
public void TestFromSongSelectDifferentRuleset()
public void TestFromSongSelectDifferentRulesetWithConvertDisallowed()
{
var firstImport = importBeatmap(1);
presentAndConfirm(firstImport);
AddStep("Set converts disallowed", () => Game.LocalConfig.SetValue(OsuSetting.ShowConvertedBeatmaps, false));
var secondImport = importBeatmap(3, new ManiaRuleset().RulesetInfo);
presentAndConfirm(secondImport);
var osuImport = importBeatmap(1);
presentAndConfirm(osuImport);
presentSecondDifficultyAndConfirm(firstImport, 1);
presentSecondDifficultyAndConfirm(secondImport, 3);
var maniaImport = importBeatmap(2, new ManiaRuleset().RulesetInfo);
confirmBeatmapInSongSelect(maniaImport);
presentAndConfirm(maniaImport);
var catchImport = importBeatmap(3, new CatchRuleset().RulesetInfo);
confirmBeatmapInSongSelect(catchImport);
presentAndConfirm(catchImport);
// Ruleset is always changed.
presentSecondDifficultyAndConfirm(maniaImport, 2);
presentSecondDifficultyAndConfirm(osuImport, 1);
presentSecondDifficultyAndConfirm(catchImport, 3);
}
[Test]
public void TestFromSongSelectDifferentRulesetWithConvertAllowed()
{
AddStep("Set converts allowed", () => Game.LocalConfig.SetValue(OsuSetting.ShowConvertedBeatmaps, true));
var osuImport = importBeatmap(1);
presentAndConfirm(osuImport);
var maniaImport = importBeatmap(2, new ManiaRuleset().RulesetInfo);
confirmBeatmapInSongSelect(maniaImport);
presentAndConfirm(maniaImport);
var catchImport = importBeatmap(3, new CatchRuleset().RulesetInfo);
confirmBeatmapInSongSelect(catchImport);
presentAndConfirm(catchImport);
// force ruleset to osu!mania
presentSecondDifficultyAndConfirm(maniaImport, 2);
// ruleset is not changed as we can convert osu! beatmap.
presentSecondDifficultyAndConfirm(osuImport, 1, expectedRulesetOnlineID: 3);
// ruleset is changed as we cannot convert.
presentSecondDifficultyAndConfirm(catchImport, 3);
}
private void returnToMenu()
@ -108,19 +148,19 @@ namespace osu.Game.Tests.Visual.Navigation
imported = Game.BeatmapManager.Import(new BeatmapSetInfo
{
Hash = Guid.NewGuid().ToString(),
OnlineID = i,
OnlineID = i * 1024,
Beatmaps =
{
new BeatmapInfo
{
OnlineID = i * 1024,
OnlineID = i * 1024 + 1,
Metadata = metadata,
Difficulty = new BeatmapDifficulty(),
Ruleset = ruleset ?? new OsuRuleset().RulesetInfo
},
new BeatmapInfo
{
OnlineID = i * 2048,
OnlineID = i * 1024 + 2,
Metadata = metadata,
Difficulty = new BeatmapDifficulty(),
Ruleset = ruleset ?? new OsuRuleset().RulesetInfo
@ -134,23 +174,32 @@ namespace osu.Game.Tests.Visual.Navigation
return () => imported;
}
private void confirmBeatmapInSongSelect(Func<BeatmapSetInfo> getImport)
{
AddUntilStep("beatmap in song select", () =>
{
var songSelect = (Screens.Select.SongSelect)Game.ScreenStack.CurrentScreen;
return songSelect.ChildrenOfType<BeatmapCarousel>().Single().BeatmapSets.Any(b => b.MatchesOnlineID(getImport()));
});
}
private void presentAndConfirm(Func<BeatmapSetInfo> getImport)
{
AddStep("present beatmap", () => Game.PresentBeatmap(getImport()));
AddUntilStep("wait for song select", () => Game.ScreenStack.CurrentScreen is Screens.Select.SongSelect);
AddUntilStep("correct beatmap displayed", () => Game.Beatmap.Value.BeatmapSetInfo.MatchesOnlineID(getImport()));
AddAssert("correct ruleset selected", () => Game.Ruleset.Value.Equals(getImport().Beatmaps.First().Ruleset));
AddUntilStep("wait for song select", () => Game.ScreenStack.CurrentScreen is Screens.Select.SongSelect songSelect && songSelect.IsLoaded);
AddUntilStep("correct beatmap displayed", () => Game.Beatmap.Value.BeatmapSetInfo.OnlineID, () => Is.EqualTo(getImport().OnlineID));
AddAssert("correct ruleset selected", () => Game.Ruleset.Value, () => Is.EqualTo(getImport().Beatmaps.First().Ruleset));
}
private void presentSecondDifficultyAndConfirm(Func<BeatmapSetInfo> getImport, int importedID)
private void presentSecondDifficultyAndConfirm(Func<BeatmapSetInfo> getImport, int importedID, int? expectedRulesetOnlineID = null)
{
Predicate<BeatmapInfo> pred = b => b.OnlineID == importedID * 2048;
Predicate<BeatmapInfo> pred = b => b.OnlineID == importedID * 1024 + 2;
AddStep("present difficulty", () => Game.PresentBeatmap(getImport(), pred));
AddUntilStep("wait for song select", () => Game.ScreenStack.CurrentScreen is Screens.Select.SongSelect);
AddUntilStep("correct beatmap displayed", () => Game.Beatmap.Value.BeatmapInfo.OnlineID == importedID * 2048);
AddAssert("correct ruleset selected", () => Game.Ruleset.Value.Equals(getImport().Beatmaps.First().Ruleset));
AddUntilStep("wait for song select", () => Game.ScreenStack.CurrentScreen is Screens.Select.SongSelect songSelect && songSelect.IsLoaded);
AddUntilStep("correct beatmap displayed", () => Game.Beatmap.Value.BeatmapInfo.OnlineID, () => Is.EqualTo(importedID * 1024 + 2));
AddAssert("correct ruleset selected", () => Game.Ruleset.Value.OnlineID, () => Is.EqualTo(expectedRulesetOnlineID ?? getImport().Beatmaps.First().Ruleset.OnlineID));
}
}
}

View File

@ -9,8 +9,10 @@ using NUnit.Framework;
using osu.Framework.Screens;
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Online.API;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Catch;
using osu.Game.Rulesets.Mania;
using osu.Game.Rulesets.Osu;
using osu.Game.Scoring;
@ -22,7 +24,7 @@ using osu.Game.Screens.Select;
namespace osu.Game.Tests.Visual.Navigation
{
public class TestScenePresentScore : OsuGameTestScene
public partial class TestScenePresentScore : OsuGameTestScene
{
private BeatmapSetInfo beatmap;
@ -92,6 +94,31 @@ namespace osu.Game.Tests.Visual.Navigation
returnToMenu();
}
[Test]
public void TestFromSongSelectWithFilter([Values] ScorePresentType type)
{
AddStep("enter song select", () => Game.ChildrenOfType<ButtonSystem>().Single().OnSolo.Invoke());
AddUntilStep("song select is current", () => Game.ScreenStack.CurrentScreen is PlaySongSelect songSelect && songSelect.BeatmapSetsLoaded);
AddStep("filter to nothing", () => ((PlaySongSelect)Game.ScreenStack.CurrentScreen).FilterControl.CurrentTextSearch.Value = "fdsajkl;fgewq");
AddUntilStep("wait for no results", () => Beatmap.IsDefault);
var firstImport = importScore(1, new CatchRuleset().RulesetInfo);
presentAndConfirm(firstImport, type);
}
[Test]
public void TestFromSongSelectWithConvertRulesetChange([Values] ScorePresentType type)
{
AddStep("enter song select", () => Game.ChildrenOfType<ButtonSystem>().Single().OnSolo.Invoke());
AddUntilStep("song select is current", () => Game.ScreenStack.CurrentScreen is PlaySongSelect songSelect && songSelect.BeatmapSetsLoaded);
AddStep("set convert to false", () => Game.LocalConfig.SetValue(OsuSetting.ShowConvertedBeatmaps, false));
var firstImport = importScore(1, new CatchRuleset().RulesetInfo);
presentAndConfirm(firstImport, type);
}
[Test]
public void TestFromSongSelect([Values] ScorePresentType type)
{

View File

@ -19,6 +19,7 @@ using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.Leaderboards;
using osu.Game.Overlays;
using osu.Game.Overlays.BeatmapListing;
using osu.Game.Overlays.Mods;
using osu.Game.Overlays.Toolbar;
using osu.Game.Rulesets.Mods;
@ -39,7 +40,7 @@ using osuTK.Input;
namespace osu.Game.Tests.Visual.Navigation
{
public class TestSceneScreenNavigation : OsuGameTestScene
public partial class TestSceneScreenNavigation : OsuGameTestScene
{
private const float click_padding = 25;
@ -455,6 +456,8 @@ namespace osu.Game.Tests.Visual.Navigation
{
AddUntilStep("Wait for toolbar to load", () => Game.Toolbar.IsLoaded);
AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely());
TestPlaySongSelect songSelect = null;
PushAndConfirm(() => songSelect = new TestPlaySongSelect());
@ -532,6 +535,62 @@ namespace osu.Game.Tests.Visual.Navigation
AddWaitStep("wait two frames", 2);
}
[Test]
public void TestFeaturedArtistDisclaimerDialog()
{
BeatmapListingOverlay getBeatmapListingOverlay() => Game.ChildrenOfType<BeatmapListingOverlay>().FirstOrDefault();
AddStep("Wait for notifications to load", () => Game.SearchBeatmapSet(string.Empty));
AddUntilStep("wait for dialog overlay", () => Game.ChildrenOfType<DialogOverlay>().SingleOrDefault() != null);
AddUntilStep("Wait for beatmap overlay to load", () => getBeatmapListingOverlay()?.State.Value == Visibility.Visible);
AddAssert("featured artist filter is on", () => getBeatmapListingOverlay().ChildrenOfType<BeatmapSearchGeneralFilterRow>().First().Current.Contains(SearchGeneral.FeaturedArtists));
AddStep("toggle featured artist filter",
() => getBeatmapListingOverlay().ChildrenOfType<FilterTabItem<SearchGeneral>>().First(i => i.Value == SearchGeneral.FeaturedArtists).TriggerClick());
AddAssert("disclaimer dialog is shown", () => Game.ChildrenOfType<DialogOverlay>().Single().CurrentDialog != null);
AddAssert("featured artist filter is still on", () => getBeatmapListingOverlay().ChildrenOfType<BeatmapSearchGeneralFilterRow>().First().Current.Contains(SearchGeneral.FeaturedArtists));
AddStep("confirm", () => InputManager.Key(Key.Enter));
AddAssert("dialog dismissed", () => Game.ChildrenOfType<DialogOverlay>().Single().CurrentDialog == null);
AddUntilStep("featured artist filter is off", () => !getBeatmapListingOverlay().ChildrenOfType<BeatmapSearchGeneralFilterRow>().First().Current.Contains(SearchGeneral.FeaturedArtists));
}
[Test]
public void TestMainOverlaysClosesNotificationOverlay()
{
ChangelogOverlay getChangelogOverlay() => Game.ChildrenOfType<ChangelogOverlay>().FirstOrDefault();
AddUntilStep("Wait for notifications to load", () => Game.Notifications.IsLoaded);
AddStep("Show notifications", () => Game.Notifications.Show());
AddUntilStep("wait for notifications shown", () => Game.Notifications.IsPresent && Game.Notifications.State.Value == Visibility.Visible);
AddStep("Show changelog listing", () => Game.ShowChangelogListing());
AddUntilStep("wait for changelog shown", () => getChangelogOverlay()?.IsPresent == true && getChangelogOverlay()?.State.Value == Visibility.Visible);
AddAssert("Notifications is hidden", () => Game.Notifications.State.Value == Visibility.Hidden);
AddStep("Show notifications", () => Game.Notifications.Show());
AddUntilStep("wait for notifications shown", () => Game.Notifications.State.Value == Visibility.Visible);
AddUntilStep("changelog still visible", () => getChangelogOverlay().State.Value == Visibility.Visible);
}
[Test]
public void TestMainOverlaysClosesSettingsOverlay()
{
ChangelogOverlay getChangelogOverlay() => Game.ChildrenOfType<ChangelogOverlay>().FirstOrDefault();
AddUntilStep("Wait for settings to load", () => Game.Settings.IsLoaded);
AddStep("Show settings", () => Game.Settings.Show());
AddUntilStep("wait for settings shown", () => Game.Settings.IsPresent && Game.Settings.State.Value == Visibility.Visible);
AddStep("Show changelog listing", () => Game.ShowChangelogListing());
AddUntilStep("wait for changelog shown", () => getChangelogOverlay()?.IsPresent == true && getChangelogOverlay()?.State.Value == Visibility.Visible);
AddAssert("Settings is hidden", () => Game.Settings.State.Value == Visibility.Hidden);
AddStep("Show settings", () => Game.Settings.Show());
AddUntilStep("wait for settings shown", () => Game.Settings.State.Value == Visibility.Visible);
AddUntilStep("changelog still visible", () => getChangelogOverlay().State.Value == Visibility.Visible);
}
[Test]
public void TestOverlayClosing()
{
@ -677,7 +736,7 @@ namespace osu.Game.Tests.Visual.Navigation
ConfirmAtMainMenu();
}
public class TestPlaySongSelect : PlaySongSelect
public partial class TestPlaySongSelect : PlaySongSelect
{
public ModSelectOverlay ModSelectOverlay => ModSelect;

View File

@ -24,7 +24,7 @@ using static osu.Game.Tests.Visual.Navigation.TestSceneScreenNavigation;
namespace osu.Game.Tests.Visual.Navigation
{
public class TestSceneSkinEditorNavigation : OsuGameTestScene
public partial class TestSceneSkinEditorNavigation : OsuGameTestScene
{
private TestPlaySongSelect songSelect;
private SkinEditor skinEditor => Game.ChildrenOfType<SkinEditor>().FirstOrDefault();

View File

@ -15,7 +15,7 @@ using osu.Game.Overlays.BeatmapSet;
namespace osu.Game.Tests.Visual.Navigation
{
public class TestSceneStartupBeatmapDisplay : OsuGameTestScene
public partial class TestSceneStartupBeatmapDisplay : OsuGameTestScene
{
private const int requested_beatmap_id = 75;
private const int requested_beatmap_set_id = 1;

View File

@ -14,7 +14,7 @@ using osu.Game.Overlays;
namespace osu.Game.Tests.Visual.Navigation
{
public class TestSceneStartupBeatmapSetDisplay : OsuGameTestScene
public partial class TestSceneStartupBeatmapSetDisplay : OsuGameTestScene
{
private const int requested_beatmap_set_id = 1;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using System.Linq;
using NUnit.Framework;
using osu.Framework.Testing;
@ -11,9 +9,9 @@ using osu.Game.Tests.Resources;
namespace osu.Game.Tests.Visual.Navigation
{
public class TestSceneStartupImport : OsuGameTestScene
public partial class TestSceneStartupImport : OsuGameTestScene
{
private string importFilename;
private string? importFilename;
protected override TestOsuGame CreateTestGame() => new TestOsuGame(LocalStorage, API, new[] { importFilename });

View File

@ -10,7 +10,7 @@ using osu.Game.Configuration;
namespace osu.Game.Tests.Visual.Navigation
{
[TestFixture]
public class TestSceneStartupRuleset : OsuGameTestScene
public partial class TestSceneStartupRuleset : OsuGameTestScene
{
protected override TestOsuGame CreateTestGame()
{

View File

@ -9,7 +9,7 @@ using osu.Game.Configuration;
namespace osu.Game.Tests.Visual.Navigation
{
public class TestSettingsMigration : OsuGameTestScene
public partial class TestSettingsMigration : OsuGameTestScene
{
public override void RecycleLocalStorage(bool isDisposing)
{
@ -34,7 +34,7 @@ namespace osu.Game.Tests.Visual.Navigation
AddStep("force save config", () => Game.LocalConfig.Save());
AddStep("remove game", () => Remove(Game));
AddStep("remove game", () => Remove(Game, true));
AddStep("create game again", CreateGame);