feat: add Handled Exception self-test step

This commit is contained in:
goat 2021-08-19 22:57:17 +02:00
parent 7a1e78cb48
commit 06035f5901
No known key found for this signature in database
GPG key ID: F18F057873895461
2 changed files with 36 additions and 0 deletions

View file

@ -0,0 +1,35 @@
using System;
using System.Runtime.InteropServices;
namespace Dalamud.Interface.Internal.Windows.SelfTest.AgingSteps
{
/// <summary>
/// Test dedicated to handling of Access Violations.
/// </summary>
internal class HandledExceptionAgingStep : IAgingStep
{
/// <inheritdoc/>
public string Name => "Test Handled Exception";
/// <inheritdoc/>
public SelfTestStepResult RunStep(Dalamud dalamud)
{
try
{
Marshal.ReadByte(IntPtr.Zero);
}
catch (AccessViolationException)
{
return SelfTestStepResult.Pass;
}
return SelfTestStepResult.Fail;
}
/// <inheritdoc/>
public void CleanUp(Dalamud dalamud)
{
// ignored
}
}
}

View file

@ -39,6 +39,7 @@ namespace Dalamud.Interface.Internal.Windows.SelfTest
new HoverAgingStep(),
new LuminaAgingStep<TerritoryType>(),
new PartyFinderAgingStep(),
new HandledExceptionAgingStep(),
new LogoutEventAgingStep(),
};