From 41c8a8a94b1403e9468f8d2aedf295305e7eb099 Mon Sep 17 00:00:00 2001 From: Yun Chan Date: Thu, 3 Sep 2026 12:30:21 +0900 Subject: [PATCH] fix(ui): resolve pack URI assembly prefixes, crash-proof dynamic resource brush lookups, and add MainWindow visual tree test --- .../Views/MainWindow.xaml | 8 +++---- .../Views/MainWindow.xaml.cs | 22 ++++++++++++------- .../DesignAuditVisualTreeTests.cs | 22 +++++++++++++++++++ tools/Publish-Release.ps1 | 9 ++++---- 4 files changed, 44 insertions(+), 17 deletions(-) diff --git a/src/Everything2Everything.App/Views/MainWindow.xaml b/src/Everything2Everything.App/Views/MainWindow.xaml index 92aa5c7..3a12d31 100644 --- a/src/Everything2Everything.App/Views/MainWindow.xaml +++ b/src/Everything2Everything.App/Views/MainWindow.xaml @@ -4,7 +4,7 @@ xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" xmlns:i="http://schemas.microsoft.com/xaml/behaviors" Title="FormatShift Utility" - Icon="pack://application:,,,/Assets/app-icon.png" + Icon="pack://application:,,,/Everything2Everything;component/Assets/app-icon.png" Width="1280" Height="960" MinWidth="1080" MinHeight="640" ExtendsContentIntoTitleBar="True" @@ -75,7 +75,7 @@ + Source="pack://application:,,,/Everything2Everything;component/Assets/logo-mark.png"/> @@ -211,7 +211,7 @@ + Source="pack://application:,,,/Everything2Everything;component/Assets/glyph-ai.png"/> + Source="pack://application:,,,/Everything2Everything;component/Assets/illus-empty.png"/> e.Timestamp)) AddToHistoryGroups(e); + + UpdatePastResultsVisibility(); } + private Brush SafeBrush(string key) => + (TryFindResource(key) as Brush) ?? (Application.Current?.TryFindResource(key) as Brush) ?? new SolidColorBrush(Color.FromRgb(0x10, 0xB9, 0x81)); + private void SeedDemoHistory() { var today = FormatDateLabel(DateOnly.FromDateTime(DateTime.Today)); var todayGroup = new DateGroup(today); todayGroup.Add(new HistoryRow( - FormatLabel: "PNG", FormatBrush: (Brush)FindResource("FsFmtPng"), + FormatLabel: "PNG", FormatBrush: SafeBrush("FsFmtPng"), FileName: "hero_background_final_v2.png", MetaLine: "08:42:12 • 3200x1800", SizeText: "14.2 MB", SavingsText: "↓ 1.1 MB", SourcePath: "")); todayGroup.Add(new HistoryRow( - FormatLabel: "HEIC", FormatBrush: (Brush)FindResource("FsFmtHeic"), + FormatLabel: "HEIC", FormatBrush: SafeBrush("FsFmtHeic"), FileName: "portrait_session_04.heic", MetaLine: "08:35:45 • 4032x3024", SizeText: "6.8 MB", @@ -744,14 +748,14 @@ public partial class MainWindow : Wpf.Ui.Controls.FluentWindow var yesterday = FormatDateLabel(DateOnly.FromDateTime(DateTime.Today.AddDays(-1))); var yGroup = new DateGroup(yesterday); yGroup.Add(new HistoryRow( - FormatLabel: "PDF", FormatBrush: (Brush)FindResource("FsFmtPdf"), + FormatLabel: "PDF", FormatBrush: SafeBrush("FsFmtPdf"), FileName: "Q3_Full_Marketing_Deck_v12.pdf", MetaLine: "17:22:10 • 124 Pages", SizeText: "245.4 MB", SavingsText: "↓ 12.8 MB", SourcePath: "")); - yGroup.Add(new HistoryRow( - FormatLabel: "PNG", FormatBrush: (Brush)FindResource("FsFmtPng"), + todayGroup.Add(new HistoryRow( + FormatLabel: "PNG", FormatBrush: SafeBrush("FsFmtPng"), FileName: "asset_bundle_archive_raw.png", MetaLine: "16:45:33 • 8000x8000", SizeText: "82.1 MB", @@ -1254,9 +1258,11 @@ public sealed record HistoryRow( var (label, brushKey) = FormatPalette.For(ext); var saved = e.SavingsBytes; var arrow = saved >= 0 ? "↓" : "↑"; + var brush = (Application.Current?.TryFindResource(brushKey) as Brush) + ?? new SolidColorBrush(Color.FromRgb(0x10, 0xB9, 0x81)); return new HistoryRow( FormatLabel: label, - FormatBrush: (Brush)Application.Current.FindResource(brushKey), + FormatBrush: brush, FileName: Path.GetFileName(e.SourcePath), MetaLine: $"{e.Timestamp:HH:mm:ss} • {e.OutputCount} output(s)", SizeText: MainWindow.HumanizeBytes(e.SourceSizeBytes), diff --git a/src/Everything2Everything.Tests/DesignAuditVisualTreeTests.cs b/src/Everything2Everything.Tests/DesignAuditVisualTreeTests.cs index 4d1b91f..db3390f 100644 --- a/src/Everything2Everything.Tests/DesignAuditVisualTreeTests.cs +++ b/src/Everything2Everything.Tests/DesignAuditVisualTreeTests.cs @@ -53,6 +53,28 @@ public class DesignAuditVisualTreeTests } } + [Fact] + public void MainWindow_MeasureAndArrange_HasValidLayoutBounds() + { + RunOnSta(() => + { + var engine = Everything2EverythingBootstrap.CreateDefault(); + var store = new FakeSettingsStore(); + var window = new MainWindow(engine, store); + var content = (UIElement)window.Content; + content.Measure(new Size(1200, 800)); + content.Arrange(new Rect(0, 0, 1200, 800)); + + Assert.False(double.IsNaN(content.DesiredSize.Width)); + Assert.False(double.IsNaN(content.DesiredSize.Height)); + Assert.True(content.DesiredSize.Width > 0); + Assert.True(content.DesiredSize.Height > 0); + + var buttons = FindLogicalChildren(window).ToList(); + Assert.NotEmpty(buttons); + }); + } + [Fact] public void DiagnoseWindow_MeasureAndArrange_HasValidLayoutBounds() { diff --git a/tools/Publish-Release.ps1 b/tools/Publish-Release.ps1 index df36f3a..7f4a268 100644 --- a/tools/Publish-Release.ps1 +++ b/tools/Publish-Release.ps1 @@ -190,15 +190,14 @@ $ReleaseNotes if (Test-Path $portableZip) { Write-Host " - Portable ZIP 업로드 중..." -ForegroundColor Gray - # Forgejo asset upload API 호출 - curl -s -u "yunchan:ONVI2v4J#y" -X POST "$uploadUrl`?name=Everything2Everything-$Version-win-x64-portable.zip" -H "Content-Type: application/zip" --data-binary "@$portableZip" | Out-Null - Write-Host " -> 업로드 완료!" -ForegroundColor Gray + curl.exe -s -u "yunchan:ONVI2v4J#y" -X POST "$uploadUrl`?name=Everything2Everything-$Version-win-x64-portable.zip" -F "attachment=@$portableZip" | Out-Null + Write-Host " -> Portable ZIP 업로드 완료!" -ForegroundColor Gray } if (Test-Path $msixFile) { Write-Host " - MSIX 패키지 업로드 중..." -ForegroundColor Gray - curl -s -u "yunchan:ONVI2v4J#y" -X POST "$uploadUrl`?name=Everything2Everything-x64.msix" -H "Content-Type: application/octet-stream" --data-binary "@$msixFile" | Out-Null - Write-Host " -> 업로드 완료!" -ForegroundColor Gray + curl.exe -s -u "yunchan:ONVI2v4J#y" -X POST "$uploadUrl`?name=Everything2Everything-x64.msix" -F "attachment=@$msixFile" | Out-Null + Write-Host " -> MSIX 업로드 완료!" -ForegroundColor Gray } } catch { Write-Warning "Forgejo 릴리즈 API 호출 중 경고: $_"