test: replace streaming source freezes
This commit is contained in:
parent
5a33369074
commit
0ad2ee1cdf
6 changed files with 436 additions and 285 deletions
|
|
@ -4,6 +4,7 @@ using System.Collections.Immutable;
|
|||
using AcDream.App.Rendering;
|
||||
using AcDream.App.Rendering.Wb;
|
||||
using AcDream.App.Streaming;
|
||||
using AcDream.App.Tests.Architecture;
|
||||
using AcDream.Core.Terrain;
|
||||
using AcDream.Core.World;
|
||||
using DatReaderWriter.DBObjs;
|
||||
|
|
@ -306,18 +307,27 @@ public sealed class LandblockRenderPublisherTests
|
|||
[Fact]
|
||||
public void GameWindow_HasNoDirectRenderPublicationBodies()
|
||||
{
|
||||
string source = File.ReadAllText(Path.Combine(
|
||||
FindRepoRoot(),
|
||||
"src",
|
||||
"AcDream.App",
|
||||
"Rendering",
|
||||
"GameWindow.cs"));
|
||||
IReadOnlyList<CompiledCall> calls =
|
||||
CompiledCallGraph.ReadDeclared(typeof(GameWindow));
|
||||
Assert.DoesNotContain(
|
||||
calls,
|
||||
call => call.Target.DeclaringType == typeof(TerrainModernRenderer)
|
||||
&& call.Target.Name == nameof(TerrainModernRenderer.AddLandblockWithMesh));
|
||||
Assert.DoesNotContain(
|
||||
calls,
|
||||
call => call.Target.DeclaringType == typeof(CellVisibility)
|
||||
&& call.Target.Name == nameof(CellVisibility.CommitLandblock));
|
||||
Assert.DoesNotContain(
|
||||
calls,
|
||||
call => call.Target.DeclaringType == typeof(EnvCellRenderer)
|
||||
&& call.Target.Name == nameof(EnvCellRenderer.CommitLandblock));
|
||||
|
||||
Assert.DoesNotContain("_terrain.AddLandblockWithMesh", source, StringComparison.Ordinal);
|
||||
Assert.DoesNotContain("_cellVisibility.CommitLandblock", source, StringComparison.Ordinal);
|
||||
Assert.DoesNotContain("_buildingRegistries", source, StringComparison.Ordinal);
|
||||
Assert.DoesNotContain("_envCellRenderer?.CommitLandblock", source, StringComparison.Ordinal);
|
||||
Assert.DoesNotContain("EnsureEnvCellMeshesAfterPin", source, StringComparison.Ordinal);
|
||||
Assert.Null(typeof(GameWindow).GetMethod(
|
||||
"EnsureEnvCellMeshesAfterPin",
|
||||
BindingFlags.Instance | BindingFlags.NonPublic));
|
||||
Assert.DoesNotContain(
|
||||
typeof(GameWindow).GetFields(BindingFlags.Instance | BindingFlags.NonPublic),
|
||||
field => field.Name == "_buildingRegistries");
|
||||
}
|
||||
|
||||
private static LandblockRenderPublisher Publisher(
|
||||
|
|
@ -406,18 +416,6 @@ public sealed class LandblockRenderPublisherTests
|
|||
private static LandblockMeshData EmptyMesh() =>
|
||||
new(Array.Empty<TerrainVertex>(), Array.Empty<uint>());
|
||||
|
||||
private static string FindRepoRoot()
|
||||
{
|
||||
string? directory = AppContext.BaseDirectory;
|
||||
while (directory is not null)
|
||||
{
|
||||
if (File.Exists(Path.Combine(directory, "AcDream.slnx")))
|
||||
return directory;
|
||||
directory = Directory.GetParent(directory)?.FullName;
|
||||
}
|
||||
throw new DirectoryNotFoundException("Could not locate repository root.");
|
||||
}
|
||||
|
||||
private sealed class RecordingEnvCellPublisher :
|
||||
IEnvCellLandblockPublisher
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue