Test Plan for `CameraComponentTest` - UQcsse3200/2024-studio-2 GitHub Wiki
Objective
To validate the functionality and correctness of the CameraComponent
class, ensuring it correctly follows entities and handles being attached to multiple entities.
Test Coverage
-
Camera Follows Entity
- Test Case:
cameraShouldFollowEntity
- Purpose: Verify that the camera correctly follows the entity it is attached to, maintaining its position relative to the entity.
Steps:
- Create an entity with a
CameraComponent
. - Update the entity to ensure the camera's position aligns with the entity's center position.
- Move the entity and update it again.
- Verify that the camera’s position updates to follow the new entity center position.
Verification:
- Ensure that the camera’s position matches the entity’s center position before and after the entity’s movement.
- Test Case:
-
Camera Follows Only One Entity
- Test Case:
cameraShouldFollowOnlyOneEntity
- Purpose: Confirm that a camera attached to multiple entities only follows the most recent entity and does not follow previous ones.
Steps:
- Create an entity with a
CameraComponent
and verify that the camera follows it. - Create a second entity and reattach the same
CameraComponent
to it. - Move the second entity and update it.
- Verify that the camera follows the second entity and does not follow the first entity.
Verification:
- Ensure the camera follows the latest entity and ignores the previous one.
- Test Case: