fix(settings): an imported ini moved to the trains' tapes too, a closed tape window forgets only its own tape

- ImportFrom moves an ini of before the trains' tapes as a profile is
- HaslerTapes.Forget takes the file: a window closing lets go of its own tape, not of the one
  another window follows
This commit is contained in:
maj00r
2026-11-16 00:09:36 +01:00
parent 13990a7036
commit 76693c1494
5 changed files with 50 additions and 5 deletions

View File

@@ -182,6 +182,26 @@ public class HaslerTapeTests
Assert.Equal(18, Assert.Single(tapes.Load(file, follow: true)!.Samples).SpeedKmh, 6);
}
[Fact]
public void Forgetting_another_file_keeps_the_followed_tape_and_its_own_lets_it_go()
{
string Lines(int firstSpeed, int count) =>
Header + Line(0, firstSpeed, 0, 0) + string.Concat(Enumerable.Range(1, count).Select(t => Line(t, 36, 0, 0)));
string path = TestInstallation.At("physicslog", "EU07-424.dat");
var files = new InMemoryFileSystem().WithFile(path, Lines(36, 20));
var tapes = new TestInstallation(files).Tapes;
var file = Assert.Single(tapes.List());
tapes.Load(file, follow: false);
// the first line changed, as long as it was and far from the end: a tape still followed doesn't read it again
files.WithFile(path, Lines(72, 21));
tapes.Forget(TestInstallation.At("physicslog", "EU07-111.dat"));
Assert.Equal(36, tapes.Load(file, follow: true)!.Samples[0].SpeedKmh, 6);
tapes.Forget(file.Path);
Assert.Equal(72, tapes.Load(file, follow: true)!.Samples[0].SpeedKmh, 6);
}
[Fact]
public void The_sample_under_a_point_of_the_tape_is_found_by_time_and_by_distance()
{