1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 13:32:54 +08:00

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 #nullable disable
using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Tests.Visual.UserInterface;
namespace osu.Game.Tests.Visual.Settings namespace osu.Game.Tests.Visual.Settings
{ {
public class TestSceneDirectorySelector : OsuTestScene public class TestSceneDirectorySelector : ThemeComparisonTestScene
{ {
[BackgroundDependencyLoader] protected override Drawable CreateContent() => new OsuDirectorySelector
private void load()
{ {
Add(new OsuDirectorySelector { RelativeSizeAxes = Axes.Both }); RelativeSizeAxes = Axes.Both
} };
} }
} }

View File

@ -4,23 +4,43 @@
#nullable disable #nullable disable
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Tests.Visual.UserInterface;
namespace osu.Game.Tests.Visual.Settings namespace osu.Game.Tests.Visual.Settings
{ {
public class TestSceneFileSelector : OsuTestScene public class TestSceneFileSelector : ThemeComparisonTestScene
{ {
[Test] [Resolved]
public void TestAllFiles() private OsuColour colours { get; set; }
{
AddStep("create", () => Child = new OsuFileSelector { RelativeSizeAxes = Axes.Both });
}
[Test] [Test]
public void TestJpgFilesOnly() 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,
};
} }
} }