mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-30 12:23:39 +01:00
Add Completion module (#2274)
* Add Completion module Dalamud and plugin commands will now be tab-completable in the ChatLog * PR feedback --------- Co-authored-by: goat <16760685+goaaats@users.noreply.github.com>
This commit is contained in:
parent
944c3700db
commit
84d121c7bc
4 changed files with 438 additions and 4 deletions
|
|
@ -57,7 +57,8 @@ internal class SelfTestWindow : Window
|
|||
new SheetRedirectResolverSelfTestStep(),
|
||||
new NounProcessorSelfTestStep(),
|
||||
new SeStringEvaluatorSelfTestStep(),
|
||||
new LogoutEventSelfTestStep()
|
||||
new LogoutEventSelfTestStep(),
|
||||
new CompletionSelfTestStep()
|
||||
];
|
||||
|
||||
private readonly Dictionary<int, (SelfTestStepResult Result, TimeSpan? Duration)> testIndexToResult = new();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,94 @@
|
|||
using Dalamud.Game.Command;
|
||||
using Dalamud.Game.Gui;
|
||||
using Dalamud.Game.Text;
|
||||
using Dalamud.Game.Text.SeStringHandling;
|
||||
|
||||
using ImGuiNET;
|
||||
|
||||
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
|
||||
|
||||
/// <summary>
|
||||
/// Test setup for Chat.
|
||||
/// </summary>
|
||||
internal class CompletionSelfTestStep : ISelfTestStep
|
||||
{
|
||||
private int step = 0;
|
||||
private bool registered;
|
||||
private bool commandRun;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public string Name => "Test Completion";
|
||||
|
||||
/// <inheritdoc/>
|
||||
public SelfTestStepResult RunStep()
|
||||
{
|
||||
var cmdManager = Service<CommandManager>.Get();
|
||||
switch (this.step)
|
||||
{
|
||||
case 0:
|
||||
this.step++;
|
||||
|
||||
break;
|
||||
|
||||
case 1:
|
||||
ImGui.Text("[Chat Log]");
|
||||
ImGui.Text("Use the category menus to navigate to [Dalamud], then complete a command from the list. Did it work?");
|
||||
if (ImGui.Button("Yes"))
|
||||
this.step++;
|
||||
ImGui.SameLine();
|
||||
|
||||
if (ImGui.Button("No"))
|
||||
return SelfTestStepResult.Fail;
|
||||
break;
|
||||
case 2:
|
||||
ImGui.Text("[Chat Log]");
|
||||
ImGui.Text("Type /xl into the chat log and tab-complete a dalamud command. Did it work?");
|
||||
|
||||
if (ImGui.Button("Yes"))
|
||||
this.step++;
|
||||
ImGui.SameLine();
|
||||
|
||||
if (ImGui.Button("No"))
|
||||
return SelfTestStepResult.Fail;
|
||||
|
||||
break;
|
||||
|
||||
case 3:
|
||||
ImGui.Text("[Chat Log]");
|
||||
if (!this.registered)
|
||||
{
|
||||
cmdManager.AddHandler("/xlselftestcompletion", new CommandInfo((_, _) => this.commandRun = true));
|
||||
this.registered = true;
|
||||
}
|
||||
|
||||
ImGui.Text("Tab-complete /xlselftestcompletion in the chat log and send the command");
|
||||
|
||||
if (this.commandRun)
|
||||
this.step++;
|
||||
|
||||
break;
|
||||
|
||||
case 4:
|
||||
ImGui.Text("[Other text inputs]");
|
||||
ImGui.Text("Open the party finder recruitment criteria dialog and try to tab-complete /xldev in the text box.");
|
||||
ImGui.Text("Did the command appear in the text box? (It should not have)");
|
||||
if (ImGui.Button("Yes"))
|
||||
return SelfTestStepResult.Fail;
|
||||
ImGui.SameLine();
|
||||
|
||||
if (ImGui.Button("No"))
|
||||
this.step++;
|
||||
break;
|
||||
case 5:
|
||||
return SelfTestStepResult.Pass;
|
||||
}
|
||||
|
||||
return SelfTestStepResult.Waiting;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void CleanUp()
|
||||
{
|
||||
Service<CommandManager>.Get().RemoveHandler("/completionselftest");
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue