using AcDream.Core.Meshing; using Xunit; namespace AcDream.Core.Tests.Meshing; /// /// #79/#93 (2026-07-09) — the Town Network fountain room's only dat-authored /// light (Setup 0x02000365, a ceiling fixture) never registered: its sole /// visual part is a #136-class runtime-hidden marker, so it flattens to zero /// mesh refs, and GameWindow.cs's hydration loop dropped the ENTIRE entity — /// light included — whenever meshRefs was empty. Retail's light registration /// (CObjCell::add_light, CEnvCell::UnPack) is entirely independent of a /// fixture's own mesh visibility; the mesh-empty gate must not also swallow /// a Setup's Lights. /// public class EntityHydrationRulesTests { [Fact] public void ShouldKeepEntity_NoMeshNoLights_False() { Assert.False(EntityHydrationRules.ShouldKeepEntity(meshRefCount: 0, setupLightCount: 0)); } [Fact] public void ShouldKeepEntity_NoMeshWithLights_True() { // The exact fountain-room case: a mesh-less "light attach point" must // still survive hydration so its Lights can be registered. Assert.True(EntityHydrationRules.ShouldKeepEntity(meshRefCount: 0, setupLightCount: 1)); } [Fact] public void ShouldKeepEntity_HasMesh_TrueRegardlessOfLights() { Assert.True(EntityHydrationRules.ShouldKeepEntity(meshRefCount: 1, setupLightCount: 0)); Assert.True(EntityHydrationRules.ShouldKeepEntity(meshRefCount: 3, setupLightCount: 2)); } }