-
Notifications
You must be signed in to change notification settings - Fork 1
Bosses Projectile Tests
This document describes the unit tests implemented for projectiles created by the ProjectileFactory
, specifically focusing on the Water Spiral from Leviathan and Wind Gust from Griffin. These tests ensure that the projectiles are correctly instantiated with the necessary components, animations, and AI tasks.
This test verifies that the WaterSpiral entity created by the ProjectileFactory has all the essential components.
-
Components Checked:
- PhysicsComponent
- PhysicsMovementComponent
- WaterSpiralAnimationController
- ProjectileAttackComponent
- HitboxComponent
- ColliderComponent
- AITaskComponent
Ensures that the projectile is correctly configured with all necessary components for movement, collision, attack handling, and AI control.
@Test
void TestWaterSpiralHasComponents() {
Entity waterSpiral = ProjectileFactory.createWaterSpiral(new Entity());
assertNotNull(waterSpiral.getComponent(PhysicsComponent.class));
assertNotNull(waterSpiral.getComponent(PhysicsMovementComponent.class));
assertNotNull(waterSpiral.getComponent(WaterSpiralAnimationController.class));
assertNotNull(waterSpiral.getComponent(ProjectileAttackComponent.class));
assertNotNull(waterSpiral.getComponent(HitboxComponent.class));
assertNotNull(waterSpiral.getComponent(ColliderComponent.class));
assertNotNull(waterSpiral.getComponent(AITaskComponent.class));
}
This test checks if the WaterSpiral
projectile has the appropriate animation loaded.
-
Animation Checked:
waterSpiral
Ensures that the water spiral projectile displays the correct animation when rendered.
@Test
void TestWaterSpiralAnimationLoaded() {
Entity waterSpiral = ProjectileFactory.createWaterSpiral(new Entity());
AnimationRenderComponent animationComponent = waterSpiral.getComponent(AnimationRenderComponent.class);
assertNotNull(animationComponent);
assertTrue(animationComponent.hasAnimation("waterSpiral"), "WaterSpiral should have waterSpiral animation.");
}
This test verifies that the WaterSpiral
projectile has the correct movement speed.
-
Speed Checked:
6.0f
for both X and Y directions.
Ensures that the water spiral projectile moves at the expected speed when launched.
@Test
void TestWaterSpiralSpeed() {
Entity waterSpiral = ProjectileFactory.createWaterSpiral(new Entity());
PhysicsMovementComponent movementComponent = waterSpiral.getComponent(PhysicsMovementComponent.class);
Vector2 expectedSpeed = new Vector2(6.0f, 6.0f);
assertEquals(expectedSpeed, movementComponent.getMaxSpeed());
}
This test ensures that the WaterSpiral
projectile has the correct AI task configuration, specifically checking for the presence of a ProjectileMovementTask
.
-
Components Checked:
AITaskComponent
- Contains
ProjectileMovementTask
Ensures that the WaterSpiral
projectile has an AI task responsible for its movement and no task is active initially.
@Test
void TestWaterSpiralAITask() {
Entity waterSpiral = ProjectileFactory.createWaterSpiral(new Entity());
AITaskComponent aiTaskComponent = waterSpiral.getComponent(AITaskComponent.class);
assertNotNull(aiTaskComponent, "AITaskComponent should not be null for WaterSpiral.");
boolean containsProjectileMovementTask = false;
for (PriorityTask task : aiTaskComponent.getTasks()) {
if (task instanceof ProjectileMovementTask) {
containsProjectileMovementTask = true;
break;
}
}
assertTrue(containsProjectileMovementTask, "WaterSpiral AI task list should contain a ProjectileMovementTask.");
assertNull(aiTaskComponent.getCurrentTask(), "No task should be active initially for WaterSpiral.");
}
This test checks whether the WindGust
entity, created by the ProjectileFactory
, has all the necessary components for functioning.
-
Components Checked:
PhysicsComponent
PhysicsMovementComponent
WindGustAnimationController
ProjectileAttackComponent
HitboxComponent
ColliderComponent
AITaskComponent
Ensures that the WindGust
projectile is properly initialized with all required components for its movement, collision, attack mechanics, and AI behavior.
@Test
void TestWindGustHasComponents() {
Entity windGust = ProjectileFactory.createWindGust(new Entity());
assertNotNull(windGust.getComponent(PhysicsComponent.class));
assertNotNull(windGust.getComponent(PhysicsMovementComponent.class));
assertNotNull(windGust.getComponent(WindGustAnimationController.class));
assertNotNull(windGust.getComponent(ProjectileAttackComponent.class));
assertNotNull(windGust.getComponent(HitboxComponent.class));
assertNotNull(windGust.getComponent(ColliderComponent.class));
assertNotNull(windGust.getComponent(AITaskComponent.class));
}
This test ensures that the WindGust
entity created by the ProjectileFactory
has its animation properly loaded.
-
Components Checked:
AnimationRenderComponent
Verifies that the WindGust
projectile contains the correct animation by checking if the AnimationRenderComponent
has the "windGust"
animation.
@Test
void TestWindGustAnimationLoaded() {
Entity windGust = ProjectileFactory.createWindGust(new Entity());
AnimationRenderComponent animationComponent = windGust.getComponent(AnimationRenderComponent.class);
assertNotNull(animationComponent);
assertTrue(animationComponent.hasAnimation("windGust"), "WindGust should have windGust animation.");
}
This test checks that the WindGust
entity created by the ProjectileFactory
has the correct AI task components configured.
-
Components Checked:
AITaskComponent
Ensures that the WindGust
projectile is set up with an AI task for projectile movement and that no task is active initially.
@Test
void TestWindGustAITask() {
Entity windGust = ProjectileFactory.createWindGust(new Entity());
AITaskComponent aiTaskComponent = windGust.getComponent(AITaskComponent.class);
assertNotNull(aiTaskComponent, "AITaskComponent should not be null for WindGust.");
boolean containsProjectileMovementTask = false;
for (PriorityTask task : aiTaskComponent.getTasks()) {
if (task instanceof ProjectileMovementTask) {
containsProjectileMovementTask = true;
break;
}
}
assertTrue(containsProjectileMovementTask, "The AI task list for WindGust should contain a ProjectileMovementTask.");
assertNull(aiTaskComponent.getCurrentTask(), "No task should be active initially for WindGust.");
}