Table of Contents

Class TerrainAssert

Namespace
Valheim.Testing.Doubles
Assembly
Valheim.Testing.Doubles.dll

Assertions over terrain compiler doubles. Each throws TerrainAssertException naming the first offending vertices.

public static class TerrainAssert
Inheritance
object
TerrainAssert

Methods

OnlyChangedWithin(TerrainSnapshot, TerrainComp, Func<float, float, bool>, string, bool)

Every change since the snapshot lies where allowed (world x, z) says a change may be; the rest of the zone, flags included, is exactly as it was. Also fails when nothing changed at all, since a check that passes on an untouched zone cannot tell a write from no write; pass requireChange false when no change is the expectation.

public static void OnlyChangedWithin(TerrainSnapshot before, TerrainComp after, Func<float, float, bool> allowed, string what = "zone", bool requireChange = true)

Parameters

before TerrainSnapshot
after TerrainComp
allowed Func<float, float, bool>
what string
requireChange bool

SeamAgrees(Heightmap, Heightmap, float)

Two loaded neighbouring zones agree on the vertices they share: rendered heights within tolerance metres (rebuild both first) and identical paint. A zone written without its neighbour shows a step or a paint edge along the seam.

public static void SeamAgrees(Heightmap a, Heightmap b, float tolerance = 0.001)

Parameters

a Heightmap
b Heightmap
tolerance float

Unchanged(TerrainSnapshot, TerrainComp, string)

The compiler is exactly as it was in the snapshot.

public static void Unchanged(TerrainSnapshot before, TerrainComp after, string what = "zone")

Parameters

before TerrainSnapshot
after TerrainComp
what string

VertexPosition(Heightmap, int, int)

The world x, z of a compiler vertex (row-major, (width + 1) per row, centred on the heightmap).

public static (float X, float Z) VertexPosition(Heightmap heightmap, int width, int index)

Parameters

heightmap Heightmap
width int
index int

Returns

(float X, float Z)