feat: add configurable operator appearance and layout
This commit is contained in:
@@ -54,6 +54,47 @@ public sealed class LegacyOperatorSettingsBridgeTests
|
||||
Assert.Equal(expanded, intent.Expanded);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(
|
||||
"system",
|
||||
"automatic",
|
||||
"stockCut",
|
||||
LegacyOperatorColorTheme.System,
|
||||
LegacyOperatorViewMode.Automatic,
|
||||
LegacyOperatorStartWorkspace.StockCut)]
|
||||
[InlineData(
|
||||
"light",
|
||||
"compact",
|
||||
"lastWorkspace",
|
||||
LegacyOperatorColorTheme.Light,
|
||||
LegacyOperatorViewMode.Compact,
|
||||
LegacyOperatorStartWorkspace.LastWorkspace)]
|
||||
[InlineData(
|
||||
"dark",
|
||||
"cards",
|
||||
"stockCut",
|
||||
LegacyOperatorColorTheme.Dark,
|
||||
LegacyOperatorViewMode.Cards,
|
||||
LegacyOperatorStartWorkspace.StockCut)]
|
||||
public void ParseAppearance_AcceptsOnlyClosedValues(
|
||||
string colorTheme,
|
||||
string viewMode,
|
||||
string startWorkspace,
|
||||
LegacyOperatorColorTheme expectedColorTheme,
|
||||
LegacyOperatorViewMode expectedViewMode,
|
||||
LegacyOperatorStartWorkspace expectedStartWorkspace)
|
||||
{
|
||||
var json =
|
||||
$"{{\"type\":\"set-operator-appearance\",\"payload\":{{\"viewMode\":\"{viewMode}\",\"startWorkspace\":\"{startWorkspace}\",\"colorTheme\":\"{colorTheme}\"}}}}";
|
||||
|
||||
Assert.True(LegacyBridgeProtocol.TryParseIntent(json, out var parsed, out var error));
|
||||
Assert.Null(error);
|
||||
var intent = Assert.IsType<LegacySetOperatorAppearanceIntent>(parsed);
|
||||
Assert.Equal(expectedColorTheme, intent.ColorTheme);
|
||||
Assert.Equal(expectedViewMode, intent.ViewMode);
|
||||
Assert.Equal(expectedStartWorkspace, intent.StartWorkspace);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("{\"type\":\"choose-operator-folder\",\"payload\":{}}")]
|
||||
[InlineData("{\"type\":\"choose-operator-folder\",\"payload\":{\"kind\":\"settings\"}}")]
|
||||
@@ -65,6 +106,12 @@ public sealed class LegacyOperatorSettingsBridgeTests
|
||||
[InlineData("{\"type\":\"set-operator-navigation-expanded\",\"payload\":{}}")]
|
||||
[InlineData("{\"type\":\"set-operator-navigation-expanded\",\"payload\":{\"expanded\":\"true\"}}")]
|
||||
[InlineData("{\"type\":\"set-operator-navigation-expanded\",\"payload\":{\"expanded\":true,\"path\":\"C:\\\\Config\"}}")]
|
||||
[InlineData("{\"type\":\"set-operator-appearance\",\"payload\":{\"colorTheme\":\"system\",\"viewMode\":\"automatic\"}}")]
|
||||
[InlineData("{\"type\":\"set-operator-appearance\",\"payload\":{\"colorTheme\":\"mbn\",\"viewMode\":\"automatic\",\"startWorkspace\":\"stockCut\"}}")]
|
||||
[InlineData("{\"type\":\"set-operator-appearance\",\"payload\":{\"colorTheme\":\"system\",\"viewMode\":\"grid\",\"startWorkspace\":\"stockCut\"}}")]
|
||||
[InlineData("{\"type\":\"set-operator-appearance\",\"payload\":{\"colorTheme\":\"system\",\"viewMode\":\"automatic\",\"startWorkspace\":\"other\"}}")]
|
||||
[InlineData("{\"type\":\"set-operator-appearance\",\"payload\":{\"colorTheme\":\"system\",\"viewMode\":\"automatic\",\"startWorkspace\":\"stockCut\",\"extra\":true}}")]
|
||||
[InlineData("{\"type\":\"set-operator-appearance\",\"payload\":{\"colorTheme\":\"system\",\"colorTheme\":\"dark\",\"viewMode\":\"automatic\",\"startWorkspace\":\"stockCut\"}}")]
|
||||
public void ParseSettingsIntents_RejectsMissingUnknownAndExtraAuthority(string json)
|
||||
{
|
||||
Assert.False(LegacyBridgeProtocol.TryParseIntent(json, out var parsed, out _));
|
||||
@@ -80,6 +127,9 @@ public sealed class LegacyOperatorSettingsBridgeTests
|
||||
new LegacyOperatorFolderSnapshot("D:\\Resource", true, false, "Res 폴더 없음"),
|
||||
new LegacyOperatorFolderSnapshot("앱 기본 배경", false, true, "기본값"),
|
||||
NavigationExpanded: false,
|
||||
ColorTheme: LegacyOperatorColorTheme.Dark,
|
||||
ViewMode: LegacyOperatorViewMode.Cards,
|
||||
StartWorkspace: LegacyOperatorStartWorkspace.LastWorkspace,
|
||||
RestartRequired: true,
|
||||
Message: "재시작 후 적용됩니다.",
|
||||
MessageKind: LegacyOperatorSettingsMessageKind.Warning,
|
||||
@@ -107,6 +157,11 @@ public sealed class LegacyOperatorSettingsBridgeTests
|
||||
Assert.False(projected.GetProperty("resource").GetProperty("isValid").GetBoolean());
|
||||
Assert.False(projected.GetProperty("background").GetProperty("isCustom").GetBoolean());
|
||||
Assert.False(projected.GetProperty("navigationExpanded").GetBoolean());
|
||||
Assert.Equal("dark", projected.GetProperty("colorTheme").GetString());
|
||||
Assert.Equal("cards", projected.GetProperty("viewMode").GetString());
|
||||
Assert.Equal(
|
||||
"lastWorkspace",
|
||||
projected.GetProperty("startWorkspace").GetString());
|
||||
Assert.True(projected.GetProperty("restartRequired").GetBoolean());
|
||||
Assert.Equal("재시작 후 적용됩니다.", projected.GetProperty("message").GetString());
|
||||
Assert.Equal("warning", projected.GetProperty("messageKind").GetString());
|
||||
|
||||
Reference in New Issue
Block a user