test: replace composition source freezes
This commit is contained in:
parent
caa5eb8b2b
commit
80c7b44457
8 changed files with 471 additions and 406 deletions
|
|
@ -1,6 +1,10 @@
|
|||
using System.Reflection;
|
||||
using AcDream.App.Composition;
|
||||
using AcDream.App.Physics;
|
||||
using AcDream.App.Rendering;
|
||||
using AcDream.App.Rendering.Wb;
|
||||
using AcDream.App.Streaming;
|
||||
using AcDream.App.Tests.Architecture;
|
||||
using AcDream.App.World;
|
||||
using AcDream.Core.Net;
|
||||
using AcDream.Core.Physics.Motion;
|
||||
|
|
@ -125,71 +129,29 @@ public sealed class LivePresentationCompositionTests
|
|||
[Fact]
|
||||
public void GameWindowUsesLivePhaseAndContainsNoPhaseSixConstructionBody()
|
||||
{
|
||||
string root = FindRepoRoot();
|
||||
string window = File.ReadAllText(Path.Combine(
|
||||
root,
|
||||
"src",
|
||||
"AcDream.App",
|
||||
"Rendering",
|
||||
"GameWindow.cs"));
|
||||
string phase = File.ReadAllText(Path.Combine(
|
||||
root,
|
||||
"src",
|
||||
"AcDream.App",
|
||||
"Composition",
|
||||
"LivePresentationComposition.cs"));
|
||||
IReadOnlyList<CompiledCall> windowCalls =
|
||||
CompiledCallGraph.ReadDeclared(typeof(GameWindow));
|
||||
|
||||
Assert.Contains("new LivePresentationCompositionPhase(", window);
|
||||
Assert.DoesNotContain("new AcDream.App.World.LiveEntityRuntime(", window);
|
||||
Assert.DoesNotContain("new AcDream.App.Rendering.Wb.WbDrawDispatcher(", window);
|
||||
Assert.DoesNotContain("new AcDream.App.Streaming.LandblockRenderPublisher(", window);
|
||||
Assert.DoesNotContain("_portalTunnelFallback.AcquirePrepared(", window);
|
||||
Assert.Contains("new LiveEntityRuntime(", phase);
|
||||
Assert.Contains("new WbDrawDispatcher(", phase);
|
||||
Assert.Contains("new LandblockRenderPublisher(", phase);
|
||||
Assert.Contains("d.PortalTunnelFallback.AcquirePrepared(", phase);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Campaign V slice V6m: portal space is composed on BOTH arms. It was the
|
||||
/// last renderer this phase built only when a GL context existed, and the
|
||||
/// Vulkan arm's portal-less teleport presentation went with the condition —
|
||||
/// so both the gate and the stand-in are asserted absent here.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void PortalSpaceIsComposedOnBothBackendArms()
|
||||
{
|
||||
string root = FindRepoRoot();
|
||||
string phase = File.ReadAllText(Path.Combine(
|
||||
root,
|
||||
"src",
|
||||
"AcDream.App",
|
||||
"Composition",
|
||||
"LivePresentationComposition.cs"));
|
||||
string session = File.ReadAllText(Path.Combine(
|
||||
root,
|
||||
"src",
|
||||
"AcDream.App",
|
||||
"Composition",
|
||||
"SessionPlayerComposition.cs"));
|
||||
|
||||
Assert.Contains(
|
||||
"if (dispatcherLease.Resource is { } portalDispatcher)",
|
||||
phase);
|
||||
Assert.Single(
|
||||
windowCalls,
|
||||
call => call.Target.DeclaringType
|
||||
== typeof(LivePresentationCompositionPhase)
|
||||
&& call.Target.IsConstructor);
|
||||
Assert.DoesNotContain(
|
||||
"if (gl is not null && dispatcherLease.Resource is { } portalDispatcher)",
|
||||
phase);
|
||||
Assert.DoesNotContain("NullLocalPlayerTeleportPresentation", session);
|
||||
windowCalls,
|
||||
call => call.Target.IsConstructor
|
||||
&& call.Target.DeclaringType is { } type
|
||||
&& (type == typeof(LiveEntityRuntime)
|
||||
|| type == typeof(WbDrawDispatcher)
|
||||
|| type == typeof(LandblockRenderPublisher)));
|
||||
Assert.DoesNotContain(
|
||||
"NullLocalPlayerTeleportPresentation",
|
||||
File.ReadAllText(Path.Combine(
|
||||
root,
|
||||
"src",
|
||||
"AcDream.App",
|
||||
"Rendering",
|
||||
"Gpu",
|
||||
"Vk",
|
||||
"VulkanCompositionFramePhases.cs")));
|
||||
windowCalls,
|
||||
call => call.Target.Name == "AcquirePrepared");
|
||||
|
||||
Assert.DoesNotContain(
|
||||
typeof(LivePresentationCompositionPhase).GetFields(
|
||||
BindingFlags.Instance | BindingFlags.NonPublic),
|
||||
field => field.FieldType == typeof(GameWindow));
|
||||
}
|
||||
|
||||
private static LiveEntityRuntime Runtime() => LiveEntityRuntimeFixture.Create(
|
||||
|
|
@ -250,15 +212,4 @@ public sealed class LivePresentationCompositionTests
|
|||
}
|
||||
}
|
||||
|
||||
private static string FindRepoRoot()
|
||||
{
|
||||
DirectoryInfo? directory = new(AppContext.BaseDirectory);
|
||||
while (directory is not null)
|
||||
{
|
||||
if (File.Exists(Path.Combine(directory.FullName, "AcDream.slnx")))
|
||||
return directory.FullName;
|
||||
directory = directory.Parent;
|
||||
}
|
||||
throw new DirectoryNotFoundException("Could not find AcDream.slnx.");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue