feat(ads/seo/release): v1.2.0 with live Google Ads, isolated ad profile, ads.txt, and SEO/AEO/GEO optimization
This commit is contained in:
parent
a88aafa1e5
commit
0e568f1f0a
975 changed files with 130593 additions and 16783 deletions
67
tests/Paca.Tests/Infrastructure/WpfTestApp.cs
Normal file
67
tests/Paca.Tests/Infrastructure/WpfTestApp.cs
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
using System.Windows;
|
||||
using Paca.App;
|
||||
|
||||
namespace Paca.Tests.Infrastructure;
|
||||
|
||||
/// <summary>
|
||||
/// 테스트 프로세스에는 App.xaml 의 리소스가 없으므로, App 어셈블리의 테마 사전을
|
||||
/// 테스트 전용 Application 에 로드한다(앱의 App.ApplyTheme 과 동일 순서: 색 → 스타일).
|
||||
/// </summary>
|
||||
public static class WpfTestApp
|
||||
{
|
||||
private static readonly object _lock = new();
|
||||
private static bool _initialized = false;
|
||||
|
||||
public static void Ensure(System.Windows.Threading.Dispatcher dispatcher)
|
||||
{
|
||||
dispatcher.Invoke(() =>
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
if (Application.Current == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
new Application { ShutdownMode = ShutdownMode.OnExplicitShutdown };
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
// 이미 다른 스레드/테스트에서 생성된 경우
|
||||
}
|
||||
}
|
||||
|
||||
if (Application.Current != null && !_initialized)
|
||||
{
|
||||
try
|
||||
{
|
||||
global::Paca.App.App.ApplyTheme("dark");
|
||||
if (!Application.Current.Resources.Contains("InverseCountToVisibility"))
|
||||
Application.Current.Resources["InverseCountToVisibility"] = new InverseCountToVisibilityConverter();
|
||||
_initialized = true;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void EnsureWindowResources(FrameworkElement element)
|
||||
{
|
||||
try
|
||||
{
|
||||
const string asm = "pack://application:,,,/Paca;component";
|
||||
var md = element.Resources.MergedDictionaries;
|
||||
bool hasDark = md.Any(d => d.Source?.OriginalString?.Contains("Dark.xaml") == true);
|
||||
bool hasShared = md.Any(d => d.Source?.OriginalString?.Contains("Shared.xaml") == true);
|
||||
if (!hasDark)
|
||||
{
|
||||
try { md.Add(new ResourceDictionary { Source = new Uri(asm + "/Themes/Dark.xaml", UriKind.Absolute) }); } catch { }
|
||||
}
|
||||
if (!hasShared)
|
||||
{
|
||||
try { md.Add(new ResourceDictionary { Source = new Uri(asm + "/Themes/Shared.xaml", UriKind.Absolute) }); } catch { }
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue