mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
* Fixes #2629 * Fixed broken unit tests (which were already broken but latent) * Removed test code
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -7,6 +7,10 @@ namespace Terminal.Gui {
|
||||
class DictionaryJsonConverter<T> : JsonConverter<Dictionary<string, T>> {
|
||||
public override Dictionary<string, T> Read (ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
if (reader.TokenType != JsonTokenType.StartArray) {
|
||||
throw new JsonException ($"Expected a JSON array (\"[ {{ ... }} ]\"), but got \"{reader.TokenType}\".");
|
||||
}
|
||||
|
||||
var dictionary = new Dictionary<string, T> ();
|
||||
while (reader.Read ()) {
|
||||
if (reader.TokenType == JsonTokenType.StartObject) {
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace Terminal.Gui {
|
||||
public override scopeT Read (ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
if (reader.TokenType != JsonTokenType.StartObject) {
|
||||
throw new JsonException ($"Expected a JSON object, but got \"{reader.TokenType}\".");
|
||||
throw new JsonException ($"Expected a JSON object (\"{{ \"propName\" : ... }}\"), but got \"{reader.TokenType}\".");
|
||||
}
|
||||
|
||||
var scope = (scopeT)Activator.CreateInstance (typeof (scopeT))!;
|
||||
|
||||
@@ -11,6 +11,11 @@
|
||||
// null).
|
||||
//
|
||||
"$schema": "https://gui-cs.github.io/Terminal.Gui/schemas/tui-config-schema.json",
|
||||
|
||||
// Set this to true in a .config file to be loaded to cause JSON parsing errors
|
||||
// to throw exceptions.
|
||||
"ConfigurationManager.ThrowOnJsonErrors": false,
|
||||
|
||||
"Application.AlternateBackwardKey": {
|
||||
"Key": "PageUp",
|
||||
"Modifiers": [
|
||||
|
||||
@@ -544,8 +544,7 @@ namespace Terminal.Gui.ConfigurationTests {
|
||||
// "yellow" is not a color
|
||||
string json = @"
|
||||
{
|
||||
""Themes"" : {
|
||||
""ThemeDefinitions"" : [
|
||||
""Themes"" : [
|
||||
{
|
||||
""Default"" : {
|
||||
""ColorSchemes"": [
|
||||
@@ -560,8 +559,7 @@ namespace Terminal.Gui.ConfigurationTests {
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}";
|
||||
|
||||
JsonException jsonException = Assert.Throws<JsonException> (() => ConfigurationManager.Settings.Update (json, "test"));
|
||||
@@ -570,8 +568,7 @@ namespace Terminal.Gui.ConfigurationTests {
|
||||
// AbNormal is not a ColorScheme attribute
|
||||
json = @"
|
||||
{
|
||||
""Themes"" : {
|
||||
""ThemeDefinitions"" : [
|
||||
""Themes"" : [
|
||||
{
|
||||
""Default"" : {
|
||||
""ColorSchemes"": [
|
||||
@@ -586,8 +583,7 @@ namespace Terminal.Gui.ConfigurationTests {
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}";
|
||||
|
||||
jsonException = Assert.Throws<JsonException> (() => ConfigurationManager.Settings.Update (json, "test"));
|
||||
@@ -596,8 +592,7 @@ namespace Terminal.Gui.ConfigurationTests {
|
||||
// Modify hotNormal background only
|
||||
json = @"
|
||||
{
|
||||
""Themes"" : {
|
||||
""ThemeDefinitions"" : [
|
||||
""Themes"" : [
|
||||
{
|
||||
""Default"" : {
|
||||
""ColorSchemes"": [
|
||||
@@ -611,8 +606,7 @@ namespace Terminal.Gui.ConfigurationTests {
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}";
|
||||
|
||||
jsonException = Assert.Throws<JsonException> (() => ConfigurationManager.Settings.Update (json, "test"));
|
||||
@@ -641,8 +635,7 @@ namespace Terminal.Gui.ConfigurationTests {
|
||||
// "yellow" is not a color
|
||||
string json = @"
|
||||
{
|
||||
""Themes"" : {
|
||||
""ThemeDefinitions"" : [
|
||||
""Themes"" : [
|
||||
{
|
||||
""Default"" : {
|
||||
""ColorSchemes"": [
|
||||
@@ -657,7 +650,6 @@ namespace Terminal.Gui.ConfigurationTests {
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}";
|
||||
|
||||
@@ -666,8 +658,7 @@ namespace Terminal.Gui.ConfigurationTests {
|
||||
// AbNormal is not a ColorScheme attribute
|
||||
json = @"
|
||||
{
|
||||
""Themes"" : {
|
||||
""ThemeDefinitions"" : [
|
||||
""Themes"" : [
|
||||
{
|
||||
""Default"" : {
|
||||
""ColorSchemes"": [
|
||||
@@ -682,7 +673,6 @@ namespace Terminal.Gui.ConfigurationTests {
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}";
|
||||
|
||||
@@ -691,8 +681,7 @@ namespace Terminal.Gui.ConfigurationTests {
|
||||
// Modify hotNormal background only
|
||||
json = @"
|
||||
{
|
||||
""Themes"" : {
|
||||
""ThemeDefinitions"" : [
|
||||
""Themes"" : [
|
||||
{
|
||||
""Default"" : {
|
||||
""ColorSchemes"": [
|
||||
@@ -706,7 +695,6 @@ namespace Terminal.Gui.ConfigurationTests {
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user