GlyphTests.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using System.Reflection;
  2. using System.Text;
  3. using System.Text.Json;
  4. using static Terminal.Gui.Configuration.ConfigurationManager;
  5. namespace Terminal.Gui.ConfigurationTests;
  6. public class GlyphTests
  7. {
  8. [Fact]
  9. public void Apply_Applies_Over_Defaults ()
  10. {
  11. try
  12. {
  13. // arrange
  14. Enable (ConfigLocations.HardCoded);
  15. Assert.Equal ((Rune)'⟦', Glyphs.LeftBracket);
  16. var glyph = (Rune)ThemeManager.GetCurrentTheme () ["Glyphs.LeftBracket"].PropertyValue!;
  17. Assert.Equal ((Rune)'⟦', glyph);
  18. ThrowOnJsonErrors = true;
  19. // act
  20. RuntimeConfig = """
  21. {
  22. "Themes": [
  23. {
  24. "Default":
  25. {
  26. "Glyphs.LeftBracket": "["
  27. }
  28. }
  29. ]
  30. }
  31. """;
  32. Load (ConfigLocations.Runtime);
  33. Apply ();
  34. // assert
  35. glyph = (Rune)ThemeManager.GetCurrentTheme () ["Glyphs.LeftBracket"].PropertyValue!;
  36. Assert.Equal ((Rune)'[', glyph);
  37. Assert.Equal ((Rune)'[', Glyphs.LeftBracket);
  38. }
  39. finally
  40. {
  41. // clean up
  42. Disable (resetToHardCodedDefaults: true);
  43. }
  44. }
  45. }