test(selftests): cover theme picker category map
This commit is contained in:
@@ -343,6 +343,7 @@ public sealed class Plugin : IAsyncDalamudPlugin
|
|||||||
new SelfTests.FoxBannerTextureSmokeStep(this),
|
new SelfTests.FoxBannerTextureSmokeStep(this),
|
||||||
new SelfTests.SidebarModeAutoSwitchStep(this),
|
new SelfTests.SidebarModeAutoSwitchStep(this),
|
||||||
new SelfTests.ColorEditorBufferStep(this),
|
new SelfTests.ColorEditorBufferStep(this),
|
||||||
|
new SelfTests.ThemePickerCategoryStep(this),
|
||||||
new SelfTests.ConfigMigrationV20Step(this),
|
new SelfTests.ConfigMigrationV20Step(this),
|
||||||
new SelfTests.HoverSheenAllocStep(this),
|
new SelfTests.HoverSheenAllocStep(this),
|
||||||
new SelfTests.HonorificHeaderRenderStep(this),
|
new SelfTests.HonorificHeaderRenderStep(this),
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
using System.Linq;
|
||||||
|
using Dalamud.Bindings.ImGui;
|
||||||
|
using Dalamud.Plugin.SelfTest;
|
||||||
|
using HellionChat.Themes;
|
||||||
|
using HellionChat.Ui.Components.Settings;
|
||||||
|
|
||||||
|
namespace HellionChat.SelfTests;
|
||||||
|
|
||||||
|
internal sealed class ThemePickerCategoryStep : ISelfTestStep
|
||||||
|
{
|
||||||
|
private readonly Plugin _plugin;
|
||||||
|
|
||||||
|
public ThemePickerCategoryStep(Plugin plugin)
|
||||||
|
{
|
||||||
|
_plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Name => "Hellion Chat - Theme picker category coverage";
|
||||||
|
|
||||||
|
public SelfTestStepResult RunStep()
|
||||||
|
{
|
||||||
|
var builtinSlugs = _plugin.ThemeRegistry.BuiltinSlugs.ToHashSet();
|
||||||
|
var categorySlugs = ThemePicker.CategoryMapSlugs.ToList();
|
||||||
|
|
||||||
|
var duplicates = categorySlugs.GroupBy(x => x).Where(g => g.Count() > 1).Select(g => g.Key).ToList();
|
||||||
|
if (duplicates.Count > 0)
|
||||||
|
{
|
||||||
|
ImGui.Text($"Duplicate slugs in category map: {string.Join(", ", duplicates)}");
|
||||||
|
return SelfTestStepResult.Fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
var categorySet = categorySlugs.ToHashSet();
|
||||||
|
var missing = builtinSlugs.Except(categorySet).ToList();
|
||||||
|
var unknown = categorySet.Except(builtinSlugs).ToList();
|
||||||
|
|
||||||
|
if (missing.Count > 0)
|
||||||
|
{
|
||||||
|
ImGui.Text($"Builtin slugs missing from category map: {string.Join(", ", missing)}");
|
||||||
|
return SelfTestStepResult.Fail;
|
||||||
|
}
|
||||||
|
if (unknown.Count > 0)
|
||||||
|
{
|
||||||
|
ImGui.Text($"Unknown slugs in category map (no matching builtin): {string.Join(", ", unknown)}");
|
||||||
|
return SelfTestStepResult.Fail;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SelfTestStepResult.Pass;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CleanUp() { }
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user