Snapshot for release 2026.10.27.1 (internal bf8b2f3)

This commit is contained in:
Tom Bohar 2026-10-27 08:41:02 -04:00
commit c68e251cd6
9 changed files with 116 additions and 101 deletions

View file

@ -113,9 +113,10 @@ internal static class AelrynthTests
ServerPackInfo info = new("aelrynth", "Aelrynth", new[] { "aelrynth.com" }, new[] { "Aelrynth*", "Aeshnidae*" });
SectionManifest m = SectionManifestParser.Parse("RynthAelrynth", ServerPackModel.BuildSectionsJson(info, "RynthAelrynth", pages), out string error);
Check.Eq(error, "", "RynthCore parses the manifest");
SectionContribution view = m.Contributions.Single(c => c.Primary);
Check.True(view.Server == "aelrynth" && view.Label == "Leaderboards" && view.Surface == "section:server-aelrynth.boards",
"Leaderboards, only while Aelrynth is active");
SectionWindowDecl window = m.Windows.Single();
Check.True(window.Title == "Aelrynth" && window.Bar && window.Server == "aelrynth" && window.Surface == "window:server",
"the Aelrynth window on the bar (its Leaderboards a tab in it), only while Aelrynth is active");
Check.Eq(m.Contributions.Length, 0, "nothing in the Mini Remote");
}
/// <summary>

View file

@ -208,9 +208,9 @@ internal static class ConquestTests
ServerPackInfo info = new("conquest", "Conquest", new[] { "acconquest.ddns.net" }, new[] { "Conquest", "ConquestAC" });
SectionManifest m = SectionManifestParser.Parse("RynthConquest", ServerPackModel.BuildSectionsJson(info, "RynthConquest", pages), out string error);
Check.Eq(error, "", "RynthCore parses the manifest");
SectionContribution[] views = m.Contributions.Where(c => c.Primary).ToArray();
Check.Eq(views.Length, 2, "two pages in the Mini Remote");
Check.True(views.All(c => c.Server == "conquest"), "shown only while Conquest is active");
Check.True(views.Select(c => c.Surface).SequenceEqual(new[] { "section:server-conquest.main", "section:server-conquest.boards" }), "their surfaces");
SectionWindowDecl window = m.Windows.Single();
Check.True(window.Title == "Conquest" && window.Bar && window.Server == "conquest",
"the Conquest window on the bar (Conquest and Leaderboards are tabs in it), only while Conquest is active");
Check.Eq(m.Contributions.Length, 0, "nothing in the Mini Remote");
}
}

View file

@ -81,24 +81,16 @@ internal static class ServerPackHooksTests
string json = ServerPackModel.BuildSectionsJson(info, "RynthConquest", pages);
SectionManifest m = SectionManifestParser.Parse("RynthConquest", json, out string error);
Check.Eq(error, "", "RynthCore parses it");
Check.Eq(m.Contributions.Length, 3, "the card and two pages");
SectionContribution card = m.Contributions.Single(c => !c.Primary);
Check.Eq(card.Surface, "section:server-conquest", "the card keeps its surface");
SectionContribution[] views = m.Contributions.Where(c => c.Primary).ToArray();
Check.True(views.All(c => c.Section == ServerPackModel.SectionId && c.Server == "conquest" && c.IsSurface),
"pages: primary views of the Server section, only on Conquest");
Check.Eq(views[0].Surface, "section:server-conquest.main", "page surface");
Check.Eq(views[0].Label, "Conquest", "page label");
Check.Eq(views[0].Tooltip, "Bank, augs and more", "page tooltip");
Check.Eq(views[1].Tooltip, "Leaderboards (RynthConquest)", "a default tooltip");
Check.True(views[0].Order < views[1].Order, "pages keep their order");
Check.True(views[0].Width > 0 && views[0].Height > 0, "pages say their size");
// Tom 10-24: the card and the pages are one window on RynthCore's bar (pages are its tabs), not Mini Remote sub-tabs.
Check.Eq(m.Contributions.Length, 0, "nothing in the Mini Remote");
SectionWindowDecl window = m.Windows.Single();
Check.True(window.Title == "Conquest" && window.Bar && window.Server == "conquest" && window.Surface == ServerPackModel.WindowSurface,
"one window named for the server, with a bar button, only on Conquest");
Check.True(window.Icon == ServerPackModel.WindowIcon && window.Width >= ServerPackPages.Width && window.Height > 0, "its icon and a size that fits the tabs");
// Without pages the manifest is byte for byte what it was.
Check.Eq(ServerPackModel.BuildSectionsJson(info, "RynthConquest", null), ServerPackModel.BuildSectionsJson(info, "RynthConquest"),
"no pages: the old manifest");
Check.Eq(SectionManifestParser.Parse("x", ServerPackModel.BuildSectionsJson(info, "RynthConquest"), out _).Contributions.Length, 1,
"no pages: only the card");
// Without pages: the same window, narrower (the card alone).
SectionWindowDecl alone = SectionManifestParser.Parse("x", ServerPackModel.BuildSectionsJson(info, "RynthConquest"), out _).Windows.Single();
Check.True(alone.Title == "Conquest" && alone.Width < window.Width, "no pages: the card's window");
}
private static void SettingsRoundTrip()

View file

@ -204,14 +204,13 @@ internal static class ServerPackModelTests
Check.Eq(server.GetProperty("id").GetString(), "coldeve", "server id lower-cased");
Check.Eq(server.GetProperty("hosts")[0].GetString(), "play.coldeve.ac", "hosts");
Check.Eq(server.GetProperty("worldNames")[0].GetString(), "Coldeve", "world names");
JsonElement card = root.GetProperty("contributions")[0];
Check.Eq(card.GetProperty("section").GetString(), "server", "in the Server section (not Session Stats)");
JsonElement section = root.GetProperty("sections")[0];
Check.Eq(section.GetProperty("id").GetString(), "server", "the Server section is declared");
Check.Eq(section.GetProperty("label").GetString(), "Server", "its label");
Check.Eq(section.GetProperty("order").GetInt32(), 50, "after Session Stats, before Map");
Check.Eq(card.GetProperty("server").GetString(), "coldeve", "only while Coldeve is active");
Check.Eq(card.GetProperty("surface").GetString(), "section:server-coldeve", "the card's surface");
// Tom 10-24: every server its own spot on RynthCore's bar, not mixed in with the rest.
Check.False(root.TryGetProperty("contributions", out _) || root.TryGetProperty("sections", out _), "nothing in the Mini Remote");
JsonElement window = root.GetProperty("windows")[0];
Check.Eq(window.GetProperty("title").GetString(), "Coldeve", "its own window, named for the server");
Check.True(window.GetProperty("bar").GetBoolean(), "with a button on the bar");
Check.Eq(window.GetProperty("server").GetString(), "coldeve", "only while Coldeve is active");
Check.Eq(window.GetProperty("surface").GetString(), "window:server", "drawn by the plugin");
var quoted = new ServerPackInfo("odd", "Odd \"Name\"\n", new[] { "a\\b" }, Array.Empty<string>());
using JsonDocument odd = JsonDocument.Parse(ServerPackModel.BuildSectionsJson(quoted, "RynthOdd"));