clean up spawn creature tests
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
0a74bed5d6
commit
50aaf3f1f5
@ -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
|
||||||
|
*/
|
||||||
|
public class SpawningCreaturesTest extends EntityTestTemplate {
|
||||||
|
|
||||||
@BeforeEach
|
//must wait on viewport testing, otherwise number of entities isn't going to be correct because the player character is spawning
|
||||||
public void initEngine(){
|
@Disabled
|
||||||
LoggerInterface.initLoggers();
|
@IntegrationTest
|
||||||
LoggerInterface.loggerEngine.INFO("[Test] Spawn many creatures");
|
public void testSpawnCreature(){
|
||||||
Globals.RUN_CLIENT = true;
|
CreatureUtils.serverSpawnBasicCreature(Globals.realmManager.first(), new Vector3d(0,0,0), "human", CreatureTemplate.createDefault("human"));
|
||||||
Globals.RUN_SERVER = true;
|
assertEquals(1, TestEntityUtils.numberOfEntitiesInBox(new Vector3d(-1,-1,-1),new Vector3d(1,1,1)));
|
||||||
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;
|
|
||||||
// Globals.RUN_SERVER = true;
|
|
||||||
// NetUtils.setPort(0);
|
|
||||||
// Main.startUp();
|
|
||||||
// CreatureUtils.spawnBasicCreature("human", null);
|
|
||||||
// Main.mainLoop(1);
|
|
||||||
// assert TestEntityUtils.numberOfEntitiesInBox(new Vector3d(-1,-1,-1),new Vector3d(1,1,1)) == 1;
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Test
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user