mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 09:03:50 +09:00
Update tests
This commit is contained in:
@ -3,32 +3,69 @@
|
|||||||
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Settings.Sections.Maintenance;
|
using osu.Game.Overlays.Settings.Sections.Maintenance;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Settings
|
namespace osu.Game.Tests.Visual.Settings
|
||||||
{
|
{
|
||||||
public class TestSceneMigrationScreens : ScreenTestScene
|
public class TestSceneMigrationScreens : ScreenTestScene
|
||||||
{
|
{
|
||||||
|
[Cached]
|
||||||
|
private readonly NotificationOverlay notifications;
|
||||||
|
|
||||||
public TestSceneMigrationScreens()
|
public TestSceneMigrationScreens()
|
||||||
{
|
{
|
||||||
AddStep("Push screen", () => Stack.Push(new TestMigrationSelectScreen()));
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
notifications = new NotificationOverlay
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopRight,
|
||||||
|
Origin = Anchor.TopRight,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestDeleteSuccess()
|
||||||
|
{
|
||||||
|
AddStep("Push screen", () => Stack.Push(new TestMigrationSelectScreen(true)));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestDeleteFails()
|
||||||
|
{
|
||||||
|
AddStep("Push screen", () => Stack.Push(new TestMigrationSelectScreen(false)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestMigrationSelectScreen : MigrationSelectScreen
|
private class TestMigrationSelectScreen : MigrationSelectScreen
|
||||||
{
|
{
|
||||||
protected override void BeginMigration(DirectoryInfo target) => this.Push(new TestMigrationRunScreen());
|
private readonly bool deleteSuccess;
|
||||||
|
|
||||||
|
public TestMigrationSelectScreen(bool deleteSuccess)
|
||||||
|
{
|
||||||
|
this.deleteSuccess = deleteSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void BeginMigration(DirectoryInfo target) => this.Push(new TestMigrationRunScreen(deleteSuccess));
|
||||||
|
|
||||||
private class TestMigrationRunScreen : MigrationRunScreen
|
private class TestMigrationRunScreen : MigrationRunScreen
|
||||||
{
|
{
|
||||||
protected override void PerformMigration()
|
private readonly bool success;
|
||||||
{
|
|
||||||
Thread.Sleep(3000);
|
|
||||||
}
|
|
||||||
|
|
||||||
public TestMigrationRunScreen()
|
public TestMigrationRunScreen(bool success)
|
||||||
: base(null)
|
: base(null)
|
||||||
{
|
{
|
||||||
|
this.success = success;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool PerformMigration()
|
||||||
|
{
|
||||||
|
Thread.Sleep(3000);
|
||||||
|
return success;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user