mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-19 06:55:59 +01:00
fix(sceneries): an .sbt in the way of terrain files that are there can go
Any terrain directive kept the scenery's .sbt, as if it brought the terrain from elsewhere. The directive names either .sbt files, which nothing makes again, or terrain files (.txtf) with their binary copies (.btf). A scenery with the terrain files has no use for its own .sbt: the simulator never writes one for it, and an old one keeps the terrain files from being used. - An .sbt named by the directive still keeps the scenery's own. - A .txtf, or its .btf, on disk lets the scenery's .sbt go; with neither, the .sbt stays and the missing .txtf is given as the reason.
This commit is contained in:
@@ -91,6 +91,46 @@ public class BinaryTerrainFilesTests
|
||||
Assert.Equal("td.sbt", Assert.Single(Build(files).CleanUpOnce(1)!.Kept).File);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData("td/teren.txtf")]
|
||||
[InlineData("td/Teren.btf")]
|
||||
public void An_sbt_in_the_way_of_terrain_files_that_are_there_goes(string onDisk)
|
||||
{
|
||||
var files = new InMemoryFileSystem(caseSensitive: true)
|
||||
.WithLegacyFile(Scenery("td.scn"), "terrain td/teren.txtf endterrain\nFirstInit\n")
|
||||
.WithFile(Scenery(onDisk), "x")
|
||||
.WithFile(Scenery("td.sbt"), "EU07SBT2");
|
||||
|
||||
Assert.Single(Build(files).CleanUpOnce(1)!.Deleted);
|
||||
Assert.False(files.FileExists(Scenery("td.sbt")));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void An_sbt_standing_in_for_a_missing_terrain_file_stays()
|
||||
{
|
||||
var files = new InMemoryFileSystem()
|
||||
.WithLegacyFile(Scenery("td.scn"), "terrain td/a.txtf td/b.txtf endterrain\nFirstInit\n")
|
||||
.WithFile(Scenery("td/a.txtf"), "x")
|
||||
.WithFile(Scenery("td.sbt"), "EU07SBT2");
|
||||
|
||||
Assert.Equal(("td.sbt", "td/b.txtf"), Assert.Single(Build(files).CleanUpOnce(1)!.Kept));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void An_sbt_named_beside_terrain_files_keeps_the_scenery_s_own()
|
||||
{
|
||||
var files = new InMemoryFileSystem()
|
||||
.WithLegacyFile(Scenery("td.scn"), "terrain td/a.txtf wspolny.sbt endterrain\nFirstInit\n")
|
||||
.WithFile(Scenery("td/a.txtf"), "x")
|
||||
.WithFile(Scenery("wspolny.sbt"), "EU07SBT2")
|
||||
.WithFile(Scenery("td.sbt"), "EU07SBT2");
|
||||
|
||||
var cleanup = Build(files).CleanUpOnce(1)!;
|
||||
|
||||
Assert.Empty(cleanup.Deleted);
|
||||
Assert.Contains(("td.sbt", "terrain wspolny.sbt"), cleanup.Kept);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void An_sbt_of_no_scenery_stays()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user