feat(ui): Windows 11 정통 네이티브 리디자인 + Google AdMob 광고 연동
- Mica 베이스 + 왼쪽 위 8px 라운드 콘텐츠 레이어 (탐색기·설정 앱 2계층 구조) - 시스템 라이트/다크·강조색 자동 추종 (FsThemeService, FsPalette.Light/Dark) - 강조색은 시스템 강조색에서 WCAG AA 대비를 보정해 파생 (FsAccentPalette) - Segoe UI Variable 타입 램프, 최소 12px, 반경 4/8px, 카드 중첩 제거 - 네온 시안·더블 베젤·그라디언트 버튼·Inter 서체 폐기 - 전 창 적용: 메인·빠른 옵션/진행·설정·도구 설치·진단, 광고는 중립 카드로 - 결함 수정: 사이드바 체크박스 라벨 잘림, 행 체크박스 잘림, 입력란 이중 여백, 제목 표시줄 아이콘 검게 렌더, '큐'/'대기열' 용어 혼용 - Google AdMob 광고 단위 연동 (AdHtmlBuilder, 설정 창 AdMob 카드) - Win11NativeDesignTests 계약 테스트, VisualCaptureHarness 시각 E2E 캡처
This commit is contained in:
parent
50072124a9
commit
ab126a001a
35 changed files with 4221 additions and 2469 deletions
168
src/Everything2Everything.Tests/SettingsWindowAdMobTests.cs
Normal file
168
src/Everything2Everything.Tests/SettingsWindowAdMobTests.cs
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Xml.Linq;
|
||||
using Everything2Everything.App.Views;
|
||||
using Everything2Everything.Core;
|
||||
using Everything2Everything.Core.Ads;
|
||||
using Xunit;
|
||||
|
||||
namespace Everything2Everything.Tests;
|
||||
|
||||
public class SettingsWindowAdMobTests
|
||||
{
|
||||
private static readonly string SolutionRoot = FindSolutionRoot();
|
||||
private static readonly string SettingsXamlPath = Path.Combine(SolutionRoot, "src", "Everything2Everything.App", "Views", "SettingsWindow.xaml");
|
||||
|
||||
private static string FindSolutionRoot()
|
||||
{
|
||||
var dir = Directory.GetCurrentDirectory();
|
||||
while (dir != null && !File.Exists(Path.Combine(dir, "Everything2Everything.slnx")))
|
||||
{
|
||||
dir = Directory.GetParent(dir)?.FullName;
|
||||
}
|
||||
return dir ?? throw new DirectoryNotFoundException("솔루션 루트를 찾을 수 없습니다.");
|
||||
}
|
||||
|
||||
private sealed class FakeSettingsStore : ISettingsStore
|
||||
{
|
||||
private readonly Dictionary<string, string> _d = new();
|
||||
public string? Get(string key) => _d.TryGetValue(key, out var v) ? v : null;
|
||||
public void Set(string key, string value) => _d[key] = value;
|
||||
public void Remove(string key) => _d.Remove(key);
|
||||
public bool Contains(string key) => _d.ContainsKey(key);
|
||||
}
|
||||
|
||||
private static readonly object AppInitLock = new();
|
||||
|
||||
private static void RunOnSta(Action action)
|
||||
{
|
||||
Exception? ex = null;
|
||||
var thread = new Thread(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
lock (AppInitLock)
|
||||
{
|
||||
if (Application.Current == null)
|
||||
{
|
||||
try { _ = new Application(); } catch (InvalidOperationException) { }
|
||||
}
|
||||
}
|
||||
action();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
ex = e;
|
||||
}
|
||||
});
|
||||
thread.SetApartmentState(ApartmentState.STA);
|
||||
thread.Start();
|
||||
thread.Join();
|
||||
|
||||
if (ex != null)
|
||||
{
|
||||
throw new AggregateException("STA 스레드 실행 중 예외 발생", ex);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SettingsWindowXaml_ContainsAdMobConfigurationCard()
|
||||
{
|
||||
Assert.True(File.Exists(SettingsXamlPath), "SettingsWindow.xaml 이 존재해야 합니다.");
|
||||
var doc = XDocument.Parse(File.ReadAllText(SettingsXamlPath));
|
||||
|
||||
var elementNames = doc.Descendants()
|
||||
.Select(e => e.Attribute(XName.Get("Name", "http://schemas.microsoft.com/winfx/2006/xaml"))?.Value)
|
||||
.Where(n => !string.IsNullOrEmpty(n))
|
||||
.ToHashSet();
|
||||
|
||||
Assert.Contains("AdMobPublisherIdBox", elementNames);
|
||||
Assert.Contains("AdMobAppIdBox", elementNames);
|
||||
Assert.Contains("AdMobBannerIdBox", elementNames);
|
||||
Assert.Contains("AdMobInterstitialIdBox", elementNames);
|
||||
Assert.Contains("AdMobTestAdsCheck", elementNames);
|
||||
Assert.Contains("ExportAppAdsTxtBtn", elementNames);
|
||||
Assert.Contains("AdMobStatusDot", elementNames);
|
||||
Assert.Contains("AdMobStatusText", elementNames);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SettingsWindowXaml_AdMobControls_ComplyWithDesignAudit()
|
||||
{
|
||||
var doc = XDocument.Parse(File.ReadAllText(SettingsXamlPath));
|
||||
var rawEmojis = new[] { "⚙", "📁", "🗑", "✖", "🔧", "✨", "🚀", "⚡" };
|
||||
var violations = new List<string>();
|
||||
|
||||
// 1. 유니코드 이모지 금지
|
||||
var buttons = doc.Descendants().Where(e => e.Name.LocalName is "Button" or "ToggleButton");
|
||||
foreach (var btn in buttons)
|
||||
{
|
||||
var content = btn.Attribute("Content")?.Value;
|
||||
if (!string.IsNullOrEmpty(content) && rawEmojis.Any(emoji => content.Contains(emoji)))
|
||||
{
|
||||
violations.Add($"버튼에 이모지 사용 감지: {content}");
|
||||
}
|
||||
}
|
||||
|
||||
// 2. 가로 StackPanel 내 아이콘/텍스트 VerticalAlignment="Center"
|
||||
var stackPanels = doc.Descendants().Where(e => e.Name.LocalName == "StackPanel" &&
|
||||
e.Attribute("Orientation")?.Value == "Horizontal");
|
||||
foreach (var sp in stackPanels)
|
||||
{
|
||||
foreach (var child in sp.Elements())
|
||||
{
|
||||
var va = child.Attribute("VerticalAlignment")?.Value;
|
||||
if (va != "Center")
|
||||
{
|
||||
violations.Add($"가로 StackPanel의 자식 <{child.Name.LocalName}>에 VerticalAlignment=\"Center\" 누락");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Assert.True(violations.Count == 0,
|
||||
"SettingsWindow 디자인 감사 위반이 발견되었습니다:\n" + string.Join("\n", violations));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SettingsWindow_LoadsAndSavesAdMobConfig()
|
||||
{
|
||||
RunOnSta(() =>
|
||||
{
|
||||
var settings = new FakeSettingsStore();
|
||||
settings.Set("admob.publisherid", "pub-1112223334445556");
|
||||
settings.Set("admob.appid", "ca-app-pub-1112223334445556~1234567890");
|
||||
settings.Set("admob.bannerid", "ca-app-pub-1112223334445556/9876543210");
|
||||
settings.Set("admob.interstitialid", "ca-app-pub-1112223334445556/5555555555");
|
||||
settings.Set("admob.usetestads", "false");
|
||||
|
||||
var adService = new AdService();
|
||||
var win = new SettingsWindow(settings, adService);
|
||||
|
||||
var pubBox = (TextBox)win.FindName("AdMobPublisherIdBox");
|
||||
var appBox = (TextBox)win.FindName("AdMobAppIdBox");
|
||||
var bannerBox = (TextBox)win.FindName("AdMobBannerIdBox");
|
||||
var testCheck = (CheckBox)win.FindName("AdMobTestAdsCheck");
|
||||
|
||||
Assert.Equal("pub-1112223334445556", pubBox.Text);
|
||||
Assert.Equal("ca-app-pub-1112223334445556~1234567890", appBox.Text);
|
||||
Assert.Equal("ca-app-pub-1112223334445556/9876543210", bannerBox.Text);
|
||||
Assert.False(testCheck.IsChecked);
|
||||
|
||||
// 수정 후 저장 시뮬레이션
|
||||
pubBox.Text = "pub-9999888877776666";
|
||||
testCheck.IsChecked = true;
|
||||
|
||||
win.SaveAdMobSettings();
|
||||
|
||||
Assert.Equal("pub-9999888877776666", settings.Get("admob.publisherid"));
|
||||
Assert.Equal("true", settings.Get("admob.usetestads"));
|
||||
Assert.Equal("pub-9999888877776666", adService.CurrentConfig.PublisherId);
|
||||
Assert.True(adService.CurrentConfig.UseTestAds);
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue