diff options
Diffstat (limited to 'src/LivingVillage.Desktop.Tests')
| -rw-r--r-- | src/LivingVillage.Desktop.Tests/P16UiTests.fs | 4 | ||||
| -rw-r--r-- | src/LivingVillage.Desktop.Tests/PrototypeTests.fs | 35 |
2 files changed, 30 insertions, 9 deletions
diff --git a/src/LivingVillage.Desktop.Tests/P16UiTests.fs b/src/LivingVillage.Desktop.Tests/P16UiTests.fs index b071dfa..2e474ac 100644 --- a/src/LivingVillage.Desktop.Tests/P16UiTests.fs +++ b/src/LivingVillage.Desktop.Tests/P16UiTests.fs @@ -111,6 +111,10 @@ type P16HudTests () = Assert.AreEqual<string>("夜晚", M6Presentation.timePeriodLabel 0L) Assert.AreEqual<string>("清晨", M6Presentation.timePeriodLabel (6L * ticksPerHour)) Assert.AreEqual<string>("黄昏", M6Presentation.timePeriodLabel (19L * ticksPerHour)) + // P18: 黄昏 covers the golden hour through 20:59; 21:00 onwards is 夜晚. + Assert.AreEqual<string>("黄昏", M6Presentation.timePeriodLabel (20L * ticksPerHour)) + Assert.AreEqual<string>("黄昏", M6Presentation.timePeriodLabel (int64 20 * ticksPerHour + ticksPerHour * 3L / 4L)) + Assert.AreEqual<string>("夜晚", M6Presentation.timePeriodLabel (21L * ticksPerHour)) [<TestMethod>] member _.HudNightPaletteLeansCoolAndLabelsAreAtlasBacked () = diff --git a/src/LivingVillage.Desktop.Tests/PrototypeTests.fs b/src/LivingVillage.Desktop.Tests/PrototypeTests.fs index b250824..895dff8 100644 --- a/src/LivingVillage.Desktop.Tests/PrototypeTests.fs +++ b/src/LivingVillage.Desktop.Tests/PrototypeTests.fs @@ -865,37 +865,54 @@ type PrototypeTests () = Assert.AreEqual<float32>(0.5f, (M6Presentation.lightingAtTick dawnMidTick).Blend) Assert.AreEqual<float32>(0.0f, (M6Presentation.lightingAtTick dawnEndTick).Blend) - // Dusk ramp 19:30 -> 22:00 goes day -> night monotonically. - let duskStartTick = int64 19 * ticksPerHour + ticksPerHour / 2L // 19:30 - let duskMidTick = int64 20 * ticksPerHour + ticksPerHour * 3L / 4L // 20:45 + // P18: dusk darkening ramp is 20:00 -> 22:00 (day -> night, monotonic). + let duskStartTick = int64 20 * ticksPerHour // 20:00 + let duskMidTick = int64 21 * ticksPerHour // 21:00 Assert.AreEqual<float32>(0.0f, (M6Presentation.lightingAtTick duskStartTick).Blend) Assert.AreEqual<float32>(0.5f, (M6Presentation.lightingAtTick duskMidTick).Blend) Assert.AreEqual<float32>(1.0f, (atHour 22).Blend) - // Blue hour: the transition lingers past 6:00 and starts before 20:00. + // Blue hour: the dawn lingers past 6:00; dusk stays light while it warms. Assert.IsTrue((atHour 6).Blend > 0.0f && (atHour 6).Blend < 0.5f) - Assert.IsTrue((atHour 20).Blend > 0.0f && (atHour 20).Blend < 0.5f) + let duskGlowTick = int64 20 * ticksPerHour + ticksPerHour / 2L // 20:30 + Assert.IsTrue((M6Presentation.lightingAtTick duskGlowTick).Blend > 0.0f) + Assert.IsTrue((M6Presentation.lightingAtTick duskGlowTick).Blend < 0.5f, "20:30 must still be Day mode for a visible golden dusk") + Assert.AreEqual<M6DayNight>(Day, (M6Presentation.lightingAtTick duskGlowTick).Mode) - // Golden-hour warmth peaks mid-dawn/mid-dusk and vanishes at noon/midnight. + // Golden-hour warmth peaks mid-dawn (5:15) / mid-dusk (20:30) and vanishes at noon/midnight. + let duskWarmthMidTick = int64 20 * ticksPerHour + ticksPerHour / 2L // 20:30 Assert.AreEqual<float32>(0.0f, (atHour 12).SkyWarmth) Assert.AreEqual<float32>(0.0f, (atHour 0).SkyWarmth) Assert.AreEqual<float32>(1.0f, (M6Presentation.lightingAtTick dawnMidTick).SkyWarmth) - Assert.AreEqual<float32>(1.0f, (M6Presentation.lightingAtTick duskMidTick).SkyWarmth) + Assert.AreEqual<float32>(1.0f, (M6Presentation.lightingAtTick duskWarmthMidTick).SkyWarmth) Assert.IsTrue((atHour 5).SkyWarmth > 0.5f) Assert.IsTrue((atHour 21).SkyWarmth > 0.5f) - // The warm shift pushes the sky redder and less blue than the plain blend. + // The warm shift pushes sky and world tint redder and less blue than the plain blend; + // this is what made the old dusk frame still read blue-grey. let warmDawn = atHour 5 + let warmDusk = M6Presentation.lightingAtTick duskGlowTick Assert.IsTrue(warmDawn.Background.R > (M6Presentation.backgroundAtBlend warmDawn.Blend).R) Assert.IsTrue(warmDawn.Background.B < (M6Presentation.backgroundAtBlend warmDawn.Blend).B) + Assert.IsTrue(warmDusk.Background.R > (M6Presentation.backgroundAtBlend warmDusk.Blend).R) + Assert.IsTrue(warmDusk.Background.B < (M6Presentation.backgroundAtBlend warmDusk.Blend).B) + Assert.IsTrue(warmDusk.WorldTint.R > (M6Presentation.worldTintAtBlend warmDusk.Blend).R) + Assert.IsTrue(warmDusk.WorldTint.B < (M6Presentation.worldTintAtBlend warmDusk.Blend).B) + // Additive veil: positive and strongest at the golden peaks, zero at noon/midnight. + Assert.AreEqual<int>(0, M6Presentation.goldenVeilAlpha (int64 12 * ticksPerHour)) + Assert.AreEqual<int>(0, M6Presentation.goldenVeilAlpha 0L) + Assert.AreEqual<int>(150, M6Presentation.goldenVeilAlpha duskWarmthMidTick) + Assert.IsTrue(M6Presentation.goldenVeilAlpha duskGlowTick > 100) + Assert.IsTrue(M6Presentation.goldenVeilAlpha (int64 19 * ticksPerHour) = 0, "veil must start after 19:15, not bleed into afternoon") // Determinism without randomness. let once = atHour 13 let twice = atHour 13 Assert.AreEqual<M6RenderProfile>(once, twice) - // Lantern glow: warm halo only rises with night blend. + // Lantern glow now also lifts through the golden hour, not only at deep night. Assert.AreEqual<float32>(0.0f, (atHour 13).LanternGlow) Assert.AreEqual<float32>(1.0f, (atHour 0).LanternGlow) + Assert.IsTrue(warmDusk.LanternGlow > 0.5f) // Evidence hook: fractional start hours map exactly onto sim ticks. Assert.AreEqual<int64>(int64 20 * ticksPerHour + ticksPerHour * 3L / 4L, M6Presentation.startTickForHour 20.75) |
