Update file/directory selector tests to use ThemeComparisonTestScene

This commit is contained in:
Salman Ahmed 2022-07-11 20:18:50 +03:00
parent b92979acd6
commit 84002aefae
2 changed files with 32 additions and 13 deletions

View File

@ -3,18 +3,17 @@
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Tests.Visual.UserInterface;
namespace osu.Game.Tests.Visual.Settings
{
public class TestSceneDirectorySelector : OsuTestScene
public class TestSceneDirectorySelector : ThemeComparisonTestScene
{
[BackgroundDependencyLoader]
private void load()
protected override Drawable CreateContent() => new OsuDirectorySelector
{
Add(new OsuDirectorySelector { RelativeSizeAxes = Axes.Both });
}
RelativeSizeAxes = Axes.Both
};
}
}

View File

@ -4,23 +4,43 @@
#nullable disable
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Tests.Visual.UserInterface;
namespace osu.Game.Tests.Visual.Settings
{
public class TestSceneFileSelector : OsuTestScene
public class TestSceneFileSelector : ThemeComparisonTestScene
{
[Test]
public void TestAllFiles()
{
AddStep("create", () => Child = new OsuFileSelector { RelativeSizeAxes = Axes.Both });
}
[Resolved]
private OsuColour colours { get; set; }
[Test]
public void TestJpgFilesOnly()
{
AddStep("create", () => Child = new OsuFileSelector(validFileExtensions: new[] { ".jpg" }) { RelativeSizeAxes = Axes.Both });
AddStep("create", () =>
{
Cell(0, 0).Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colours.GreySeaFoam
},
new OsuFileSelector(validFileExtensions: new[] { ".jpg" })
{
RelativeSizeAxes = Axes.Both,
},
};
});
}
protected override Drawable CreateContent() => new OsuFileSelector
{
RelativeSizeAxes = Axes.Both,
};
}
}