User-gate round 3 findings (a)-(c):
(a) SpewBox: TopOffset moves from the round-1 60px placeholder to 0 (flush
to the viewport top). SpewBoxController never wired DatFont/Font at all
before this round, so it silently rendered through the 15px debug
BitmapFont fallback; it now resolves retail dat Font 0x40000025
(MaxCharHeight=11px) through a new RetailUiRuntime.Assets accessor —
the smallest font id confirmed in use by any currently-imported retail
LayoutDesc fixture, cross-referenced against every
tests/AcDream.App.Tests/UI/Layout/fixtures/*.json dump and confirmed
against the installed DAT via AcDream.Cli dump-font-atlas. It is also the
chat window's own smallest font (the 0x2100006F floating-window 1/2/3/4
indicator badges), so both selection criteria the brief offered agree.
Both remain best-available approximations, not resolved retail values —
register row AP-178 updated accordingly.
(b)/(c) /help and /help death: round 2 extracted the individual retail
strings byte-exact but never traced ClientCommunicationSystem::DoHelp's
complete print sequence. Byte-swept DoHelp's own range plus the five
Summary-branch functions it calls into (HelpEmote/HelpSquelch/
HelpStatusGroup/HelpTextGroup/HelpAllGroup) against the PDB-paired
acclient.exe. Retail's real shape: bare /help prints exactly TWO scroll
entries (HelpPrefixNote, then the 13-item AvailableHelpListing built from
DoHelp's own literals and each group's Summary_HelpType branch, in exact
source order) — not the acdream-invented cheat sheet BuildHelpText()
built before. Any resolved /help <verb> gets the SAME two-entry shape:
HelpPrefixNote, then ForMoreInformationPrefix concatenated directly onto
the verb's own Detail text (retail's own unsubstituted "<command>"
literal, ported verbatim). ChatCommandRouter.EmitVerbHelp applies this
uniformly to every resolved verb, not just death. An unresolved verb now
shows retail's real "Unknown command" fallback text; that fallback types
0x1A (ClientLocal), which retail routes to the SpewBox exclusively — a
gap ChatVM's UI.Abstractions layer can't yet reach, filed as ISSUES #367
/ register AP-186 rather than left silently unregistered.
Jump-in-air (round 2's open item 1) was root-caused and fixed separately
at a5a7eb4f between rounds — recorded in the campaign ledger.
Debug suite (all projects): 12,329 passed / 4 skipped / 1 failed — the
one failure is issue #351, a pre-existing Debug-only streaming flake
confirmed reproducing identically on the pristine pre-round-3 commit via
git stash, not a regression. Release verification covers every project
reachable without rebuilding AcDream.App: a live client process (PID
15064) held its own Release binaries locked for the session and was not
killed per project policy — AcDream.UI.Abstractions.Tests (867/867, the
layer both /help fixes live in) plus every other non-App-dependent
project, all 0 failed. AcDream.App/AcDream.App.Tests/AcDream.Core.Tests
(the SpewBox fix's layer) are green in Debug only this session.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
358 lines
12 KiB
C#
358 lines
12 KiB
C#
using AcDream.Core.Chat;
|
|
using AcDream.UI.Abstractions.Panels.Chat;
|
|
|
|
namespace AcDream.UI.Abstractions.Tests.Panels.Chat;
|
|
|
|
/// <summary>
|
|
/// Phase I.4: when the user submits text via the chat input field, the
|
|
/// panel must publish the appropriate typed intent to the command bus.
|
|
/// We exercise the full Render path with the <see cref="FakePanelRenderer"/>
|
|
/// pre-loading a "submitted" string and a recording bus capturing the
|
|
/// resulting command.
|
|
/// </summary>
|
|
public sealed class ChatPanelInputTests
|
|
{
|
|
private sealed class RecordingBus : ICommandBus
|
|
{
|
|
public List<object> Published { get; } = new();
|
|
public void Publish<T>(T command) where T : notnull => Published.Add(command);
|
|
}
|
|
|
|
[Fact]
|
|
public void Submit_HelpCommand_RendersLocalHelpAndDoesNotPublish()
|
|
{
|
|
// Phase J follow-up: client-side commands (/help, /?, /h) are
|
|
// intercepted before the parser. They render local text via
|
|
// ChatLog.OnSystemMessage and do NOT round-trip the server — that's
|
|
// what prevented the "Unknown command: help" duplicate ACE was
|
|
// firing back.
|
|
//
|
|
// Campaign CH user-gate round 3 (2026-08-10): retail's DoHelp
|
|
// prints via exactly TWO scroll entries (Note, then the 13-item
|
|
// "Available help:" listing), never one acdream-invented blob — see
|
|
// RetailCommandHelpTable's class remarks for the full trace.
|
|
var log = new ChatLog();
|
|
var vm = new ChatVM(log);
|
|
var panel = new ChatPanel(vm);
|
|
var bus = new RecordingBus();
|
|
var renderer = new FakePanelRenderer
|
|
{
|
|
InputTextSubmitNextSubmitted = "/help",
|
|
InputTextSubmitNextBufferAfter = "",
|
|
};
|
|
|
|
panel.Render(new PanelContext(0.016f, bus), renderer);
|
|
|
|
Assert.Empty(bus.Published);
|
|
var entries = log.Snapshot();
|
|
Assert.Equal(2, entries.Length);
|
|
Assert.All(entries, entry => Assert.Equal(ChatKind.System, entry.Kind));
|
|
Assert.Equal(AcDream.UI.Abstractions.Panels.Chat.RetailCommandHelpTable.HelpPrefixNote, entries[0].Text);
|
|
Assert.Equal(AcDream.UI.Abstractions.Panels.Chat.RetailCommandHelpTable.AvailableHelpListing, entries[1].Text);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("/?")]
|
|
// "/h" is DELETED (Campaign CH slice CH4, 2026-08-09) — it is not a
|
|
// retail-registered verb (registry doc §4's removal list).
|
|
[InlineData("/HELP")]
|
|
public void Submit_HelpAliases_AlsoRenderLocalHelp(string raw)
|
|
{
|
|
var log = new ChatLog();
|
|
var vm = new ChatVM(log);
|
|
var panel = new ChatPanel(vm);
|
|
var bus = new RecordingBus();
|
|
var renderer = new FakePanelRenderer
|
|
{
|
|
InputTextSubmitNextSubmitted = raw,
|
|
InputTextSubmitNextBufferAfter = "",
|
|
};
|
|
|
|
panel.Render(new PanelContext(0.016f, bus), renderer);
|
|
|
|
Assert.Empty(bus.Published);
|
|
Assert.Equal(2, log.Snapshot().Length);
|
|
}
|
|
|
|
[Fact]
|
|
public void Submit_FramerateCommand_PublishesTypedClientCommand()
|
|
{
|
|
var log = new ChatLog();
|
|
var vm = new ChatVM(log) { FpsProvider = () => 60f };
|
|
var panel = new ChatPanel(vm);
|
|
var bus = new RecordingBus();
|
|
var renderer = new FakePanelRenderer
|
|
{
|
|
InputTextSubmitNextSubmitted = "/framerate",
|
|
InputTextSubmitNextBufferAfter = "",
|
|
};
|
|
|
|
panel.Render(new PanelContext(0.016f, bus), renderer);
|
|
|
|
var command = Assert.IsType<ExecuteClientCommandCmd>(Assert.Single(bus.Published));
|
|
Assert.Equal(ClientCommandId.ToggleFrameRate, command.Command);
|
|
Assert.Empty(log.Snapshot());
|
|
}
|
|
|
|
[Fact]
|
|
public void Submit_LocCommand_PublishesTypedClientCommand()
|
|
{
|
|
var log = new ChatLog();
|
|
var vm = new ChatVM(log)
|
|
{
|
|
PositionProvider = () => new System.Numerics.Vector3(10f, 20f, 30f),
|
|
};
|
|
var panel = new ChatPanel(vm);
|
|
var bus = new RecordingBus();
|
|
var renderer = new FakePanelRenderer
|
|
{
|
|
InputTextSubmitNextSubmitted = "@loc",
|
|
InputTextSubmitNextBufferAfter = "",
|
|
};
|
|
|
|
panel.Render(new PanelContext(0.016f, bus), renderer);
|
|
|
|
var command = Assert.IsType<ExecuteClientCommandCmd>(Assert.Single(bus.Published));
|
|
Assert.Equal(ClientCommandId.ShowLocation, command.Command);
|
|
Assert.Empty(log.Snapshot());
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("/foo", "@foo")]
|
|
[InlineData("/genio public", "@genio public")]
|
|
public void Submit_UnknownSlashCommand_RoutesToExplicitServerCommand(string raw, string expectedText)
|
|
{
|
|
// Phase J Tier 4 held: /-prefixed text is still NEVER broadcast
|
|
// as plain speech. Retail treats / and @ as equivalent command
|
|
// prefixes, so unknown verbs now go to the SERVER as @commands
|
|
// (ACE's GameActionTalk intercepts @ on the Say action and
|
|
// answers "Unknown command: x" itself) instead of a local guess.
|
|
var log = new ChatLog();
|
|
var vm = new ChatVM(log);
|
|
var panel = new ChatPanel(vm);
|
|
var bus = new RecordingBus();
|
|
var renderer = new FakePanelRenderer
|
|
{
|
|
InputTextSubmitNextSubmitted = raw,
|
|
InputTextSubmitNextBufferAfter = "",
|
|
};
|
|
|
|
panel.Render(new PanelContext(0.016f, bus), renderer);
|
|
|
|
var sendCmd = Assert.IsType<SendServerCommandCmd>(Assert.Single(bus.Published));
|
|
Assert.Equal(expectedText, sendCmd.Text);
|
|
Assert.Empty(log.Snapshot()); // no local "Unknown command" guess
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("/lifestone")]
|
|
[InlineData("/lif")]
|
|
[InlineData("/ls")]
|
|
[InlineData("@LS")]
|
|
public void Submit_LifestoneAlias_PublishesTypedClientCommand(string raw)
|
|
{
|
|
var vm = new ChatVM(new ChatLog());
|
|
var panel = new ChatPanel(vm);
|
|
var bus = new RecordingBus();
|
|
var renderer = new FakePanelRenderer
|
|
{
|
|
InputTextSubmitNextSubmitted = raw,
|
|
InputTextSubmitNextBufferAfter = "",
|
|
};
|
|
|
|
panel.Render(new PanelContext(0.016f, bus), renderer);
|
|
|
|
var command = Assert.IsType<ExecuteClientCommandCmd>(Assert.Single(bus.Published));
|
|
Assert.Equal(ClientCommandId.LifestoneRecall, command.Command);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData("/")]
|
|
[InlineData("//shrug")]
|
|
public void Submit_CommandShapedWithoutVerb_ShowsUnknownAndDoesNotPublish(string raw)
|
|
{
|
|
// Command-shaped but no letter verb: refused locally — this is
|
|
// the remaining Tier-4 guard (never broadcast /-text as speech,
|
|
// and don't put junk @-rewrites on the wire either).
|
|
var log = new ChatLog();
|
|
var vm = new ChatVM(log);
|
|
var panel = new ChatPanel(vm);
|
|
var bus = new RecordingBus();
|
|
var renderer = new FakePanelRenderer
|
|
{
|
|
InputTextSubmitNextSubmitted = raw,
|
|
InputTextSubmitNextBufferAfter = "",
|
|
};
|
|
|
|
panel.Render(new PanelContext(0.016f, bus), renderer);
|
|
|
|
Assert.Empty(bus.Published);
|
|
var entry = Assert.Single(log.Snapshot());
|
|
Assert.Equal(ChatKind.System, entry.Kind);
|
|
Assert.Contains("Unknown command", entry.Text);
|
|
Assert.Contains("/help", entry.Text);
|
|
}
|
|
|
|
[Fact]
|
|
public void Submit_AtAcehelp_PublishesExplicitServerCommand()
|
|
{
|
|
// Unknown @-verb falls through to the default channel with the
|
|
// literal "@acehelp" text intact so ACE's CommandManager
|
|
// intercepts it server-side. The explicit server-command record keeps
|
|
// it distinct from ordinary Say text.
|
|
var log = new ChatLog();
|
|
var vm = new ChatVM(log);
|
|
var panel = new ChatPanel(vm);
|
|
var bus = new RecordingBus();
|
|
var renderer = new FakePanelRenderer
|
|
{
|
|
InputTextSubmitNextSubmitted = "@acehelp",
|
|
InputTextSubmitNextBufferAfter = "",
|
|
};
|
|
|
|
panel.Render(new PanelContext(0.016f, bus), renderer);
|
|
|
|
var sendCmd = Assert.IsType<SendServerCommandCmd>(Assert.Single(bus.Published));
|
|
Assert.Equal("@acehelp", sendCmd.Text);
|
|
}
|
|
|
|
[Fact]
|
|
public void Submit_ClearCommand_PublishesTypedClientCommand()
|
|
{
|
|
var log = new ChatLog();
|
|
log.OnSystemMessage("seed line", chatType: 0);
|
|
var vm = new ChatVM(log);
|
|
var panel = new ChatPanel(vm);
|
|
var bus = new RecordingBus();
|
|
var renderer = new FakePanelRenderer
|
|
{
|
|
InputTextSubmitNextSubmitted = "/clear",
|
|
InputTextSubmitNextBufferAfter = "",
|
|
};
|
|
|
|
panel.Render(new PanelContext(0.016f, bus), renderer);
|
|
|
|
var command = Assert.IsType<ExecuteClientCommandCmd>(Assert.Single(bus.Published));
|
|
Assert.Equal(ClientCommandId.ClearChat, command.Command);
|
|
Assert.Single(log.Snapshot());
|
|
}
|
|
|
|
[Fact]
|
|
public void Submit_PlainText_PublishesSayCommand()
|
|
{
|
|
var log = new ChatLog();
|
|
var vm = new ChatVM(log);
|
|
var panel = new ChatPanel(vm);
|
|
var bus = new RecordingBus();
|
|
var renderer = new FakePanelRenderer
|
|
{
|
|
InputTextSubmitNextSubmitted = "hello world",
|
|
InputTextSubmitNextBufferAfter = "",
|
|
};
|
|
|
|
panel.Render(new PanelContext(0.016f, bus), renderer);
|
|
|
|
var cmd = Assert.Single(bus.Published);
|
|
var sendCmd = Assert.IsType<SendChatCmd>(cmd);
|
|
Assert.Equal(ChatChannelKind.Say, sendCmd.Channel);
|
|
Assert.Null(sendCmd.TargetName);
|
|
Assert.Equal("hello world", sendCmd.Text);
|
|
}
|
|
|
|
[Fact]
|
|
public void Submit_TellSlashCommand_PublishesTellCommand()
|
|
{
|
|
var log = new ChatLog();
|
|
var vm = new ChatVM(log);
|
|
var panel = new ChatPanel(vm);
|
|
var bus = new RecordingBus();
|
|
var renderer = new FakePanelRenderer
|
|
{
|
|
InputTextSubmitNextSubmitted = "/t Bestie ping",
|
|
InputTextSubmitNextBufferAfter = "",
|
|
};
|
|
|
|
panel.Render(new PanelContext(0.016f, bus), renderer);
|
|
|
|
var sendCmd = Assert.IsType<SendChatCmd>(Assert.Single(bus.Published));
|
|
Assert.Equal(ChatChannelKind.Tell, sendCmd.Channel);
|
|
Assert.Equal("Bestie", sendCmd.TargetName);
|
|
Assert.Equal("ping", sendCmd.Text);
|
|
}
|
|
|
|
[Fact]
|
|
public void Submit_ReplySlashCommand_UsesLastIncomingTellSender()
|
|
{
|
|
var log = new ChatLog();
|
|
var vm = new ChatVM(log);
|
|
log.OnTellReceived("Bestie", "ping", senderGuid: 0x5000_00AAu, logTextType: 0x03u);
|
|
|
|
var panel = new ChatPanel(vm);
|
|
var bus = new RecordingBus();
|
|
var renderer = new FakePanelRenderer
|
|
{
|
|
InputTextSubmitNextSubmitted = "/r back at you",
|
|
InputTextSubmitNextBufferAfter = "",
|
|
};
|
|
|
|
panel.Render(new PanelContext(0.016f, bus), renderer);
|
|
|
|
var sendCmd = Assert.IsType<SendChatCmd>(Assert.Single(bus.Published));
|
|
Assert.Equal(ChatChannelKind.Tell, sendCmd.Channel);
|
|
Assert.Equal("Bestie", sendCmd.TargetName);
|
|
Assert.Equal("back at you", sendCmd.Text);
|
|
}
|
|
|
|
[Fact]
|
|
public void Submit_EmptyOrWhitespace_PublishesNothing()
|
|
{
|
|
var log = new ChatLog();
|
|
var vm = new ChatVM(log);
|
|
var panel = new ChatPanel(vm);
|
|
var bus = new RecordingBus();
|
|
var renderer = new FakePanelRenderer
|
|
{
|
|
InputTextSubmitNextSubmitted = " ",
|
|
InputTextSubmitNextBufferAfter = "",
|
|
};
|
|
|
|
panel.Render(new PanelContext(0.016f, bus), renderer);
|
|
|
|
Assert.Empty(bus.Published);
|
|
}
|
|
|
|
[Fact]
|
|
public void NoSubmit_PublishesNothing()
|
|
{
|
|
// Most frames: user is typing or idle; submitted == null.
|
|
var log = new ChatLog();
|
|
var vm = new ChatVM(log);
|
|
var panel = new ChatPanel(vm);
|
|
var bus = new RecordingBus();
|
|
var renderer = new FakePanelRenderer
|
|
{
|
|
InputTextSubmitNextSubmitted = null,
|
|
};
|
|
|
|
panel.Render(new PanelContext(0.016f, bus), renderer);
|
|
|
|
Assert.Empty(bus.Published);
|
|
}
|
|
|
|
[Fact]
|
|
public void Render_AlwaysCallsInputTextSubmit_ToShowTheField()
|
|
{
|
|
var log = new ChatLog();
|
|
var vm = new ChatVM(log);
|
|
var panel = new ChatPanel(vm);
|
|
var bus = new RecordingBus();
|
|
var renderer = new FakePanelRenderer
|
|
{
|
|
InputTextSubmitNextSubmitted = null,
|
|
};
|
|
|
|
panel.Render(new PanelContext(0.016f, bus), renderer);
|
|
|
|
Assert.Contains(renderer.Calls, c => c.Method == "InputTextSubmit");
|
|
}
|
|
}
|