Files
Terminal.Gui/UnitTests/Configuration/GlyphTests.cs
BDisp 72aaf27f91 Fixes #3930. Tests are crashing again... (#3948)
* Fixes #3930. Tests are crashing again...

* Clear the source settings on test.

* Just call CM.Reset.

* Fix one more test 'not run' because of the use of enums in parameters

* Replace void to Task
2025-03-02 10:39:27 -07:00

50 lines
1.3 KiB
C#

using System.Reflection;
using System.Text;
using System.Text.Json;
using static Terminal.Gui.ConfigurationManager;
namespace Terminal.Gui.ConfigurationTests;
public class GlyphTests
{
[Fact]
public void Overrides_Defaults ()
{
// arrange
Locations = ConfigLocations.Default;
Load (true);
Assert.Equal ((Rune)'⟦', Glyphs.LeftBracket);
var glyph = (Rune)Themes ["Default"] ["Glyphs.LeftBracket"].PropertyValue;
Assert.Equal ((Rune)'⟦', glyph);
ThrowOnJsonErrors = true;
// act
var json = """
{
"Themes": [
{
"Default":
{
"Glyphs.LeftBracket": "["
}
}
]
}
""";
Settings!.Update (json, "Overrides_Defaults", ConfigLocations.Runtime);
Apply();
// assert
glyph = glyph = (Rune)Themes ["Default"] ["Glyphs.LeftBracket"].PropertyValue;
Assert.Equal ((Rune)'[', glyph);
Assert.Equal((Rune)'[', Glyphs.LeftBracket);
// clean up
Reset ();
}
}