-
Notifications
You must be signed in to change notification settings - Fork 1
Bosses Projectile Tests
Phurin Vanasrivilai edited this page Oct 17, 2024
·
3 revisions
@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));
}
@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.");
}
@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());
}
@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.");
}
@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));
}
@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.");
}
@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.");
}