acdream/tests/AcDream.App.Tests/World/GameWindowLiveEntityCompositionTests.cs
Erik 69a2ca0c6d refactor(world): extract live projection mechanics
Move appearance rebinding, collision construction, default-pose resolution, local shadow ownership, and exact leave-world presentation into focused owners. Preserve retail parent ordering with staged validation, committed recovery, recursive attached-subtree withdrawal, and retryable exact teardown across parent, pickup, position, unwield, and pose-loss edges.

Co-Authored-By: OpenAI Codex <codex@openai.com>
2026-07-21 16:17:03 +02:00

51 lines
2 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")]
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))]
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);
}
}
}