mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 02:43:19 +08:00
Add test coverage of only showing on first run
This commit is contained in:
parent
e2da1d76ca
commit
c562004fe9
@ -10,6 +10,7 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.FirstRunSetup;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
@ -29,9 +30,12 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
|
||||
private Notification lastNotification;
|
||||
|
||||
protected OsuConfigManager LocalConfig;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Dependencies.Cache(LocalConfig = new OsuConfigManager(LocalStorage));
|
||||
Dependencies.CacheAs(performer.Object);
|
||||
Dependencies.CacheAs(notificationOverlay.Object);
|
||||
}
|
||||
@ -60,6 +64,29 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDoesntOpenOnSecondRun()
|
||||
{
|
||||
AddStep("set first run", () => LocalConfig.SetValue(OsuSetting.ShowFirstRunSetup, true));
|
||||
|
||||
AddUntilStep("step through", () =>
|
||||
{
|
||||
if (overlay.CurrentScreen?.IsLoaded != false) overlay.NextButton.TriggerClick();
|
||||
return overlay.State.Value == Visibility.Hidden;
|
||||
});
|
||||
|
||||
AddAssert("first run false", () => !LocalConfig.Get<bool>(OsuSetting.ShowFirstRunSetup));
|
||||
|
||||
AddStep("add overlay", () =>
|
||||
{
|
||||
Child = overlay = new FirstRunSetupOverlay();
|
||||
});
|
||||
|
||||
AddWaitStep("wait some", 5);
|
||||
|
||||
AddAssert("overlay didn't show", () => overlay.State.Value == Visibility.Hidden);
|
||||
}
|
||||
|
||||
[TestCase(false)]
|
||||
[TestCase(true)]
|
||||
public void TestOverlayRunsToFinish(bool keyboard)
|
||||
|
Loading…
Reference in New Issue
Block a user