mirror of
https://github.com/ppy/osu
synced 2024-12-25 08:12:41 +00:00
Merge branch 'file-selector' into editor-load-audio
This commit is contained in:
commit
71e1f981fe
@ -1,7 +1,7 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics.UserInterfaceV2;
|
||||
|
||||
@ -9,10 +9,16 @@ namespace osu.Game.Tests.Visual.Settings
|
||||
{
|
||||
public class TestSceneFileSelector : OsuTestScene
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
[Test]
|
||||
public void TestAllFiles()
|
||||
{
|
||||
Add(new FileSelector { RelativeSizeAxes = Axes.Both });
|
||||
AddStep("create", () => Child = new FileSelector { RelativeSizeAxes = Axes.Both });
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestJpgFilesOnly()
|
||||
{
|
||||
AddStep("create", () => Child = new FileSelector(validFileExtensions: new[] { ".jpg" }) { RelativeSizeAxes = Axes.Both });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,33 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
||||
|
||||
protected override string FallbackName => file.Name;
|
||||
|
||||
protected override IconUsage? Icon => FontAwesome.Regular.FileAudio;
|
||||
protected override IconUsage? Icon
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (file.Extension)
|
||||
{
|
||||
case ".ogg":
|
||||
case ".mp3":
|
||||
case ".wav":
|
||||
return FontAwesome.Regular.FileAudio;
|
||||
|
||||
case ".jpg":
|
||||
case ".jpeg":
|
||||
case ".png":
|
||||
return FontAwesome.Regular.FileImage;
|
||||
|
||||
case ".mp4":
|
||||
case ".avi":
|
||||
case ".mov":
|
||||
case ".flv":
|
||||
return FontAwesome.Regular.FileVideo;
|
||||
|
||||
default:
|
||||
return FontAwesome.Regular.File;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user