viewport loading integration with testing
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
a95086e6db
commit
95aff671c9
@ -1,5 +1,7 @@
|
||||
package electrosphere.engine.loadingthreads;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
|
||||
import annotations.IntegrationTest;
|
||||
import electrosphere.engine.Main;
|
||||
import testutils.EngineInit;
|
||||
@ -12,14 +14,16 @@ public class ViewportLoadingTests {
|
||||
|
||||
@IntegrationTest
|
||||
public void testViewportLoading(){
|
||||
//init engine
|
||||
TestEngineUtils.initGraphicalEngine();
|
||||
|
||||
//load scene
|
||||
EngineInit.setupConnectedTestScene();
|
||||
Assertions.assertDoesNotThrow(() -> {
|
||||
//init engine
|
||||
TestEngineUtils.initGraphicalEngine();
|
||||
|
||||
//load scene
|
||||
EngineInit.setupConnectedTestViewport();
|
||||
|
||||
//shutdown engine
|
||||
Main.shutdown();
|
||||
//shutdown engine
|
||||
Main.shutdown();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3,12 +3,15 @@ package electrosphere.entity.state.attack;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||
|
||||
import org.joml.Vector3d;
|
||||
|
||||
import annotations.IntegrationTest;
|
||||
import electrosphere.controls.ControlHandler;
|
||||
import electrosphere.engine.Globals;
|
||||
import electrosphere.entity.Entity;
|
||||
import electrosphere.entity.state.attack.ClientAttackTree.AttackTreeState;
|
||||
import electrosphere.server.datacell.utils.EntityLookupUtils;
|
||||
import electrosphere.entity.types.creature.CreatureTemplate;
|
||||
import electrosphere.entity.types.creature.CreatureUtils;
|
||||
import template.EntityTestTemplate;
|
||||
import testutils.InputAPI;
|
||||
import testutils.TestEngineUtils;
|
||||
@ -16,7 +19,7 @@ import testutils.TestEngineUtils;
|
||||
/**
|
||||
* Testing the client's attacking trees
|
||||
*/
|
||||
public class ClientAttackTreeTests extends EntityTestTemplate {
|
||||
public class ServerAttackTreeTests extends EntityTestTemplate {
|
||||
|
||||
|
||||
/**
|
||||
@ -26,17 +29,14 @@ public class ClientAttackTreeTests extends EntityTestTemplate {
|
||||
public void testClientAttack(){
|
||||
//warm up engine
|
||||
TestEngineUtils.simulateFrames(1);
|
||||
|
||||
//Get the client-side player's attack state
|
||||
ClientAttackTree clientAttackTree = ClientAttackTree.getClientAttackTree(Globals.playerEntity);
|
||||
|
||||
//spawn on server
|
||||
Entity entity = CreatureUtils.serverSpawnBasicCreature(Globals.realmManager.first(), new Vector3d(0,0,0), "human", CreatureTemplate.createDefault("human"));
|
||||
|
||||
//Get the server-side player's attack tree
|
||||
int serverIdForClientEntity = Globals.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId());
|
||||
Entity serverPlayerEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
|
||||
ServerAttackTree serverAttackTree = ServerAttackTree.getServerAttackTree(serverPlayerEntity);
|
||||
ServerAttackTree serverAttackTree = ServerAttackTree.getServerAttackTree(entity);
|
||||
|
||||
//verify can attack
|
||||
assertEquals(true, clientAttackTree.canAttack(clientAttackTree.getAttackType()));
|
||||
assertEquals(true, serverAttackTree.canAttack(serverAttackTree.getAttackType()));
|
||||
|
||||
//try attacking
|
||||
@ -48,9 +48,6 @@ public class ClientAttackTreeTests extends EntityTestTemplate {
|
||||
|
||||
//verify it was started on server
|
||||
assertNotEquals(serverAttackTree.getState(), AttackTreeState.IDLE);
|
||||
|
||||
//verify state transition was triggered on client
|
||||
assertNotEquals(clientAttackTree.getState(), AttackTreeState.IDLE);
|
||||
}
|
||||
|
||||
}
|
||||
@ -46,9 +46,9 @@ public class ClientEquipStateTests extends EntityTestTemplate {
|
||||
|
||||
//verify the client got the extra entities
|
||||
Set<Entity> clientSideCreatures = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
|
||||
assertEquals(2, clientSideCreatures.size());
|
||||
assertEquals(1, clientSideCreatures.size());
|
||||
Set<Entity> clientSideItems = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
|
||||
assertEquals(2, clientSideItems.size());
|
||||
assertEquals(1, clientSideItems.size());
|
||||
|
||||
//equip
|
||||
Entity inInventoryItem = InventoryUtils.serverAttemptStoreItem(creature, katana);
|
||||
@ -98,7 +98,7 @@ public class ClientEquipStateTests extends EntityTestTemplate {
|
||||
Set<Entity> clientSideCreatures = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
|
||||
assertEquals(1, clientSideCreatures.size());
|
||||
Set<Entity> clientSideItems = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
|
||||
assertEquals(2, clientSideItems.size());
|
||||
assertEquals(1, clientSideItems.size());
|
||||
|
||||
//try to store item in inventory
|
||||
Entity katanaOnClient = clientSideItems.iterator().next();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user