AgingSteps => SelfTestSteps

This commit is contained in:
goaaats 2025-04-02 22:38:28 +02:00
parent 95bac801b2
commit d2cae32bc2
29 changed files with 108 additions and 108 deletions

View file

@ -4,7 +4,7 @@ using System.Numerics;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Components;
using Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
using Dalamud.Interface.Internal.Windows.SelfTest.Steps;
using Dalamud.Interface.Utility;
using Dalamud.Interface.Windowing;
using Dalamud.Logging.Internal;
@ -20,40 +20,40 @@ internal class SelfTestWindow : Window
{
private static readonly ModuleLog Log = new("AGING");
private readonly List<IAgingStep> steps =
private readonly List<ISelfTestStep> steps =
new()
{
new LoginEventAgingStep(),
new WaitFramesAgingStep(1000),
new EnterTerritoryAgingStep(148, "Central Shroud"),
new ItemPayloadAgingStep(),
new ContextMenuAgingStep(),
new NamePlateAgingStep(),
new ActorTableAgingStep(),
new FateTableAgingStep(),
new AetheryteListAgingStep(),
new ConditionAgingStep(),
new ToastAgingStep(),
new TargetAgingStep(),
new KeyStateAgingStep(),
new GamepadStateAgingStep(),
new ChatAgingStep(),
new HoverAgingStep(),
new LuminaAgingStep<Item>(true),
new LuminaAgingStep<Level>(true),
new LuminaAgingStep<Lumina.Excel.Sheets.Action>(true),
new LuminaAgingStep<Quest>(true),
new LuminaAgingStep<TerritoryType>(false),
new AddonLifecycleAgingStep(),
new PartyFinderAgingStep(),
new HandledExceptionAgingStep(),
new DutyStateAgingStep(),
new GameConfigAgingStep(),
new MarketBoardAgingStep(),
new SheetRedirectResolverAgingStep(),
new NounProcessorAgingStep(),
new SeStringEvaluatorAgingStep(),
new LogoutEventAgingStep(),
new LoginEventSelfTestStep(),
new WaitFramesSelfTestStep(1000),
new EnterTerritorySelfTestStep(148, "Central Shroud"),
new ItemPayloadSelfTestStep(),
new ContextMenuSelfTestStep(),
new NamePlateSelfTestStep(),
new ActorTableSelfTestStep(),
new FateTableSelfTestStep(),
new AetheryteListSelfTestStep(),
new ConditionSelfTestStep(),
new ToastSelfTestStep(),
new TargetSelfTestStep(),
new KeyStateSelfTestStep(),
new GamepadStateSelfTestStep(),
new ChatSelfTestStep(),
new HoverSelfTestStep(),
new LuminaSelfTestStep<Item>(true),
new LuminaSelfTestStep<Level>(true),
new LuminaSelfTestStep<Lumina.Excel.Sheets.Action>(true),
new LuminaSelfTestStep<Quest>(true),
new LuminaSelfTestStep<TerritoryType>(false),
new AddonLifecycleSelfTestStep(),
new PartyFinderSelfTestStep(),
new HandledExceptionSelfTestStep(),
new DutyStateSelfTestStep(),
new GameConfigSelfTestStep(),
new MarketBoardSelfTestStep(),
new SheetRedirectResolverSelfTestStep(),
new NounProcessorSelfTestStep(),
new SeStringEvaluatorSelfTestStep(),
new LogoutEventSelfTestStep(),
};
private readonly List<(SelfTestStepResult Result, TimeSpan? Duration)> stepResults = new();

View file

@ -2,12 +2,12 @@ using Dalamud.Game.ClientState.Objects;
using Dalamud.Utility;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
/// <summary>
/// Test setup for the Actor Table.
/// </summary>
internal class ActorTableAgingStep : IAgingStep
internal class ActorTableSelfTestStep : ISelfTestStep
{
private int index = 0;

View file

@ -5,23 +5,23 @@ using Dalamud.Game.Addon.Lifecycle.AddonArgTypes;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
/// <summary>
/// Test setup AddonLifecycle Service.
/// </summary>
internal class AddonLifecycleAgingStep : IAgingStep
internal class AddonLifecycleSelfTestStep : ISelfTestStep
{
private readonly List<AddonLifecycleEventListener> listeners;
private AddonLifecycle? service;
private TestStep currentStep = TestStep.CharacterRefresh;
private bool listenersRegistered;
/// <summary>
/// Initializes a new instance of the <see cref="AddonLifecycleAgingStep"/> class.
/// Initializes a new instance of the <see cref="AddonLifecycleSelfTestStep"/> class.
/// </summary>
public AddonLifecycleAgingStep()
public AddonLifecycleSelfTestStep()
{
this.listeners = new List<AddonLifecycleEventListener>
{
@ -33,7 +33,7 @@ internal class AddonLifecycleAgingStep : IAgingStep
new(AddonEvent.PreFinalize, "Character", this.PreFinalize),
};
}
private enum TestStep
{
CharacterRefresh,
@ -44,10 +44,10 @@ internal class AddonLifecycleAgingStep : IAgingStep
CharacterFinalize,
Complete,
}
/// <inheritdoc/>
public string Name => "Test AddonLifecycle";
/// <inheritdoc/>
public SelfTestStepResult RunStep()
{
@ -60,7 +60,7 @@ internal class AddonLifecycleAgingStep : IAgingStep
{
this.service.RegisterListener(listener);
}
this.listenersRegistered = true;
}
@ -89,7 +89,7 @@ internal class AddonLifecycleAgingStep : IAgingStep
// Nothing to report to tester.
break;
}
return this.currentStep is TestStep.Complete ? SelfTestStepResult.Pass : SelfTestStepResult.Waiting;
}
@ -101,32 +101,32 @@ internal class AddonLifecycleAgingStep : IAgingStep
this.service?.UnregisterListener(listener);
}
}
private void PostSetup(AddonEvent eventType, AddonArgs addonInfo)
{
{
if (this.currentStep is TestStep.CharacterSetup) this.currentStep++;
}
private void PostUpdate(AddonEvent eventType, AddonArgs addonInfo)
{
if (this.currentStep is TestStep.CharacterUpdate) this.currentStep++;
}
private void PostDraw(AddonEvent eventType, AddonArgs addonInfo)
{
if (this.currentStep is TestStep.CharacterDraw) this.currentStep++;
}
private void PostRefresh(AddonEvent eventType, AddonArgs addonInfo)
{
if (this.currentStep is TestStep.CharacterRefresh) this.currentStep++;
}
private void PostRequestedUpdate(AddonEvent eventType, AddonArgs addonInfo)
{
if (this.currentStep is TestStep.CharacterRequestedUpdate) this.currentStep++;
}
private void PreFinalize(AddonEvent eventType, AddonArgs addonInfo)
{
if (this.currentStep is TestStep.CharacterFinalize) this.currentStep++;

View file

@ -2,12 +2,12 @@ using Dalamud.Game.ClientState.Aetherytes;
using Dalamud.Utility;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
/// <summary>
/// Test setup for the Aetheryte List.
/// </summary>
internal class AetheryteListAgingStep : IAgingStep
internal class AetheryteListSelfTestStep : ISelfTestStep
{
private int index = 0;

View file

@ -4,12 +4,12 @@ using Dalamud.Game.Text.SeStringHandling;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
/// <summary>
/// Test setup for Chat.
/// </summary>
internal class ChatAgingStep : IAgingStep
internal class ChatSelfTestStep : ISelfTestStep
{
private int step = 0;
private bool subscribed = false;

View file

@ -3,12 +3,12 @@ using Dalamud.Game.ClientState.Conditions;
using ImGuiNET;
using Serilog;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
/// <summary>
/// Test setup for Condition.
/// </summary>
internal class ConditionAgingStep : IAgingStep
internal class ConditionSelfTestStep : ISelfTestStep
{
/// <inheritdoc/>
public string Name => "Test Condition";

View file

@ -12,12 +12,12 @@ using Lumina.Excel;
using Lumina.Excel.Sheets;
using Serilog;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
/// <summary>
/// Tests for context menu.
/// </summary>
internal class ContextMenuAgingStep : IAgingStep
internal class ContextMenuSelfTestStep : ISelfTestStep
{
private SubStep currentSubStep;

View file

@ -2,12 +2,12 @@
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
/// <summary>
/// Test setup for the DutyState service class.
/// </summary>
internal class DutyStateAgingStep : IAgingStep
internal class DutyStateSelfTestStep : ISelfTestStep
{
private bool subscribed = false;
private bool hasPassed = false;

View file

@ -2,12 +2,12 @@ using Dalamud.Game.ClientState;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
/// <summary>
/// Test setup for Territory Change.
/// </summary>
internal class EnterTerritoryAgingStep : IAgingStep
internal class EnterTerritorySelfTestStep : ISelfTestStep
{
private readonly ushort territory;
private readonly string terriName;
@ -15,11 +15,11 @@ internal class EnterTerritoryAgingStep : IAgingStep
private bool hasPassed = false;
/// <summary>
/// Initializes a new instance of the <see cref="EnterTerritoryAgingStep"/> class.
/// Initializes a new instance of the <see cref="EnterTerritorySelfTestStep"/> class.
/// </summary>
/// <param name="terri">The territory to check for.</param>
/// <param name="name">Name to show.</param>
public EnterTerritoryAgingStep(ushort terri, string name)
public EnterTerritorySelfTestStep(ushort terri, string name)
{
this.terriName = name;
this.territory = terri;

View file

@ -2,12 +2,12 @@ using Dalamud.Game.ClientState.Fates;
using Dalamud.Utility;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
/// <summary>
/// Test setup for the Fate Table.
/// </summary>
internal class FateTableAgingStep : IAgingStep
internal class FateTableSelfTestStep : ISelfTestStep
{
private byte index = 0;

View file

@ -2,12 +2,12 @@
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
/// <summary>
/// Test of GameConfig.
/// </summary>
internal class GameConfigAgingStep : IAgingStep
internal class GameConfigSelfTestStep : ISelfTestStep
{
private bool started;
private bool isStartedLegacy;

View file

@ -7,12 +7,12 @@ using Lumina.Text.Payloads;
using LSeStringBuilder = Lumina.Text.SeStringBuilder;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
/// <summary>
/// Test setup for the Gamepad State.
/// </summary>
internal class GamepadStateAgingStep : IAgingStep
internal class GamepadStateSelfTestStep : ISelfTestStep
{
/// <inheritdoc/>
public string Name => "Test GamePadState";

View file

@ -1,11 +1,11 @@
using System.Runtime.InteropServices;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
/// <summary>
/// Test dedicated to handling of Access Violations.
/// </summary>
internal class HandledExceptionAgingStep : IAgingStep
internal class HandledExceptionSelfTestStep : ISelfTestStep
{
/// <inheritdoc/>
public string Name => "Test Handled Exception";

View file

@ -2,12 +2,12 @@ using Dalamud.Game.Gui;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
/// <summary>
/// Test setup for the Hover events.
/// </summary>
internal class HoverAgingStep : IAgingStep
internal class HoverSelfTestStep : ISelfTestStep
{
private bool clearedItem = false;
private bool clearedAction = false;

View file

@ -1,9 +1,9 @@
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
/// <summary>
/// Interface for test implementations.
/// </summary>
internal interface IAgingStep
internal interface ISelfTestStep
{
/// <summary>
/// Gets the name of the test.

View file

@ -4,12 +4,12 @@ using Dalamud.Game.Text.SeStringHandling.Payloads;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
/// <summary>
/// Test setup for item payloads.
/// </summary>
internal class ItemPayloadAgingStep : IAgingStep
internal class ItemPayloadSelfTestStep : ISelfTestStep
{
private SubStep currentSubStep;

View file

@ -2,12 +2,12 @@ using Dalamud.Game.ClientState.Keys;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
/// <summary>
/// Test setup for the Key State.
/// </summary>
internal class KeyStateAgingStep : IAgingStep
internal class KeyStateSelfTestStep : ISelfTestStep
{
/// <inheritdoc/>
public string Name => "Test KeyState";

View file

@ -2,12 +2,12 @@ using Dalamud.Game.ClientState;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
/// <summary>
/// Test setup for the login events.
/// </summary>
internal class LoginEventAgingStep : IAgingStep
internal class LoginEventSelfTestStep : ISelfTestStep
{
private bool subscribed = false;
private bool hasPassed = false;

View file

@ -2,12 +2,12 @@ using Dalamud.Game.ClientState;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
/// <summary>
/// Test setup for the login events.
/// </summary>
internal class LogoutEventAgingStep : IAgingStep
internal class LogoutEventSelfTestStep : ISelfTestStep
{
private bool subscribed = false;
private bool hasPassed = false;

View file

@ -2,14 +2,14 @@ using Dalamud.Data;
using Dalamud.Utility;
using Lumina.Excel;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
/// <summary>
/// Test setup for Lumina.
/// </summary>
/// <typeparam name="T">ExcelRow to run test on.</typeparam>
/// <param name="isLargeSheet">Whether or not the sheet is large. If it is large, the self test will iterate through the full sheet in one frame and benchmark the time taken.</param>
internal class LuminaAgingStep<T>(bool isLargeSheet) : IAgingStep
internal class LuminaSelfTestStep<T>(bool isLargeSheet) : ISelfTestStep
where T : struct, IExcelRow<T>
{
private int step = 0;

View file

@ -5,12 +5,12 @@ using Dalamud.Game.MarketBoard;
using Dalamud.Game.Network.Structures;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
/// <summary>
/// Tests the various market board events.
/// </summary>
internal class MarketBoardAgingStep : IAgingStep
internal class MarketBoardSelfTestStep : ISelfTestStep
{
private SubStep currentSubStep;
private bool eventsSubscribed;

View file

@ -6,12 +6,12 @@ using Dalamud.Game.Text.SeStringHandling.Payloads;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
/// <summary>
/// Tests for nameplates.
/// </summary>
internal class NamePlateAgingStep : IAgingStep
internal class NamePlateSelfTestStep : ISelfTestStep
{
private SubStep currentSubStep;
private Dictionary<ulong, int>? updateCount;

View file

@ -6,12 +6,12 @@ using ImGuiNET;
using LSheets = Lumina.Excel.Sheets;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
/// <summary>
/// Test setup for NounProcessor.
/// </summary>
internal class NounProcessorAgingStep : IAgingStep
internal class NounProcessorSelfTestStep : ISelfTestStep
{
private NounTestEntry[] tests =
[

View file

@ -3,12 +3,12 @@ using Dalamud.Game.Gui.PartyFinder.Types;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
/// <summary>
/// Test setup for Party Finder events.
/// </summary>
internal class PartyFinderAgingStep : IAgingStep
internal class PartyFinderSelfTestStep : ISelfTestStep
{
private bool subscribed = false;
private bool hasPassed = false;

View file

@ -5,12 +5,12 @@ using ImGuiNET;
using Lumina.Text.ReadOnly;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
/// <summary>
/// Test setup for SeStringEvaluator.
/// </summary>
internal class SeStringEvaluatorAgingStep : IAgingStep
internal class SeStringEvaluatorSelfTestStep : ISelfTestStep
{
private int step = 0;

View file

@ -8,12 +8,12 @@ using FFXIVClientStructs.FFXIV.Client.UI.Misc;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
/// <summary>
/// Test setup for SheetRedirectResolver.
/// </summary>
internal class SheetRedirectResolverAgingStep : IAgingStep
internal class SheetRedirectResolverSelfTestStep : ISelfTestStep
{
private RedirectEntry[] redirects =
[

View file

@ -4,12 +4,12 @@ using Dalamud.Game.ClientState.Objects.Types;
using ImGuiNET;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
/// <summary>
/// Test setup for targets.
/// </summary>
internal class TargetAgingStep : IAgingStep
internal class TargetSelfTestStep : ISelfTestStep
{
private int step = 0;

View file

@ -1,11 +1,11 @@
using Dalamud.Game.Gui.Toast;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
/// <summary>
/// Test setup for toasts.
/// </summary>
internal class ToastAgingStep : IAgingStep
internal class ToastSelfTestStep : ISelfTestStep
{
/// <inheritdoc/>
public string Name => "Test Toasts";

View file

@ -1,18 +1,18 @@
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps;
namespace Dalamud.Interface.Internal.Windows.SelfTest.Steps;
/// <summary>
/// Test that waits N frames.
/// </summary>
internal class WaitFramesAgingStep : IAgingStep
internal class WaitFramesSelfTestStep : ISelfTestStep
{
private readonly int frames;
private int cFrames;
/// <summary>
/// Initializes a new instance of the <see cref="WaitFramesAgingStep"/> class.
/// Initializes a new instance of the <see cref="WaitFramesSelfTestStep"/> class.
/// </summary>
/// <param name="frames">Amount of frames to wait.</param>
public WaitFramesAgingStep(int frames)
public WaitFramesSelfTestStep(int frames)
{
this.frames = frames;
this.cFrames = frames;