Test plan For TutNpc Animation Controller - UQcsse3200/2023-studio-2 GitHub Wiki
TutnpcAnimationController Class
The TutnpcAnimationController
class is responsible for managing animations for the Tutnpc (Tutorial NPC) entity in the game. This wiki page provides documentation for the class and its associated test class.
Introduction
The TutnpcAnimationController
ensures proper animation handling and updates for the Tutnpc entity.
Class Overview
Methods
create()
- Description: Initializes the animation controller and triggers the initial animation.
update()
- Description: Updates the animation state based on the animation duration and the current animation.
Test Class: TutnpcAnimationControllerTest
The TutnpcAnimationControllerTest
class is responsible for testing the methods of the TutnpcAnimationController
class to ensure proper functionality.
Mock Objects:
AssetManager
(Mock): Used to simulate asset loading.AnimationRenderComponent
(Mock): Used to simulate rendering animations.TextureAtlas
(Mock): Used to simulate the texture atlas for animations.
The TutnpcAnimationController
will be initialized with these mock objects for testing purposes.
Test Setup
Before running the test cases, the necessary mock objects and dependencies are set up for testing. The TutnpcAnimationController
is initialized with mock objects for testing purposes.
Test Cases
create()
Method
Test Case 1: Objective: Verify that the create
method correctly initializes the animation controller and triggers the initial animation.
Test Steps:
- Call the
create
method of theTutnpcAnimationController
. - Verify that the
startAnimation
method of the mockAnimationRenderComponent
is called with the expected animation key ("row-2-column-1").
update()
Method
Test Case 2: Objective: Ensure that the update
method of the TutnpcAnimationController
correctly updates the animation state based on the animation duration and the current animation.
Test Steps:
- Set the
animationDuration
property of the controller to a specific value (e.g., 10f). - Mock the
getCurrentAnimation
method of theAnimationRenderComponent
to return a specific animation key (e.g., "row-3-column-1"). - Call the
update
method of theTutnpcAnimationController
.
Conclusion
This wiki page provides documentation for the TutnpcAnimationController
class and its associated test class, TutnpcAnimationControllerTest
. By using test cases and mock objects, we ensure that the animation controller functions correctly and can be reliably tested to maintain the reliability and correctness of the Tutnpc animation system in the game.