using System; using AcDream.App.Rendering.Wb; using Microsoft.Extensions.Logging.Abstractions; namespace AcDream.Core.Tests.Rendering.Wb; public sealed class WbMeshAdapterTests { [Fact] public void Construct_WithNullGpuDevice_ThrowsArgumentNull() { // gpuDevice is the first guarded parameter (Campaign V slice V11 deleted // the GL? gl parameter this test used to pass null through — the // constructor never null-checked it; this assertion was always really // exercising gpuDevice's guard). The real pipeline is tested via // integration. Assert.Throws(() => new WbMeshAdapter( gpuDevice: null!, dats: null!, logger: NullLogger.Instance)); } [Fact] public void Dispose_OnUninitializedAdapter_DoesNotThrow() { var adapter = WbMeshAdapter.CreateUninitialized(); adapter.Dispose(); // no-op when fields are null adapter.Dispose(); // idempotent } [Fact] public void IncrementRefCount_OnUninitializedAdapter_NoOps() { var adapter = WbMeshAdapter.CreateUninitialized(); // Should not throw, even though there's no underlying mesh manager. adapter.IncrementRefCount(0x01000001ul); } [Fact] public void DecrementRefCount_OnUninitializedAdapter_NoOps() { var adapter = WbMeshAdapter.CreateUninitialized(); adapter.DecrementRefCount(0x01000001ul); } [Fact] public void GetRenderData_OnUninitializedAdapter_ReturnsNull() { var adapter = WbMeshAdapter.CreateUninitialized(); Assert.Null(adapter.GetRenderData(0x01000001ul)); } [Fact] public void Tick_OnUninitializedAdapter_DoesNotThrow() { var adapter = WbMeshAdapter.CreateUninitialized(); adapter.Tick(); // no-op, no throw adapter.Tick(); // idempotent } [Fact] public void Tick_AfterDispose_DoesNotThrow() { var adapter = WbMeshAdapter.CreateUninitialized(); adapter.Dispose(); adapter.Tick(); // no-op, no throw } }