GlyphTests.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. // arrange
  12. Enable (ConfigLocations.HardCoded);
  13. Assert.Equal ((Rune)'⟦', Glyphs.LeftBracket);
  14. var glyph = (Rune)ThemeManager.GetCurrentTheme () ["Glyphs.LeftBracket"].PropertyValue!;
  15. Assert.Equal ((Rune)'⟦', glyph);
  16. ThrowOnJsonErrors = true;
  17. // act
  18. RuntimeConfig = """
  19. {
  20. "Themes": [
  21. {
  22. "Default":
  23. {
  24. "Glyphs.LeftBracket": "["
  25. }
  26. }
  27. ]
  28. }
  29. """;
  30. Load (ConfigLocations.Runtime);
  31. Apply ();
  32. // assert
  33. glyph = (Rune)ThemeManager.GetCurrentTheme () ["Glyphs.LeftBracket"].PropertyValue!;
  34. Assert.Equal ((Rune)'[', glyph);
  35. Assert.Equal ((Rune)'[', Glyphs.LeftBracket);
  36. // clean up
  37. Disable (resetToHardCodedDefaults: true);
  38. }
  39. }