Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions tests/WrapTuneMacOS.App.Tests/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// These tests share process-global state — Application.Current's theme variant
// and the static AppSettings.BaseDirOverride test seam — so parallel test
// collections can race each other (the 2026-07-10 CI flake: a [Fact] settings
// test flipped the override mid-flight under an [AvaloniaFact] theme assert).
// The suite runs in seconds; serialize it.
[assembly: CollectionBehavior(DisableTestParallelization = true)]
28 changes: 21 additions & 7 deletions tests/WrapTuneMacOS.App.Tests/SmokeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,27 @@ public void Theme_dictionaries_resolve_every_token()
[AvaloniaFact]
public void Theme_variant_matches_the_saved_setting()
{
var w = new MainWindow();
w.Show();
// Hermetic: sandbox the settings instead of reading whatever the real
// (or another test's) settings happen to say — the CI flake of
// 2026-07-10 was this test racing AppSettingsTests over the static
// BaseDirOverride and losing.
var dir = Path.Combine(Path.GetTempPath(), "wraptune-theme-" + Guid.NewGuid().ToString("N"));
Directory.CreateDirectory(dir);
AppSettings.BaseDirOverride = dir;
try
{
new AppSettings { Theme = "Midnight" }.Save();
new MainWindow().Show();
Assert.Equal(ThemeVariant.Dark, Application.Current!.RequestedThemeVariant);

// The window applies the persisted theme on load (menu Window → Toggle
// Theme flips it); whatever settings said must be what's active.
var expectDark = AppSettings.Load().Theme == "Midnight";
Assert.Equal(expectDark ? ThemeVariant.Dark : ThemeVariant.Light,
Application.Current!.RequestedThemeVariant);
new AppSettings { Theme = "Daylight" }.Save();
new MainWindow().Show();
Assert.Equal(ThemeVariant.Light, Application.Current!.RequestedThemeVariant);
}
finally
{
AppSettings.BaseDirOverride = null;
try { Directory.Delete(dir, recursive: true); } catch { /* best effort */ }
}
}
}
Loading