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

  1. 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:

    1. Create an entity with a CameraComponent.
    2. Update the entity to ensure the camera's position aligns with the entity's center position.
    3. Move the entity and update it again.
    4. 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.
  2. 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:

    1. Create an entity with a CameraComponent and verify that the camera follows it.
    2. Create a second entity and reattach the same CameraComponent to it.
    3. Move the second entity and update it.
    4. 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.