mirror of
https://github.com/ppy/osu
synced 2025-01-16 02:51:20 +00:00
Update tests
This commit is contained in:
parent
44f2d8a448
commit
19cb8cb03a
@ -3,32 +3,69 @@
|
||||
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Settings.Sections.Maintenance;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Settings
|
||||
{
|
||||
public class TestSceneMigrationScreens : ScreenTestScene
|
||||
{
|
||||
[Cached]
|
||||
private readonly NotificationOverlay notifications;
|
||||
|
||||
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
|
||||
{
|
||||
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
|
||||
{
|
||||
protected override void PerformMigration()
|
||||
{
|
||||
Thread.Sleep(3000);
|
||||
}
|
||||
private readonly bool success;
|
||||
|
||||
public TestMigrationRunScreen()
|
||||
public TestMigrationRunScreen(bool success)
|
||||
: base(null)
|
||||
{
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
protected override bool PerformMigration()
|
||||
{
|
||||
Thread.Sleep(3000);
|
||||
return success;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user