Add material color services, plugin DTOs, and tests

Introduce IPC wire-format appearance DTOs (PluginIsolation.Contracts) and clarify they are distinct from the runtime PluginSdk snapshot. Update PluginSdk comments to document the runtime-facing snapshot shape. Change ComponentColorSchemeHelper to use the HostMaterialColorProvider and add an overload that accepts a MaterialColorSnapshot. Add new services and pipelines (MaterialColorService, MaterialSurfaceService, WindowMaterialService, WallpaperColorPipeline) and refactor AppearanceThemeService to depend on MaterialColorService while removing legacy internal implementations. Add multiple unit tests (ComponentColorSchemeHelper, PluginAppearanceBoundary, SettingsCatalogService, WallpaperSettingsPageViewModel) and update localization resources with new material_color and wallpaper keys.
This commit is contained in:
lincube
2026-05-06 19:33:08 +08:00
parent f8a4bb888c
commit 6b1c738d8c
30 changed files with 2402 additions and 1577 deletions

View File

@@ -0,0 +1,39 @@
using System.Linq;
using LanMountainDesktop.PluginSdk;
using LanMountainDesktop.Services.Settings;
using Xunit;
namespace LanMountainDesktop.Tests;
public sealed class SettingsCatalogServiceTests
{
[Fact]
public void BuiltInAppSectionsIncludeIndependentMaterialColorAndWallpaperEntries()
{
var catalog = new SettingsCatalogService();
var sections = catalog.GetSections(SettingsScope.App).ToList();
Assert.Equal(
[
"general",
"material-color",
"appearance",
"wallpaper",
"about"
],
sections.Select(section => section.Id));
var materialColor = sections.Single(section => section.Id == "material-color");
Assert.Equal(SettingsCategories.Appearance, materialColor.Category);
Assert.Equal(SettingsScope.App, materialColor.Scope);
Assert.Equal("settings.material_color.title", materialColor.TitleLocalizationKey);
Assert.Equal("Color", materialColor.IconKey);
var wallpaper = sections.Single(section => section.Id == "wallpaper");
Assert.Equal(SettingsCategories.Appearance, wallpaper.Category);
Assert.Equal(SettingsScope.App, wallpaper.Scope);
Assert.Equal("settings.wallpaper.title", wallpaper.TitleLocalizationKey);
Assert.Equal("Image", wallpaper.IconKey);
}
}