Renderer/src/test/java/electrosphere/entity/state/collidable/ClientCollidableTreeTests.java
austin f78c8b6633
All checks were successful
studiorailgun/Renderer/pipeline/head This commit looks good
falling tests
2024-09-05 00:13:50 -04:00

40 lines
1.3 KiB
Java

package electrosphere.entity.state.collidable;
import static org.junit.jupiter.api.Assertions.*;
import org.joml.Vector3d;
import annotations.IntegrationTest;
import electrosphere.engine.Globals;
import electrosphere.entity.Entity;
import electrosphere.entity.EntityTags;
import electrosphere.entity.state.movement.fall.ClientFallTree;
import electrosphere.entity.types.creature.CreatureTemplate;
import electrosphere.entity.types.creature.CreatureUtils;
import template.EntityTestTemplate;
import testutils.TestEngineUtils;
/**
* Tests for the client collidable component
*/
public class ClientCollidableTreeTests extends EntityTestTemplate {
@IntegrationTest
public void testCollidableFallCancel(){
//warm up engine
TestEngineUtils.simulateFrames(1);
//spawn on server
CreatureUtils.serverSpawnBasicCreature(Globals.realmManager.first(), new Vector3d(0,0,0), "human", CreatureTemplate.createDefault("human"));
//wait for the creature to land
TestEngineUtils.simulateFrames(3);
//get client entity
Entity clientEntity = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE).iterator().next();
//verify it was started on server
assertEquals(false, ClientFallTree.getFallTree(clientEntity).isFalling());
}
}