| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- using System.Reflection;
- using System.Text;
- using System.Text.Json;
- using static Terminal.Gui.Configuration.ConfigurationManager;
- namespace UnitTests.ConfigurationTests;
- public class GlyphTests
- {
- [Fact]
- public void Apply_Applies_Over_Defaults ()
- {
- try
- {
- // arrange
- Enable (ConfigLocations.HardCoded);
- Assert.Equal ((Rune)'⟦', Glyphs.LeftBracket);
- var glyph = (Rune)ThemeManager.GetCurrentTheme () ["Glyphs.LeftBracket"].PropertyValue!;
- Assert.Equal ((Rune)'⟦', glyph);
- ThrowOnJsonErrors = true;
- // act
- RuntimeConfig = """
- {
- "Themes": [
- {
- "Default":
- {
- "Glyphs.LeftBracket": "["
- }
- }
- ]
- }
- """;
- Load (ConfigLocations.Runtime);
- Apply ();
- // assert
- glyph = (Rune)ThemeManager.GetCurrentTheme () ["Glyphs.LeftBracket"].PropertyValue!;
- Assert.Equal ((Rune)'[', glyph);
- Assert.Equal ((Rune)'[', Glyphs.LeftBracket);
- }
- finally
- {
- // clean up
- Disable (resetToHardCodedDefaults: true);
- }
- }
- }
|