1
0
Fork 0

fix(ui): unify titlebar centerline vertical alignment and eliminate redundant brand container (v1.0.14)

This commit is contained in:
Yun Chan 2026-09-04 23:58:41 +09:00
parent 8eb48ed854
commit 1f794e9e08
14 changed files with 2323 additions and 660 deletions

View file

@ -25,6 +25,8 @@ public class DesignAuditVisualTreeTests
public bool Contains(string key) => _d.ContainsKey(key);
}
private static readonly object AppInitLock = new();
private static void RunOnSta(Action action)
{
Exception? ex = null;
@ -32,9 +34,12 @@ public class DesignAuditVisualTreeTests
{
try
{
if (Application.Current == null)
lock (AppInitLock)
{
_ = new Application();
if (Application.Current == null)
{
try { _ = new Application(); } catch (InvalidOperationException) { }
}
}
action();
}
@ -75,6 +80,32 @@ public class DesignAuditVisualTreeTests
});
}
[Fact]
public void MainWindow_ToggleInspectorCommand_TogglesColumnWidthAndLayout()
{
RunOnSta(() =>
{
var engine = Everything2EverythingBootstrap.CreateDefault();
var store = new FakeSettingsStore();
var window = new MainWindow(engine, store);
Assert.True(window.IsInspectorVisible);
// Toggle to collapsed
window.ToggleInspectorCommand.Execute(null);
Assert.False(window.IsInspectorVisible);
var content = (UIElement)window.Content;
content.Measure(new Size(1200, 800));
content.Arrange(new Rect(0, 0, 1200, 800));
Assert.True(content.DesiredSize.Width > 0);
// Toggle back to expanded
window.ToggleInspectorCommand.Execute(null);
Assert.True(window.IsInspectorVisible);
});
}
[Fact]
public void DiagnoseWindow_MeasureAndArrange_HasValidLayoutBounds()
{
@ -155,6 +186,69 @@ public class DesignAuditVisualTreeTests
});
}
[Fact]
public void DiagnoseWindow_ProviderCards_MustHaveStructuredGridAlignment_And_TextWrapping()
{
RunOnSta(() =>
{
var engine = Everything2EverythingBootstrap.CreateDefault();
var window = new DiagnoseWindow(engine);
window.PopulateAsync().GetAwaiter().GetResult();
var content = (UIElement)window.Content;
content.Measure(new Size(640, 540));
content.Arrange(new Rect(0, 0, 640, 540));
// 1. ItemsPanel 내부에 카드들이 채워졌는지 검증
var itemsPanel = (StackPanel)window.FindName("ItemsPanel");
Assert.NotNull(itemsPanel);
Assert.True(itemsPanel.Children.Count >= 2, "환경 섹션 및 프로바이더 카드들이 채워져야 합니다.");
// 2. 입력/출력 텍스트가 단일 비정렬 문자열("입력: ... → 출력: ...")로 오버플로되지 않고
// 정형화된 그리드 또는 TextWrapping이 적용된 구조인지 검증
var allTextBlocks = FindLogicalChildren<TextBlock>(window).ToList();
var rawUnwrappedOverflows = allTextBlocks.Where(tb => tb.Text.Contains("입력:") && tb.Text.Contains("→") && tb.TextWrapping != TextWrapping.Wrap).ToList();
Assert.Empty(rawUnwrappedOverflows);
// 3. 프로바이더 카드 내에 '입력 형식' 및 '출력 형식' 라벨이 명확히 분리 정렬되어 있는지 검증
var inputLabels = allTextBlocks.Where(tb => tb.Text == "입력 형식").ToList();
var outputLabels = allTextBlocks.Where(tb => tb.Text == "출력 형식").ToList();
Assert.NotEmpty(inputLabels);
Assert.NotEmpty(outputLabels);
// 4. 모든 가로 정렬 헤더(제목 + 뱃지)에서 VerticalAlignment가 Center로 통일되어 있는지 검증
var badges = allTextBlocks.Where(tb => tb.Text is "준비됨" or "개발 중" or "점검 필요" or "비활성").ToList();
Assert.NotEmpty(badges);
foreach (var badge in badges)
{
var border = badge.Parent as Border;
Assert.NotNull(border);
Assert.Equal(VerticalAlignment.Center, border.VerticalAlignment);
}
});
}
[Fact]
public void MainWindow_TopHeader_EngineTelemetryBadge_HasValidBounds_And_CenterAlignment()
{
RunOnSta(() =>
{
var engine = Everything2EverythingBootstrap.CreateDefault();
var settings = new FakeSettingsStore();
var window = new MainWindow(engine, settings);
var content = (UIElement)window.Content;
content.Measure(new Size(1280, 960));
content.Arrange(new Rect(0, 0, 1280, 960));
var badge = (Border)window.FindName("EngineTelemetryBadge");
Assert.NotNull(badge);
Assert.Equal(VerticalAlignment.Center, badge.VerticalAlignment);
Assert.True(badge.DesiredSize.Width > 0);
Assert.True(badge.DesiredSize.Height > 0);
});
}
private static IEnumerable<T> FindLogicalChildren<T>(object parent) where T : DependencyObject
{
if (parent is ContentControl cc && cc.Content != null)