using Dalamud.Bindings.ImGui; using Dalamud.Plugin.SelfTest; namespace HellionChat.SelfTests; // Push-safety smoke: IFontHandle.Push() is contracted safe regardless // of the Available state, so this step proves the ctor-built handles // can be pushed even right after plugin load. Self-test steps run on // the framework thread via the xlperf path, so the push call itself // stays main-thread-safe. internal sealed class FontPushSmokeStep : ISelfTestStep { private readonly Plugin plugin; public FontPushSmokeStep(Plugin plugin) { this.plugin = plugin; } public string Name => "Hellion Chat - FontManager push smoke"; public SelfTestStepResult RunStep() { var fm = this.plugin.FontManager; if (fm?.RegularFont is null || fm.FontAwesome is null) { ImGui.Text("RegularFont or FontAwesome missing - see FontManager ctor smoke"); return SelfTestStepResult.Fail; } if (fm.SenderFont is null || fm.MetaFont is null) { ImGui.Text("SenderFont or MetaFont missing - see FontManager ctor smoke"); return SelfTestStepResult.Fail; } try { using (fm.RegularFont.Push()) { } using (fm.FontAwesome.Push()) { } using (fm.SenderFont.Push()) { } using (fm.MetaFont.Push()) { } } catch (Exception e) { ImGui.Text($"Push threw: {e.GetType().Name}: {e.Message}"); return SelfTestStepResult.Fail; } return SelfTestStepResult.Pass; } public void CleanUp() { } }