mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-19 06:55:59 +01:00
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:
@@ -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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user