RynthChat: pinned tab bookkeeping
ChatPins: pure Toggle/Rename/Remove/Visible over the pinned-tab list (OrdinalIgnoreCase, order = button order). A pin on a hidden tab is kept but not returned by Visible. Tests in tools/ChatFilterTests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
0eec23f6fd
commit
6f26d3f80b
3 changed files with 96 additions and 0 deletions
|
|
@ -39,6 +39,8 @@
|
|||
<!-- 2026-11-15: server default tabs (a plugin manifest chatTabs) and Global room discovery. -->
|
||||
<Compile Include="..\..\src\RynthCore.Engine\UI\Sections\SectionManifest.cs" Link="Engine\SectionManifest.cs" />
|
||||
<Compile Include="..\..\src\RynthCore.Engine\UI\Data\ChatServerTabs.cs" Link="Engine\ChatServerTabs.cs" />
|
||||
<!-- 2026-11-15: pinned tab bookkeeping. -->
|
||||
<Compile Include="..\..\src\RynthCore.Engine\UI\Data\ChatPins.cs" Link="Engine\ChatPins.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ internal static class Program
|
|||
ServerTabSettingsRoundTrip();
|
||||
ServerTabDiscovery();
|
||||
ServerTabPlans();
|
||||
PinBookkeeping();
|
||||
SharedFileReload();
|
||||
LineColorTags();
|
||||
LineColorKinds();
|
||||
|
|
@ -1603,4 +1604,40 @@ internal static class Program
|
|||
Check(ChatFilterPresets.Get("no.such") == null, "an unknown id is null");
|
||||
Check(ChatFilterPresets.All.Length >= 10, "a useful set");
|
||||
}
|
||||
|
||||
// 2026-11-15: pinned tab bookkeeping (ChatPins), pure.
|
||||
private static void PinBookkeeping()
|
||||
{
|
||||
Case("Toggle_AddsAtEndAndRemoves");
|
||||
string[] p = ChatPins.Toggle(Array.Empty<string>(), "Chat");
|
||||
p = ChatPins.Toggle(p, "Network");
|
||||
Check(p.SequenceEqual(new[] { "Chat", "Network" }), "added in pin order");
|
||||
string[] q = ChatPins.Toggle(p, "chat");
|
||||
Check(q.SequenceEqual(new[] { "Network" }), "a differently cased name unpins");
|
||||
Check(p.SequenceEqual(new[] { "Chat", "Network" }), "the input array is not changed");
|
||||
Check(ChatPins.Toggle(q, " ").Length == 1, "a blank name pins nothing");
|
||||
|
||||
Case("Rename_KeepsPosition");
|
||||
string[] r = ChatPins.Rename(new[] { "Chat", "Network", "Trade" }, "network", "DN");
|
||||
Check(r.SequenceEqual(new[] { "Chat", "DN", "Trade" }), "renamed in place");
|
||||
Check(ChatPins.Rename(r, "Nope", "X").SequenceEqual(r), "an unpinned tab changes nothing");
|
||||
string[] merged = ChatPins.Rename(new[] { "A", "B" }, "A", "b");
|
||||
Check(merged.Length == 1 && merged[0] == "b", "a rename onto a pinned name leaves one pin");
|
||||
|
||||
Case("Remove_DropsOnlyThatPin");
|
||||
Check(ChatPins.Remove(new[] { "Chat", "Network" }, "NETWORK").SequenceEqual(new[] { "Chat" }), "removed");
|
||||
Check(ChatPins.Remove(new[] { "Chat" }, "Nope").SequenceEqual(new[] { "Chat" }), "absent = unchanged");
|
||||
|
||||
Case("Visible_SkipsHiddenTabsKeepsPin");
|
||||
string[] pins = { "Network", "Chat" };
|
||||
string[] vis = ChatPins.Visible(pins, new[] { "All", "Chat" });
|
||||
Check(vis.SequenceEqual(new[] { "Chat" }), "the hidden tab is not drawn");
|
||||
Check(pins.SequenceEqual(new[] { "Network", "Chat" }), "the pin is still held");
|
||||
Check(ChatPins.Visible(pins, new[] { "All", "Chat", "network" }).SequenceEqual(new[] { "network", "Chat" }),
|
||||
"back when the server is back, in pin order, as the tab is spelled now");
|
||||
|
||||
Case("Visible_BaseTabsPinnable");
|
||||
Check(ChatPins.Visible(ChatPins.Toggle(Array.Empty<string>(), "All"), new[] { "All", "Chat" }).SequenceEqual(new[] { "All" }), "All");
|
||||
Check(ChatPins.Visible(ChatPins.Toggle(Array.Empty<string>(), "Chat"), new[] { "All", "Chat" }).SequenceEqual(new[] { "Chat" }), "Chat");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue