GlyphTests.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System.Reflection;
  2. using System.Text;
  3. using System.Text.Json;
  4. using static Terminal.Gui.ConfigurationManager;
  5. namespace Terminal.Gui.ConfigurationTests;
  6. public class GlyphTests
  7. {
  8. [Fact]
  9. public void Overrides_Defaults ()
  10. {
  11. // arrange
  12. Locations = ConfigLocations.Default;
  13. Load (true);
  14. Assert.Equal ((Rune)'⟦', Glyphs.LeftBracket);
  15. var glyph = (Rune)Themes ["Default"] ["Glyphs.LeftBracket"].PropertyValue;
  16. Assert.Equal ((Rune)'⟦', glyph);
  17. ThrowOnJsonErrors = true;
  18. // act
  19. var json = """
  20. {
  21. "Themes": [
  22. {
  23. "Default":
  24. {
  25. "Glyphs.LeftBracket": "["
  26. }
  27. }
  28. ]
  29. }
  30. """;
  31. Settings!.Update (json, "Overrides_Defaults", ConfigLocations.Runtime);
  32. Apply();
  33. // assert
  34. glyph = glyph = (Rune)Themes ["Default"] ["Glyphs.LeftBracket"].PropertyValue;
  35. Assert.Equal ((Rune)'[', glyph);
  36. Assert.Equal((Rune)'[', Glyphs.LeftBracket);
  37. // clean up
  38. Reset ();
  39. }
  40. }