clean up spawn creature tests
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2024-08-28 12:34:44 -04:00
parent 0a74bed5d6
commit 50aaf3f1f5

View File

@ -1,48 +1,39 @@
package electrosphere.entity; package electrosphere.entity;
import org.junit.jupiter.api.BeforeEach; import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
import org.joml.Vector3d;
import org.junit.jupiter.api.Disabled;
import annotations.IntegrationTest;
import electrosphere.engine.Globals; import electrosphere.engine.Globals;
import electrosphere.engine.Main; import electrosphere.entity.types.creature.CreatureTemplate;
import electrosphere.engine.profiler.Profiler; import electrosphere.entity.types.creature.CreatureUtils;
import electrosphere.logger.LoggerInterface; import template.EntityTestTemplate;
import electrosphere.net.NetUtils; import testutils.TestEntityUtils;
public class SpawningCreaturesTest { /**
* Basic entity spawning integration tests
@BeforeEach */
public void initEngine(){ public class SpawningCreaturesTest extends EntityTestTemplate {
LoggerInterface.initLoggers();
LoggerInterface.loggerEngine.INFO("[Test] Spawn many creatures");
Globals.RUN_CLIENT = true;
Globals.RUN_SERVER = true;
Globals.HEADLESS = true;
Profiler.PROFILE = false;
NetUtils.setPort(0);
Main.startUp();
}
// @Test //must wait on viewport testing, otherwise number of entities isn't going to be correct because the player character is spawning
// public void testSpawnCreature(){ @Disabled
// System.out.println("[Test] Spawn creature"); @IntegrationTest
// Globals.RUN_CLIENT = false; public void testSpawnCreature(){
// Globals.RUN_SERVER = true; CreatureUtils.serverSpawnBasicCreature(Globals.realmManager.first(), new Vector3d(0,0,0), "human", CreatureTemplate.createDefault("human"));
// NetUtils.setPort(0); assertEquals(1, TestEntityUtils.numberOfEntitiesInBox(new Vector3d(-1,-1,-1),new Vector3d(1,1,1)));
// Main.startUp(); }
// CreatureUtils.spawnBasicCreature("human", null);
// Main.mainLoop(1);
// assert TestEntityUtils.numberOfEntitiesInBox(new Vector3d(-1,-1,-1),new Vector3d(1,1,1)) == 1;
// }
@Test //must wait on viewport testing, otherwise number of entities isn't going to be correct because the player character is spawning
@Disabled
@IntegrationTest
public void testSpawnMultipleCreatures(){ public void testSpawnMultipleCreatures(){
// Realm realm = Globals.realmManager.getRealms().iterator().next(); int numberToSpawn = 100;
// for(int i = 0; i < 100; i++){ for(int i = 0; i < numberToSpawn; i++){
// CreatureUtils.serverSpawnBasicCreature(realm, new Vector3d(0,0,0), "human", null); CreatureUtils.serverSpawnBasicCreature(Globals.realmManager.first(), new Vector3d(0,0,0), "human", CreatureTemplate.createDefault("human"));
// } }
// Main.mainLoop(1); assertEquals(numberToSpawn, TestEntityUtils.numberOfEntitiesInBox(new Vector3d(-1,-1,-1),new Vector3d(1,1,1)));
// assert TestEntityUtils.numberOfEntitiesInBox(new Vector3d(-1,-1,-1),new Vector3d(1,1,1)) == 100;
} }
} }