1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 21:27:24 +08:00

Add failing test case

This commit is contained in:
Salman Ahmed 2022-06-15 03:34:08 +03:00
parent 674a9bb399
commit 1171d44ad9
3 changed files with 52 additions and 4 deletions

View File

@ -0,0 +1,46 @@
// 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.
using NUnit.Framework;
using osu.Framework.Graphics.Containers;
using osu.Framework.Platform;
using osu.Game.Configuration;
using osu.Game.Online.API;
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 override void SetUpSteps()
{
base.SetUpSteps();
AddUntilStep("Wait for first-run setup", () => Game.FirstRunOverlay.State.Value == Visibility.Visible);
}
[Test]
public void TestImportantNotificationDoesntInterruptSetup()
{
AddStep("post important notification", () => Game.Notifications.Post(new SimpleNotification { Text = "Important notification" }));
AddAssert("first-run setup still visible", () => Game.FirstRunOverlay.State.Value == Visibility.Visible);
}
protected override TestOsuGame CreateTestGame() => new FirstRunGame(LocalStorage, API);
private class FirstRunGame : TestOsuGame
{
public FirstRunGame(Storage storage, IAPIProvider api, string[] args = null)
: base(storage, api, args)
{
}
protected override void LoadComplete()
{
base.LoadComplete();
LocalConfig.SetValue(OsuSetting.ShowFirstRunSetup, true);
}
}
}
}

View File

@ -153,7 +153,7 @@ namespace osu.Game
protected SettingsOverlay Settings;
private FirstRunSetupOverlay firstRunOverlay;
protected FirstRunSetupOverlay FirstRunOverlay { get; private set; }
private VolumeOverlay volume;
@ -845,7 +845,7 @@ namespace osu.Game
loadComponentSingleFile(CreateUpdateManager(), Add, true);
// overlay elements
loadComponentSingleFile(firstRunOverlay = new FirstRunSetupOverlay(), overlayContent.Add, true);
loadComponentSingleFile(FirstRunOverlay = new FirstRunSetupOverlay(), overlayContent.Add, true);
loadComponentSingleFile(new ManageCollectionsDialog(), overlayContent.Add, true);
loadComponentSingleFile(beatmapListing = new BeatmapListingOverlay(), overlayContent.Add, true);
loadComponentSingleFile(dashboard = new DashboardOverlay(), overlayContent.Add, true);
@ -896,7 +896,7 @@ namespace osu.Game
Add(new MusicKeyBindingHandler());
// side overlays which cancel each other.
var singleDisplaySideOverlays = new OverlayContainer[] { Settings, Notifications, firstRunOverlay };
var singleDisplaySideOverlays = new OverlayContainer[] { Settings, Notifications, FirstRunOverlay };
foreach (var overlay in singleDisplaySideOverlays)
{
@ -921,7 +921,7 @@ namespace osu.Game
}
// ensure only one of these overlays are open at once.
var singleDisplayOverlays = new OverlayContainer[] { firstRunOverlay, chatOverlay, news, dashboard, beatmapListing, changelogOverlay, rankingsOverlay, wikiOverlay };
var singleDisplayOverlays = new OverlayContainer[] { FirstRunOverlay, chatOverlay, news, dashboard, beatmapListing, changelogOverlay, rankingsOverlay, wikiOverlay };
foreach (var overlay in singleDisplayOverlays)
{

View File

@ -132,6 +132,8 @@ namespace osu.Game.Tests.Visual
public new NotificationOverlay Notifications => base.Notifications;
public new FirstRunSetupOverlay FirstRunOverlay => base.FirstRunOverlay;
public new MusicController MusicController => base.MusicController;
public new OsuConfigManager LocalConfig => base.LocalConfig;