mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-12-03 11:41:37 +00:00
Test floating islands
This commit is contained in:
1 parent
d2094f3e6a
commit
d1b3299921
1 file changed
+54
@@ -0,0 +1,54 @@
|
|||||||
|
package art.arcane.iris.engine.modifier;
|
||||||
|
|
||||||
|
import art.arcane.iris.engine.framework.Engine;
|
||||||
|
import art.arcane.iris.engine.framework.EngineMetrics;
|
||||||
|
import art.arcane.iris.engine.framework.SeedManager;
|
||||||
|
import art.arcane.iris.engine.object.terrain.floating.FloatingIslandBoundarySampler;
|
||||||
|
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
||||||
|
import art.arcane.iris.spi.PlatformBlockState;
|
||||||
|
import art.arcane.iris.util.project.context.ChunkContext;
|
||||||
|
import art.arcane.iris.util.project.hunk.Hunk;
|
||||||
|
import art.arcane.volmlib.util.collection.KList;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
|
import static org.mockito.ArgumentMatchers.anyInt;
|
||||||
|
import static org.mockito.Mockito.mock;
|
||||||
|
import static org.mockito.Mockito.never;
|
||||||
|
import static org.mockito.Mockito.times;
|
||||||
|
import static org.mockito.Mockito.verify;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
/** A column whose biome declares no floating child biomes gets no island: nothing is written or decorated. */
|
||||||
|
public class FloatingIslandsTest {
|
||||||
|
private static final int CHUNK_ORIGIN = 32;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void columnsWithoutFloatingChildBiomesAreLeftAlone() {
|
||||||
|
FloatingIslands islands = new FloatingIslands(engine());
|
||||||
|
IrisBiome biome = mock(IrisBiome.class);
|
||||||
|
when(biome.getFloatingChildBiomes()).thenReturn(new KList<>());
|
||||||
|
FloatingIslandBoundarySampler sampler = mock(FloatingIslandBoundarySampler.class);
|
||||||
|
when(sampler.parent(anyInt(), anyInt())).thenReturn(biome);
|
||||||
|
ChunkContext context = mock(ChunkContext.class);
|
||||||
|
when(context.getFloatingIslandBoundarySampler()).thenReturn(sampler);
|
||||||
|
Hunk<PlatformBlockState> output = mock(Hunk.class);
|
||||||
|
when(output.getHeight()).thenReturn(64);
|
||||||
|
|
||||||
|
islands.fillSolids(CHUNK_ORIGIN, CHUNK_ORIGIN, output, false, context);
|
||||||
|
islands.decorateColumns(CHUNK_ORIGIN, CHUNK_ORIGIN, output, false, context);
|
||||||
|
|
||||||
|
verify(sampler, times(2)).parent(CHUNK_ORIGIN + 15, CHUNK_ORIGIN + 15);
|
||||||
|
verify(output, never()).set(anyInt(), anyInt(), anyInt(), any());
|
||||||
|
verify(output, never()).setRaw(anyInt(), anyInt(), anyInt(), any());
|
||||||
|
}
|
||||||
|
|
||||||
|
private Engine engine() {
|
||||||
|
SeedManager seeds = mock(SeedManager.class);
|
||||||
|
Engine engine = mock(Engine.class);
|
||||||
|
when(engine.getSeedManager()).thenReturn(seeds);
|
||||||
|
when(engine.getMetrics()).thenReturn(new EngineMetrics(16));
|
||||||
|
return engine;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user