Skip to content

Test Plan for `CameraZoomComponentTest`

falgonn edited this page Aug 28, 2024 · 1 revision

Objective

To validate the functionality and correctness of the CameraZoomComponent class, ensuring that it handles zooming in and out correctly based on user input and adheres to zoom constraints.

Test Coverage

  1. Camera Zooms In on Scroll Up

    • Test Case: shouldZoomCameraInOnScrollUp
    • Purpose: Verify that the camera zooms in when the mouse wheel is scrolled up.

    Steps:

    1. Create an entity with CameraComponent and CameraZoomComponent.
    2. Set the camera's initial position and resize it.
    3. Scroll the mouse wheel up.
    4. Verify that the camera zooms in (i.e., the viewport width and height decrease).
    5. Ensure the camera position and aspect ratio remain unchanged.

    Verification:

    • Check that the viewport width and height have decreased.
    • Verify that the camera’s position and aspect ratio have not changed.
  2. Camera Zooms Out on Scroll Down

    • Test Case: shouldZoomCameraOutOnScrollDown
    • Purpose: Verify that the camera zooms out when the mouse wheel is scrolled down.

    Steps:

    1. Create an entity with CameraComponent and CameraZoomComponent.
    2. Set the camera's initial position and resize it.
    3. Scroll the mouse wheel down.
    4. Verify that the camera zooms out (i.e., the viewport width and height increase).
    5. Ensure the camera position and aspect ratio remain unchanged.

    Verification:

    • Check that the viewport width and height have increased.
    • Verify that the camera’s position and aspect ratio have not changed.
  3. Camera Zoom Constrained by Maximum Bound

    • Test Case: shouldConstrainZoomOut
    • Purpose: Verify that the camera zooming out is constrained by a maximum zoom amount.

    Steps:

    1. Create an entity with CameraComponent and CameraZoomComponent.
    2. Continuously scroll the mouse wheel down to zoom out.
    3. Verify that the camera's zoom does not exceed the maximum bound.

    Verification:

    • Ensure that the viewport width and height do not exceed the maximum zoom amount.
    • Confirm that zooming out stops when the maximum zoom amount is reached.
  4. Camera Zoom Constrained by Minimum Bound

    • Test Case: shouldConstrainZoomIn
    • Purpose: Verify that the camera zooming in is constrained by a minimum zoom amount.

    Steps:

    1. Create an entity with CameraComponent and CameraZoomComponent.
    2. Continuously scroll the mouse wheel up to zoom in.
    3. Verify that the camera's zoom does not go below the minimum bound.

    Verification:

    • Ensure that the viewport width and height do not fall below the minimum zoom amount.
    • Confirm that zooming in stops when the minimum zoom amount is reached.
Clone this wiki locally