|
|
|
@@ -101,153 +101,150 @@ protected:
|
|
|
|
|
srand(time(NULL));
|
|
|
|
|
SetUpDependencies();
|
|
|
|
|
testedEntity = new Entity(5, info);
|
|
|
|
|
// We allocate through malloc because we cannot call the constructors of some of thse methods.
|
|
|
|
|
baseCombatAIComponent = (BaseCombatAIComponent*)malloc(sizeof(BaseCombatAIComponent));
|
|
|
|
|
Game::logger->Log("EntityTests", "starting");
|
|
|
|
|
bouncerComponent = new BouncerComponent(testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "BouncerComponent");
|
|
|
|
|
buffComponent = new BuffComponent(testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "BuffComponent");
|
|
|
|
|
buildBorderComponent = new BuildBorderComponent(testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "BuildBorderComponent");
|
|
|
|
|
characterComponent = new CharacterComponent(testedEntity, nullptr);
|
|
|
|
|
Game::logger->Log("EntityTests", "CharacterComponent");
|
|
|
|
|
controllablePhysicsComponent = new ControllablePhysicsComponent(testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "ControllablePhysicsComponent");
|
|
|
|
|
destroyableComponent = new DestroyableComponent(testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "DestroyableComponent");
|
|
|
|
|
inventoryComponent = new InventoryComponent(testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "InventoryComponent");
|
|
|
|
|
levelProgressionComponent = new LevelProgressionComponent(testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "LevelProgressionComponent");
|
|
|
|
|
lUPExhibitComponent = new LUPExhibitComponent(testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "LUPExhibitComponent");
|
|
|
|
|
missionComponent = new MissionComponent(testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "MissionComponent");
|
|
|
|
|
missionOfferComponent = new MissionOfferComponent(testedEntity, 2345);
|
|
|
|
|
Game::logger->Log("EntityTests", "MissionOfferComponent");
|
|
|
|
|
modelComponent = new ModelComponent(testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "ModelComponent");
|
|
|
|
|
moduleAssemblyComponent = new ModuleAssemblyComponent(testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "ModuleAssemblyComponent");
|
|
|
|
|
movementAIComponent = new MovementAIComponent(testedEntity, MovementAIInfo());
|
|
|
|
|
Game::logger->Log("EntityTests", "MovementAIComponent");
|
|
|
|
|
movingPlatformComponent = new MovingPlatformComponent(testedEntity, "");
|
|
|
|
|
Game::logger->Log("EntityTests", "MovingPlatformComponent");
|
|
|
|
|
petComponent = new PetComponent(testedEntity, 1234);
|
|
|
|
|
Game::logger->Log("EntityTests", "PetComponent");
|
|
|
|
|
phantomPhysicsComponent = new PhantomPhysicsComponent(testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "PhantomPhysicsComponent");
|
|
|
|
|
playerForcedMovementComponent = new PlayerForcedMovementComponent(testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "PlayerForcedMovementComponent");
|
|
|
|
|
possessableComponent = new PossessableComponent(testedEntity, 124);
|
|
|
|
|
Game::logger->Log("EntityTests", "PossessableComponent");
|
|
|
|
|
possessorComponent = new PossessorComponent(testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "PossessorComponent");
|
|
|
|
|
propertyComponent = new PropertyComponent(testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "PropertyComponent");
|
|
|
|
|
propertyEntranceComponent = new PropertyEntranceComponent(38, testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "PropertyEntranceComponent");
|
|
|
|
|
propertyManagementComponent = new PropertyManagementComponent(testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "PropertyManagementComponent");
|
|
|
|
|
propertyVendorComponent = new PropertyVendorComponent(testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "PropertyVendorComponent");
|
|
|
|
|
proximityMonitorComponent = new ProximityMonitorComponent(testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "ProximityMonitorComponent");
|
|
|
|
|
racingControlComponent = new RacingControlComponent(testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "RacingControlComponent");
|
|
|
|
|
railActivatorComponent = new RailActivatorComponent(testedEntity, 4231);
|
|
|
|
|
Game::logger->Log("EntityTests", "RailActivatorComponent");
|
|
|
|
|
rebuildComponent = new RebuildComponent(testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "RebuildComponent");
|
|
|
|
|
renderComponent = new RenderComponent(testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "RenderComponent");
|
|
|
|
|
rigidbodyPhantomPhysicsComponent = new RigidbodyPhantomPhysicsComponent(testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "RigidbodyPhantomPhysicsComponent");
|
|
|
|
|
rocketLaunchLupComponent = new RocketLaunchLupComponent(testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "RocketLaunchLupComponent");
|
|
|
|
|
rocketLaunchpadControlComponent = new RocketLaunchpadControlComponent(testedEntity, 5);
|
|
|
|
|
Game::logger->Log("EntityTests", "RocketLaunchpadControlComponent");
|
|
|
|
|
scriptedActivityComponent = new ScriptedActivityComponent(testedEntity, 4);
|
|
|
|
|
Game::logger->Log("EntityTests", "ScriptedActivityComponent");
|
|
|
|
|
shootingGalleryComponent = new ShootingGalleryComponent(testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "ShootingGalleryComponent");
|
|
|
|
|
simplePhysicsComponent = new SimplePhysicsComponent(3, testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "SimplePhysicsComponent");
|
|
|
|
|
skillComponent = new SkillComponent(testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "SkillComponent");
|
|
|
|
|
soundTriggerComponent = new SoundTriggerComponent(testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "SoundTriggerComponent");
|
|
|
|
|
switchComponent = new SwitchComponent(testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "SwitchComponent");
|
|
|
|
|
triggerComponent = new TriggerComponent(testedEntity, "");
|
|
|
|
|
Game::logger->Log("EntityTests", "TriggerComponent");
|
|
|
|
|
vehiclePhysicsComponent = new VehiclePhysicsComponent(testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "VehiclePhysicsComponent");
|
|
|
|
|
vendorComponent = new VendorComponent(testedEntity);
|
|
|
|
|
Game::logger->Log("EntityTests", "VendorComponent");
|
|
|
|
|
baseCombatAIComponent->SetState(AiState::dead);
|
|
|
|
|
combatAiComponentTarget = rand();
|
|
|
|
|
baseCombatAIComponent->SetTarget(combatAiComponentTarget);
|
|
|
|
|
testedEntity->AddComponent(BaseCombatAIComponent::ComponentType, baseCombatAIComponent);
|
|
|
|
|
|
|
|
|
|
bouncerComponent = (BouncerComponent*)malloc(sizeof(BouncerComponent));
|
|
|
|
|
// bouncerComponent->SetPetEnabled(true);
|
|
|
|
|
|
|
|
|
|
testedEntity->AddComponent(BouncerComponent::ComponentType, bouncerComponent);
|
|
|
|
|
buffComponent = (BuffComponent*)malloc(sizeof(BuffComponent));
|
|
|
|
|
testedEntity->AddComponent(BuffComponent::ComponentType, buffComponent);
|
|
|
|
|
buildBorderComponent = (BuildBorderComponent*)malloc(sizeof(BuildBorderComponent));
|
|
|
|
|
testedEntity->AddComponent(BuildBorderComponent::ComponentType, buildBorderComponent);
|
|
|
|
|
characterComponent = (CharacterComponent*)malloc(sizeof(CharacterComponent));
|
|
|
|
|
testedEntity->AddComponent(CharacterComponent::ComponentType, characterComponent);
|
|
|
|
|
controllablePhysicsComponent = (ControllablePhysicsComponent*)malloc(sizeof(ControllablePhysicsComponent));
|
|
|
|
|
testedEntity->AddComponent(ControllablePhysicsComponent::ComponentType, controllablePhysicsComponent);
|
|
|
|
|
destroyableComponent = (DestroyableComponent*)malloc(sizeof(DestroyableComponent));
|
|
|
|
|
testedEntity->AddComponent(DestroyableComponent::ComponentType, destroyableComponent);
|
|
|
|
|
inventoryComponent = (InventoryComponent*)malloc(sizeof(InventoryComponent));
|
|
|
|
|
testedEntity->AddComponent(InventoryComponent::ComponentType, inventoryComponent);
|
|
|
|
|
levelProgressionComponent = (LevelProgressionComponent*)malloc(sizeof(LevelProgressionComponent));
|
|
|
|
|
testedEntity->AddComponent(LevelProgressionComponent::ComponentType, levelProgressionComponent);
|
|
|
|
|
lUPExhibitComponent = (LUPExhibitComponent*)malloc(sizeof(LUPExhibitComponent));
|
|
|
|
|
testedEntity->AddComponent(LUPExhibitComponent::ComponentType, lUPExhibitComponent);
|
|
|
|
|
missionComponent = (MissionComponent*)malloc(sizeof(MissionComponent));
|
|
|
|
|
testedEntity->AddComponent(MissionComponent::ComponentType, missionComponent);
|
|
|
|
|
missionOfferComponent = (MissionOfferComponent*)malloc(sizeof(MissionOfferComponent));
|
|
|
|
|
testedEntity->AddComponent(MissionOfferComponent::ComponentType, missionOfferComponent);
|
|
|
|
|
modelComponent = (ModelComponent*)malloc(sizeof(ModelComponent));
|
|
|
|
|
testedEntity->AddComponent(ModelComponent::ComponentType, modelComponent);
|
|
|
|
|
moduleAssemblyComponent = (ModuleAssemblyComponent*)malloc(sizeof(ModuleAssemblyComponent));
|
|
|
|
|
testedEntity->AddComponent(ModuleAssemblyComponent::ComponentType, moduleAssemblyComponent);
|
|
|
|
|
movementAIComponent = (MovementAIComponent*)malloc(sizeof(MovementAIComponent));
|
|
|
|
|
testedEntity->AddComponent(MovementAIComponent::ComponentType, movementAIComponent);
|
|
|
|
|
movingPlatformComponent = (MovingPlatformComponent*)malloc(sizeof(MovingPlatformComponent));
|
|
|
|
|
testedEntity->AddComponent(MovingPlatformComponent::ComponentType, movingPlatformComponent);
|
|
|
|
|
petComponent = (PetComponent*)malloc(sizeof(PetComponent));
|
|
|
|
|
testedEntity->AddComponent(PetComponent::ComponentType, petComponent);
|
|
|
|
|
phantomPhysicsComponent = (PhantomPhysicsComponent*)malloc(sizeof(PhantomPhysicsComponent));
|
|
|
|
|
testedEntity->AddComponent(PhantomPhysicsComponent::ComponentType, phantomPhysicsComponent);
|
|
|
|
|
playerForcedMovementComponent = (PlayerForcedMovementComponent*)malloc(sizeof(PlayerForcedMovementComponent));
|
|
|
|
|
testedEntity->AddComponent(PlayerForcedMovementComponent::ComponentType, playerForcedMovementComponent);
|
|
|
|
|
possessableComponent = (PossessableComponent*)malloc(sizeof(PossessableComponent));
|
|
|
|
|
testedEntity->AddComponent(PossessableComponent::ComponentType, possessableComponent);
|
|
|
|
|
possessorComponent = (PossessorComponent*)malloc(sizeof(PossessorComponent));
|
|
|
|
|
testedEntity->AddComponent(PossessorComponent::ComponentType, possessorComponent);
|
|
|
|
|
propertyComponent = (PropertyComponent*)malloc(sizeof(PropertyComponent));
|
|
|
|
|
testedEntity->AddComponent(PropertyComponent::ComponentType, propertyComponent);
|
|
|
|
|
propertyEntranceComponent = (PropertyEntranceComponent*)malloc(sizeof(PropertyEntranceComponent));
|
|
|
|
|
testedEntity->AddComponent(PropertyEntranceComponent::ComponentType, propertyEntranceComponent);
|
|
|
|
|
propertyManagementComponent = (PropertyManagementComponent*)malloc(sizeof(PropertyManagementComponent));
|
|
|
|
|
testedEntity->AddComponent(PropertyManagementComponent::ComponentType, propertyManagementComponent);
|
|
|
|
|
propertyVendorComponent = (PropertyVendorComponent*)malloc(sizeof(PropertyVendorComponent));
|
|
|
|
|
testedEntity->AddComponent(PropertyVendorComponent::ComponentType, propertyVendorComponent);
|
|
|
|
|
proximityMonitorComponent = (ProximityMonitorComponent*)malloc(sizeof(ProximityMonitorComponent));
|
|
|
|
|
testedEntity->AddComponent(ProximityMonitorComponent::ComponentType, proximityMonitorComponent);
|
|
|
|
|
racingControlComponent = (RacingControlComponent*)malloc(sizeof(RacingControlComponent));
|
|
|
|
|
testedEntity->AddComponent(RacingControlComponent::ComponentType, racingControlComponent);
|
|
|
|
|
railActivatorComponent = (RailActivatorComponent*)malloc(sizeof(RailActivatorComponent));
|
|
|
|
|
testedEntity->AddComponent(RailActivatorComponent::ComponentType, railActivatorComponent);
|
|
|
|
|
rebuildComponent = (RebuildComponent*)malloc(sizeof(RebuildComponent));
|
|
|
|
|
testedEntity->AddComponent(RebuildComponent::ComponentType, rebuildComponent);
|
|
|
|
|
renderComponent = (RenderComponent*)malloc(sizeof(RenderComponent));
|
|
|
|
|
testedEntity->AddComponent(RenderComponent::ComponentType, renderComponent);
|
|
|
|
|
rigidbodyPhantomPhysicsComponent = (RigidbodyPhantomPhysicsComponent*)malloc(sizeof(RigidbodyPhantomPhysicsComponent));
|
|
|
|
|
testedEntity->AddComponent(RigidbodyPhantomPhysicsComponent::ComponentType, rigidbodyPhantomPhysicsComponent);
|
|
|
|
|
rocketLaunchLupComponent = (RocketLaunchLupComponent*)malloc(sizeof(RocketLaunchLupComponent));
|
|
|
|
|
testedEntity->AddComponent(RocketLaunchLupComponent::ComponentType, rocketLaunchLupComponent);
|
|
|
|
|
rocketLaunchpadControlComponent = (RocketLaunchpadControlComponent*)malloc(sizeof(RocketLaunchpadControlComponent));
|
|
|
|
|
testedEntity->AddComponent(RocketLaunchpadControlComponent::ComponentType, rocketLaunchpadControlComponent);
|
|
|
|
|
scriptedActivityComponent = (ScriptedActivityComponent*)malloc(sizeof(ScriptedActivityComponent));
|
|
|
|
|
testedEntity->AddComponent(ScriptedActivityComponent::ComponentType, scriptedActivityComponent);
|
|
|
|
|
shootingGalleryComponent = (ShootingGalleryComponent*)malloc(sizeof(ShootingGalleryComponent));
|
|
|
|
|
testedEntity->AddComponent(ShootingGalleryComponent::ComponentType, shootingGalleryComponent);
|
|
|
|
|
simplePhysicsComponent = (SimplePhysicsComponent*)malloc(sizeof(SimplePhysicsComponent));
|
|
|
|
|
testedEntity->AddComponent(SimplePhysicsComponent::ComponentType, simplePhysicsComponent);
|
|
|
|
|
skillComponent = (SkillComponent*)malloc(sizeof(SkillComponent));
|
|
|
|
|
testedEntity->AddComponent(SkillComponent::ComponentType, skillComponent);
|
|
|
|
|
soundTriggerComponent = (SoundTriggerComponent*)malloc(sizeof(SoundTriggerComponent));
|
|
|
|
|
testedEntity->AddComponent(SoundTriggerComponent::ComponentType, soundTriggerComponent);
|
|
|
|
|
switchComponent = (SwitchComponent*)malloc(sizeof(SwitchComponent));
|
|
|
|
|
testedEntity->AddComponent(SwitchComponent::ComponentType, switchComponent);
|
|
|
|
|
triggerComponent = (TriggerComponent*)malloc(sizeof(TriggerComponent));
|
|
|
|
|
testedEntity->AddComponent(TriggerComponent::ComponentType, triggerComponent);
|
|
|
|
|
vehiclePhysicsComponent = (VehiclePhysicsComponent*)malloc(sizeof(VehiclePhysicsComponent));
|
|
|
|
|
testedEntity->AddComponent(VehiclePhysicsComponent::ComponentType, vehiclePhysicsComponent);
|
|
|
|
|
vendorComponent = (VendorComponent*)malloc(sizeof(VendorComponent));
|
|
|
|
|
testedEntity->AddComponent(VendorComponent::ComponentType, vendorComponent);
|
|
|
|
|
bouncerComponent->SetPetEnabled(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TearDown() override {
|
|
|
|
|
TearDownDependencies();
|
|
|
|
|
free(baseCombatAIComponent);
|
|
|
|
|
free(bouncerComponent);
|
|
|
|
|
free(buffComponent);
|
|
|
|
|
free(buildBorderComponent);
|
|
|
|
|
free(characterComponent);
|
|
|
|
|
free(controllablePhysicsComponent);
|
|
|
|
|
free(destroyableComponent);
|
|
|
|
|
free(inventoryComponent);
|
|
|
|
|
free(levelProgressionComponent);
|
|
|
|
|
free(lUPExhibitComponent);
|
|
|
|
|
free(missionComponent);
|
|
|
|
|
free(missionOfferComponent);
|
|
|
|
|
free(modelComponent);
|
|
|
|
|
free(moduleAssemblyComponent);
|
|
|
|
|
free(movementAIComponent);
|
|
|
|
|
free(movingPlatformComponent);
|
|
|
|
|
free(petComponent);
|
|
|
|
|
free(phantomPhysicsComponent);
|
|
|
|
|
free(playerForcedMovementComponent);
|
|
|
|
|
free(possessableComponent);
|
|
|
|
|
free(possessorComponent);
|
|
|
|
|
free(propertyComponent);
|
|
|
|
|
free(propertyEntranceComponent);
|
|
|
|
|
free(propertyManagementComponent);
|
|
|
|
|
free(propertyVendorComponent);
|
|
|
|
|
free(proximityMonitorComponent);
|
|
|
|
|
free(racingControlComponent);
|
|
|
|
|
free(railActivatorComponent);
|
|
|
|
|
free(rebuildComponent);
|
|
|
|
|
free(renderComponent);
|
|
|
|
|
free(rigidbodyPhantomPhysicsComponent);
|
|
|
|
|
free(rocketLaunchLupComponent);
|
|
|
|
|
free(rocketLaunchpadControlComponent);
|
|
|
|
|
free(scriptedActivityComponent);
|
|
|
|
|
free(shootingGalleryComponent);
|
|
|
|
|
free(simplePhysicsComponent);
|
|
|
|
|
free(skillComponent);
|
|
|
|
|
free(soundTriggerComponent);
|
|
|
|
|
free(switchComponent);
|
|
|
|
|
free(triggerComponent);
|
|
|
|
|
free(vehiclePhysicsComponent);
|
|
|
|
|
free(vendorComponent);
|
|
|
|
|
delete baseCombatAIComponent;
|
|
|
|
|
delete bouncerComponent;
|
|
|
|
|
delete buffComponent;
|
|
|
|
|
delete buildBorderComponent;
|
|
|
|
|
delete characterComponent;
|
|
|
|
|
delete controllablePhysicsComponent;
|
|
|
|
|
delete destroyableComponent;
|
|
|
|
|
delete inventoryComponent;
|
|
|
|
|
delete levelProgressionComponent;
|
|
|
|
|
delete lUPExhibitComponent;
|
|
|
|
|
delete missionComponent;
|
|
|
|
|
delete missionOfferComponent;
|
|
|
|
|
delete modelComponent;
|
|
|
|
|
delete moduleAssemblyComponent;
|
|
|
|
|
delete movementAIComponent;
|
|
|
|
|
delete movingPlatformComponent;
|
|
|
|
|
delete petComponent;
|
|
|
|
|
delete phantomPhysicsComponent;
|
|
|
|
|
delete playerForcedMovementComponent;
|
|
|
|
|
delete possessableComponent;
|
|
|
|
|
delete possessorComponent;
|
|
|
|
|
delete propertyComponent;
|
|
|
|
|
delete propertyEntranceComponent;
|
|
|
|
|
delete propertyManagementComponent;
|
|
|
|
|
delete propertyVendorComponent;
|
|
|
|
|
delete proximityMonitorComponent;
|
|
|
|
|
delete racingControlComponent;
|
|
|
|
|
delete railActivatorComponent;
|
|
|
|
|
delete rebuildComponent;
|
|
|
|
|
delete renderComponent;
|
|
|
|
|
delete rigidbodyPhantomPhysicsComponent;
|
|
|
|
|
delete rocketLaunchLupComponent;
|
|
|
|
|
delete rocketLaunchpadControlComponent;
|
|
|
|
|
delete scriptedActivityComponent;
|
|
|
|
|
delete shootingGalleryComponent;
|
|
|
|
|
delete simplePhysicsComponent;
|
|
|
|
|
delete skillComponent;
|
|
|
|
|
delete soundTriggerComponent;
|
|
|
|
|
delete switchComponent;
|
|
|
|
|
delete triggerComponent;
|
|
|
|
|
delete vehiclePhysicsComponent;
|
|
|
|
|
delete vendorComponent;
|
|
|
|
|
operator delete(testedEntity);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
TEST_F(EntityTests, EntityConstructionTest) {
|
|
|
|
|
CBITSTREAM;
|
|
|
|
|
// testedEntity->WriteComponents(&bitStream, eReplicaPacketType::CONSTRUCTION);
|
|
|
|
|
testedEntity->WriteComponents(&bitStream, eReplicaPacketType::CONSTRUCTION);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_F(EntityTests, EntitySerializationTest) {
|
|
|
|
|
CBITSTREAM;
|
|
|
|
|
// testedEntity->WriteComponents(&bitStream, eReplicaPacketType::SERIALIZATION);
|
|
|
|
|
testedEntity->WriteComponents(&bitStream, eReplicaPacketType::SERIALIZATION);
|
|
|
|
|
}
|
|
|
|
|