Merge pull request #1101 from MidoriKami/master

This commit is contained in:
goat 2023-02-02 22:34:13 +01:00 committed by GitHub
commit 0215af2ad2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 257 additions and 0 deletions

View file

@ -0,0 +1,52 @@
using Dalamud.Game.DutyState;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
/// <summary>
/// Test setup for the DutyState service class.
/// </summary>
internal class DutyStateAgingStep : IAgingStep
{
private bool subscribed = false;
private bool hasPassed = false;
/// <inheritdoc/>
public string Name => "Test DutyState";
/// <inheritdoc/>
public SelfTestStepResult RunStep()
{
var dutyState = Service<DutyState>.Get();
ImGui.Text("Enter a duty now...");
if (!this.subscribed)
{
dutyState.DutyStarted += this.DutyStateOnDutyStarted;
this.subscribed = true;
}
if (this.hasPassed)
{
dutyState.DutyStarted -= this.DutyStateOnDutyStarted;
this.subscribed = false;
return SelfTestStepResult.Pass;
}
return SelfTestStepResult.Waiting;
}
/// <inheritdoc/>
public void CleanUp()
{
var dutyState = Service<DutyState>.Get();
dutyState.DutyStarted -= this.DutyStateOnDutyStarted;
}
private void DutyStateOnDutyStarted(object? sender, ushort e)
{
this.hasPassed = true;
}
}

View file

@ -41,6 +41,7 @@ internal class SelfTestWindow : Window
new LuminaAgingStep<TerritoryType>(),
new PartyFinderAgingStep(),
new HandledExceptionAgingStep(),
new DutyStateAgingStep(),
new LogoutEventAgingStep(),
};