fix(settings): a profile or an ini exported takes the page's edits in a copy, so discarding them still works

Saving a profile or exporting eu07.ini captured the page's edits into the settings held, so
discarding them before a start showed them again and the start's save wrote them. The export
writes a copy with the edits in; the settings held stay as saved.
This commit is contained in:
maj00r
2026-11-16 01:24:17 +01:00
parent 829a3e7a3d
commit faa06fb9d8
4 changed files with 23 additions and 8 deletions

View File

@@ -1274,6 +1274,22 @@ public class SettingsStoreTests
Assert.Contains("physicslog.trains yes", files.ReadAllText(UserIni, System.Text.Encoding.UTF8));
}
[Fact]
public void A_profile_exported_from_a_pages_edits_leaves_the_settings_held_and_the_ini_alone()
{
var files = new InMemoryFileSystem().WithFile(UserIni, "fieldofview 45\n");
var store = WithHome(files).SettingsStore;
store.Load();
var edited = store.Settings.Copy();
edited.FieldOfView = 60;
Assert.True(store.ExportTo(Profile, edited));
Assert.Contains("fieldofview 60", files.ReadAllText(Profile, System.Text.Encoding.UTF8));
Assert.Equal(45, store.Settings.FieldOfView);
Assert.Contains("fieldofview 45", files.ReadAllText(UserIni, System.Text.Encoding.UTF8));
}
[Fact]
public void A_missing_profile_leaves_the_settings_as_they_are()
{