feat(37): reset one scene to its factory snapshot
The per-scene reset restores that scene's settings, layers, webcam placement, and background-path settings while leaving other scenes' current edits alone. A focused integration test covers the restore/isolation behavior. 611 tests green, clean build with 0 warnings. Reference: OBS scene collections store scenes and sources as a saved set: https://obsproject.com/kb/scene-collections
This commit is contained in:
@@ -80,10 +80,57 @@ public sealed class LayoutStoreSnapshotTests
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ResetOneScene_RestoresItsFactoryLayers_AndKeepsOtherSceneEdits()
|
||||
{
|
||||
var path = Path.Combine(Path.GetTempPath(), $"ytLlive-layout-snapshot-{Guid.NewGuid():N}.db");
|
||||
var starting = MakeScene(SceneCatalog.Starting, "Factory starting");
|
||||
var brb = MakeScene(SceneCatalog.Brb, "Factory BRB");
|
||||
try
|
||||
{
|
||||
using (var store = new LayoutStore(path))
|
||||
{
|
||||
store.Save(new[] { starting, brb }, null, null);
|
||||
store.PrepareLayoutSnapshots("build-a");
|
||||
store.Save(new[]
|
||||
{
|
||||
MakeScene(starting.Id, starting.Name, "Edited starting"),
|
||||
MakeScene(brb.Id, brb.Name, "Edited BRB"),
|
||||
}, null, null);
|
||||
}
|
||||
|
||||
using (var reopened = new LayoutStore(path))
|
||||
{
|
||||
reopened.PrepareLayoutSnapshots("build-a");
|
||||
Assert.True(reopened.RestoreDefaultScene(starting.Id));
|
||||
|
||||
var scenes = reopened.Load();
|
||||
Assert.Equal("Factory starting", Assert.Single(scenes.Single(s => s.Id == starting.Id).Elements.OfType<Source>()).Name);
|
||||
Assert.Equal("Edited BRB", Assert.Single(scenes.Single(s => s.Id == brb.Id).Elements.OfType<Source>()).Name);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
SqliteConnection.ClearAllPools();
|
||||
try { File.Delete(path); } catch { /* best-effort cleanup */ }
|
||||
}
|
||||
}
|
||||
|
||||
private static Scene MakeScene(string sourceName)
|
||||
=> MakeScene(SceneCatalog.Starting, sourceName);
|
||||
|
||||
private static Scene MakeScene(string sceneName, string sourceName)
|
||||
=> new()
|
||||
{
|
||||
Name = SceneCatalog.Starting,
|
||||
Name = sceneName,
|
||||
Elements = { new Source { Name = sourceName, Type = SourceType.TextOverlay } },
|
||||
};
|
||||
|
||||
private static Scene MakeScene(string id, string sceneName, string sourceName)
|
||||
=> new()
|
||||
{
|
||||
Id = id,
|
||||
Name = sceneName,
|
||||
Elements = { new Source { Name = sourceName, Type = SourceType.TextOverlay } },
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user