mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-25 01:19:13 +01:00
fix(settings): a value of eu07.ini the starter does not know stays until changed by hand
A renderer written in by hand ("gfxrenderer vulkan") went back to "default"
on the next save, the Vulkan renderer's own keys were taken out, and saying
no to reading the file again lost every change made on disk meanwhile.
Such a value is now shown as the file writes it - on its list where the
control is one, with the note under the setting otherwise - and written back
as it is until the player sets that control, even to what the starter shows
by default. The move to the standard mode puts them right, as before for the
advanced settings. Declining to read the file again no longer forgets the
change on disk: the next save goes onto it.
The default UART features in another order are no longer named unknown.
This commit is contained in:
@@ -68,6 +68,71 @@ public class ExternalIniTests
|
||||
Assert.Contains("fieldofview 60", installation.Files.ReadAllText(UserIni));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_renderer_written_in_by_hand_while_the_starter_runs_survives_its_save()
|
||||
{
|
||||
// Notepad: "gfxrenderer vulkan", a word the starter does not offer.
|
||||
var installation = WithIni("gfxrenderer default\nfieldofview 45\n");
|
||||
Edited(installation, "gfxrenderer vulkan\nfieldofview 45\n");
|
||||
|
||||
installation.SettingsStore.Settings.FieldOfView = 60;
|
||||
installation.SettingsStore.Save();
|
||||
|
||||
string saved = installation.Files.ReadAllText(UserIni);
|
||||
Assert.Contains("gfxrenderer vulkan", saved);
|
||||
Assert.Contains("fieldofview 60", saved);
|
||||
Assert.Equal("vulkan", installation.SettingsStore.Settings.RendererWord);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_renderer_written_in_by_hand_and_read_again_survives_the_next_save()
|
||||
{
|
||||
var installation = WithIni("gfxrenderer default\n");
|
||||
Edited(installation, "gfxrenderer vulkan\n");
|
||||
|
||||
// "Wczytać ponownie?" - yes.
|
||||
installation.SettingsStore.Load();
|
||||
installation.SettingsStore.Save();
|
||||
|
||||
Assert.Contains("gfxrenderer vulkan", installation.Files.ReadAllText(UserIni));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_change_on_disk_not_read_again_is_not_lost_on_the_next_save()
|
||||
{
|
||||
var installation = WithIni("gfxrenderer default\nfieldofview 45\nvsync no\n");
|
||||
var store = installation.SettingsStore;
|
||||
Edited(installation, "gfxrenderer vulkan\nfieldofview 45\nvsync yes\n");
|
||||
Assert.True(store.HasChangeOnDiskToAskAbout());
|
||||
|
||||
// "Wczytać ponownie?" - no: not asked again about the same change.
|
||||
store.LeaveChangeOnDisk();
|
||||
Assert.False(store.HasChangeOnDiskToAskAbout());
|
||||
|
||||
store.Settings.FieldOfView = 60;
|
||||
store.Save();
|
||||
|
||||
string saved = installation.Files.ReadAllText(UserIni);
|
||||
Assert.Contains("gfxrenderer vulkan", saved);
|
||||
Assert.Contains("vsync yes", saved);
|
||||
Assert.Contains("fieldofview 60", saved);
|
||||
Assert.True(store.LastSaveMerged);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_later_change_on_disk_is_asked_about_again()
|
||||
{
|
||||
var installation = WithIni("fieldofview 45\n");
|
||||
var store = installation.SettingsStore;
|
||||
Edited(installation, "fieldofview 50\n");
|
||||
store.LeaveChangeOnDisk();
|
||||
|
||||
installation.Files.WithFile(UserIni, "fieldofview 55\n")
|
||||
.WrittenAt(UserIni, installation.Files.GetLastWriteTimeUtc(UserIni).AddMinutes(1));
|
||||
|
||||
Assert.True(store.HasChangeOnDiskToAskAbout());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void A_file_nobody_else_touched_saves_as_before()
|
||||
{
|
||||
@@ -97,6 +162,8 @@ public class ExternalIniTests
|
||||
Assert.False(unreadable.ContainsKey("gfxrenderer"));
|
||||
Assert.False(unreadable.ContainsKey("gfx.framebuffer.width"));
|
||||
Assert.False(unreadable.ContainsKey("calibratein"));
|
||||
// The default features in another order: the same line.
|
||||
Assert.False(WithIni("uartfeature local|main|scnd|train\n").SettingsStore.UnreadableValues().ContainsKey("uartfeature"));
|
||||
// The file keeps what it says until the setting is changed.
|
||||
installation.SettingsStore.Save();
|
||||
Assert.Contains("fieldofview abc", installation.Files.ReadAllText(UserIni));
|
||||
|
||||
Reference in New Issue
Block a user