67 lines
2.7 KiB
C#
67 lines
2.7 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")]
|
|
[InlineData("OnLiveEntityDeleted")]
|
|
[InlineData("OnLiveEntityPruned")]
|
|
[InlineData("TearDownLiveEntityRuntimeComponents")]
|
|
[InlineData("CreateLiveEntityRuntimeTeardownPlan")]
|
|
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))]
|
|
[InlineData(typeof(LiveEntityRuntimeTeardownController))]
|
|
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);
|
|
}
|
|
}
|
|
}
|