diff --git a/StarterNG.Tests/MiniTextureIndexTests.cs b/StarterNG.Tests/MiniTextureIndexTests.cs
index a4b61d0..294c292 100644
--- a/StarterNG.Tests/MiniTextureIndexTests.cs
+++ b/StarterNG.Tests/MiniTextureIndexTests.cs
@@ -12,7 +12,7 @@ public class MiniTextureIndexTests
"406r", "424z", "621z", "z1kd", "gags", "eaos", "falns", "uacs", "sgs", "kbs"
};
- private static MiniTextureIndex Build(int missRate)
+ private static MiniTextureIndex Build(int? missRate)
{
var files = new InMemoryFileSystem();
foreach (string name in Names)
@@ -20,14 +20,14 @@ public class MiniTextureIndexTests
files.WithFile(TestInstallation.At("textures", "mini", "other.bmp"), "bitmap");
var environment = new FakeEnvironment();
- if (missRate > 0)
- environment.With(MiniTextureIndex.MissRateVariable, missRate.ToString());
+ if (missRate is { } rate)
+ environment.With(MiniTextureIndex.MissRateVariable, rate.ToString());
return new MiniTextureIndex(files, new GamePaths(TestInstallation.Root), environment);
}
[Fact]
- public void Without_the_debug_variable_every_thumbnail_loads()
+ public void Setting_the_variable_to_zero_shows_the_installation_as_it_is()
{
var index = Build(missRate: 0);
@@ -35,6 +35,18 @@ public class MiniTextureIndexTests
Assert.All(Names, name => Assert.True(index.Has(name)));
}
+ [Fact]
+ public void The_temporary_default_still_hides_half_the_thumbnails()
+ {
+ // Guards the testing default in MiniTextureIndex.DefaultMissRate. When
+ // that goes back to 0 for release, this test is what says so - change it
+ // together with the constant, do not delete it quietly.
+ var index = Build(missRate: null);
+
+ Assert.Equal(50, index.SimulatedMissRate);
+ Assert.Contains(Names, name => !index.Has(name));
+ }
+
[Fact]
public void The_debug_variable_hides_roughly_the_share_it_names()
{
diff --git a/StarterNG/Infrastructure/Vehicles/MiniTextureIndex.cs b/StarterNG/Infrastructure/Vehicles/MiniTextureIndex.cs
index 09c6ba4..0e91337 100644
--- a/StarterNG/Infrastructure/Vehicles/MiniTextureIndex.cs
+++ b/StarterNG/Infrastructure/Vehicles/MiniTextureIndex.cs
@@ -20,14 +20,24 @@ public sealed class MiniTextureIndex : IMiniTextureIndex
private const string FallbackName = "other";
///
- /// Set to 1-100 to make that percentage of thumbnails behave as if the
- /// installation did not have their file - the vehicle then falls back to
- /// other.bmp exactly as one naming an unknown thumbnail would. For checking
- /// how a consist looks when some of its stock has no picture of its own.
- /// Off unless the variable is set.
+ /// Set to 0-100 to override : the percentage of
+ /// thumbnails that behave as if the installation did not have their file, so
+ /// the vehicle falls back to other.bmp exactly as one naming an unknown
+ /// thumbnail would. Set it to 0 to see the installation as it really is.
///
public const string MissRateVariable = "STARTER_DEBUG_MISSING_MINI";
+ ///
+ /// TEMPORARY, FOR TESTING THE MISSING-THUMBNAIL DRAWING. Half the vehicles in
+ /// every consist will show the other.bmp stand-in instead of their own
+ /// picture, whether or not the installation is complete.
+ ///
+ /// Set this back to 0 before release - it is the whole of the switch, and
+ /// MiniTextureIndexTests.The_temporary_default_still_hides_half_the_thumbnails
+ /// fails the moment it changes, so nothing ships it by accident.
+ ///
+ private const int DefaultMissRate = 50;
+
private readonly IFileSystem _files;
private readonly IGamePaths _paths;
private readonly int _missRate;
@@ -93,7 +103,7 @@ public sealed class MiniTextureIndex : IMiniTextureIndex
string? raw = environment?.GetVariable(MissRateVariable);
return int.TryParse(raw, NumberStyles.Integer, CultureInfo.InvariantCulture, out int rate)
? Math.Clamp(rate, 0, 100)
- : 0;
+ : DefaultMissRate;
}
private Dictionary Index()