acdream/tests/AcDream.App.Tests/World/GameWindowLiveEntityCompositionTests.cs
Erik fe5514967c refactor(world): extract live appearance and parenting
Move ObjDesc, Parent, Pickup, child-ready, and retained projection recovery into LiveEntityHydrationController while preserving retail timestamp and leave-world semantics. Pin ready publication to exact projection authority and restore attached descendant chains synchronously.
2026-07-21 18:10:07 +02:00

62 lines
2.5 KiB
C#

using System.Collections;
using System.Reflection;
using AcDream.App.Physics;
using AcDream.App.Rendering;
using AcDream.App.World;
namespace AcDream.App.Tests.World;
public sealed class GameWindowLiveEntityCompositionTests
{
private const BindingFlags PrivateImplementation =
BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic;
[Theory]
[InlineData("RegisterLiveEntityCollision")]
[InlineData("MotionTableDefaultPose")]
[InlineData("LeaveWorldLiveEntityRuntimeComponents")]
[InlineData("WithdrawLiveEntityWorldProjection")]
[InlineData("RebindAnimatedEntityForAppearance")]
[InlineData("OnLiveEntitySpawned")]
[InlineData("OnLiveEntitySpawnedLocked")]
[InlineData("RehydrateServerEntitiesForLandblock")]
[InlineData("TryInitializeLiveCenter")]
[InlineData("CompleteLiveEntityReady")]
[InlineData("OnLiveAppearanceUpdated")]
[InlineData("OnLiveEntityPickedUp")]
[InlineData("OnLiveParentUpdated")]
[InlineData("TryAcceptParentForRender")]
public void GameWindow_DoesNotReacquireExtractedLiveEntityBodies(string methodName)
{
Assert.Null(typeof(GameWindow).GetMethod(methodName, PrivateImplementation));
}
[Fact]
public void GameWindow_DoesNotOwnAnAppearanceUpdateStateType()
{
Assert.Null(typeof(GameWindow).GetNestedType(
"AppearanceUpdateState",
BindingFlags.NonPublic));
}
[Theory]
[InlineData(typeof(LiveEntityCollisionBuilder))]
[InlineData(typeof(LiveEntityDefaultPoseResolver))]
[InlineData(typeof(LiveEntityProjectionWithdrawalController))]
[InlineData(typeof(LocalPlayerShadowState))]
[InlineData(typeof(LiveEntityAppearanceBinding))]
[InlineData(typeof(LiveEntityHydrationController))]
[InlineData(typeof(DatLiveEntityProjectionMaterializer))]
public void ExtractedHelpers_DoNotOwnGuidIndexesOrBackendState(Type helperType)
{
foreach (FieldInfo field in helperType.GetFields(
BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic))
{
Assert.False(typeof(IDictionary).IsAssignableFrom(field.FieldType),
$"{helperType.Name}.{field.Name} must resolve identity through LiveEntityRuntime.");
string typeName = field.FieldType.FullName ?? field.FieldType.Name;
Assert.DoesNotContain("Silk.NET", typeName, StringComparison.Ordinal);
Assert.DoesNotContain("OpenGL", typeName, StringComparison.OrdinalIgnoreCase);
}
}
}