Fixes #2617 - Support for Nerd icons for FileDialog (#2613)

* Add explicit file name unicode mappings

* Added nerd file extensions

* Add folder icon

* Added tests and attribution

* Fix tree view not using System.IO.Abstractions

* Make FileDialog tree use IconGetter

* Added context to IconGetter

* Make Nerd a config setting

* Fix typo in attribution

* tidy up

* Change open folder check to null or whitespace

* Update class diagram to show new classes

* Rename configuration property NerdFonts and set it to ThemeScope

* Move NerdFonts setting to ConsoleDriver

* Move NerdFonts setting to NerdFonts class and rename Enable

---------

Co-authored-by: Tig <tig@users.noreply.github.com>
This commit is contained in:
Thomas Nind
2023-05-13 07:14:19 +01:00
committed by GitHub
parent f3ab1fb1bd
commit c04703f5d6
12 changed files with 1042 additions and 43 deletions

View File

@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.IO.Abstractions.TestingHelpers;
using System.Linq;
using Terminal.Gui;
using Xunit;
using Xunit.Abstractions;
namespace Terminal.Gui.FileServicesTests {
public class NerdFontTests
{
[Fact]
public void TestAllFilenamesMapToKnownGlyphs()
{
var f = new NerdFonts();
foreach(var k in f.FilenameToIcon)
{
Assert.Contains(k.Value, f.Glyphs.Keys);
}
}
[Fact]
public void TestAllExtensionsMapToKnownGlyphs()
{
var f = new NerdFonts();
foreach(var k in f.ExtensionToIcon)
{
Assert.Contains(k.Value, f.Glyphs.Keys);
}
}
}
}