feat(37): restore the default layout when the build ID changes
A mismatched or missing current-build stamp restores the immutable default snapshot atomically before the VM loads scenes. The new integration case edits current on build A, opens on build B, and verifies the factory layout returns. 610 tests green, clean build with 0 warnings. Reference: OBS scene collections keep scenes/sources as a separate saved set: https://obsproject.com/kb/scene-collections
This commit is contained in:
@@ -48,6 +48,38 @@ public sealed class LayoutStoreSnapshotTests
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DifferentBuild_RestoresTheDefaultSnapshotBeforeLoading()
|
||||
{
|
||||
var path = Path.Combine(Path.GetTempPath(), $"ytLlive-layout-snapshot-{Guid.NewGuid():N}.db");
|
||||
try
|
||||
{
|
||||
using (var store = new LayoutStore(path))
|
||||
{
|
||||
store.Save(new[] { MakeScene("Factory title") }, null, null);
|
||||
store.PrepareLayoutSnapshots("build-a");
|
||||
store.Save(new[] { MakeScene("Creator edit") }, null, null);
|
||||
}
|
||||
|
||||
using (var reopened = new LayoutStore(path))
|
||||
{
|
||||
reopened.PrepareLayoutSnapshots("build-b");
|
||||
var restored = Assert.Single(reopened.Load());
|
||||
Assert.Equal("Factory title", Assert.Single(restored.Elements.OfType<Source>()).Name);
|
||||
|
||||
using var connection = GetConnection(path);
|
||||
using var command = connection.CreateCommand();
|
||||
command.CommandText = "SELECT Value FROM LayoutSnapshotState WHERE Key = 'CurrentBuildId';";
|
||||
Assert.Equal("build-b", command.ExecuteScalar());
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
SqliteConnection.ClearAllPools();
|
||||
try { File.Delete(path); } catch { /* best-effort cleanup */ }
|
||||
}
|
||||
}
|
||||
|
||||
private static Scene MakeScene(string sourceName)
|
||||
=> new()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user