Skip to content

Commit

Permalink
added some tests to HumanAnimationController
Browse files Browse the repository at this point in the history
  • Loading branch information
nawal-0 committed Oct 17, 2023
1 parent dd85cf2 commit ed6ffaf
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class GameEndService {
* Constructor for the Game End Service
*/
public GameEndService() {
this.remainingEngineerCount = 10;
this.remainingEngineerCount = 5;
this.display = new EngineerCountDisplay();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,40 @@ void shouldAnimateDeath() {
assertEquals("death", engineer.getComponent(AnimationRenderComponent.class).getCurrentAnimation(),
"'deathStart' event should trigger 'death' animation'");
}

@Test
void notSelectedOnStart() {
assertFalse(engineer.getComponent(HumanAnimationController.class).isClicked(),
"Engineer should not be selected when initialised");
}

@Test
void shouldSelectEngineer() {
engineer.getComponent(HumanAnimationController.class).setClicked(true);
AnimationRenderComponent animator = engineer.getComponent(AnimationRenderComponent.class);

engineer.getEvents().trigger("idleRight");
assertEquals("idle_right_outline", animator.getCurrentAnimation(),
"After selection, outlined animation should be playing - idle right");

engineer.getEvents().trigger("walkLeftStart");
assertEquals("walk_left_outline", animator.getCurrentAnimation(),
"After selection, outlined animation should be playing - walk left");

engineer.getEvents().trigger("walkRightStart");
assertEquals("walk_right_outline", animator.getCurrentAnimation(),
"After selection, outlined animation should be playing - walk right");

engineer.getEvents().trigger("firingSingleStart");
assertEquals("firing_single_outline", animator.getCurrentAnimation(),
"After selection, outlined animation should be playing - firing single");

engineer.getEvents().trigger("hitStart");
assertEquals("hit_outline", animator.getCurrentAnimation(),
"After selection, outlined animation should be playing - hit");

engineer.getEvents().trigger("deathStart");
assertEquals("death_outline", animator.getCurrentAnimation(),
"After selection, outlined animation should be playing - death");
}
}

0 comments on commit ed6ffaf

Please sign in to comment.