Skip to content

CameraShaker Test Plan

Mohamad Dabboussi edited this page Oct 16, 2023 · 1 revision

Test Plan Documentation: CameraShakerTest


Overview:

The CameraShaker class is designed to provide a shaking effect to the camera, a common feature in many games to depict impactful events or explosions. This test is aimed at ensuring the correct initiation and termination of the camera shaking effect and verifying that default values are set appropriately.


Test Cases:


1. Test Case: testStartShaking

Objective: Confirm that the startShaking method activates the camera shaking effect.

Steps:

  1. Initialize a new CameraShaker instance using the setUp method.
  2. Assert that the camera is not shaking by default using assertFalse(cameraShaker.isCameraShaking()).
  3. Activate the camera shaking effect by calling cameraShaker.startShaking().
  4. Validate that the camera shaking effect is active using assertTrue(cameraShaker.isCameraShaking()).

Expected Outcome: The camera should not be shaking by default. However, upon calling the startShaking method, the camera should start shaking.


2. Test Case: testReset

Objective: Ensure that the reset method deactivates the camera shaking effect and resets the camera's position.

Steps:

  1. Initialize a new CameraShaker instance using the setUp method.
  2. Start the camera shaking effect by calling cameraShaker.startShaking().
  3. Reset the camera and its effects by calling cameraShaker.reset().
  4. Verify that the camera is no longer shaking using assertFalse(cameraShaker.isCameraShaking()).
  5. Assert that the camera's position matches the original position using assertEquals(cameraShaker.getOrigPosition(), camera.position).

Expected Outcome: Upon calling the reset method, the camera should no longer be shaking, and its position should match its original position.


3. Test Case: testDefaultConstructorValues

Objective: Confirm that default values for shake radius, minimum radius, and fall off factor are set correctly.

Steps:

  1. Initialize a new CameraShaker instance using the setUp method.
  2. Validate that the shake radius is set to the default value using assertEquals(0.05f, cameraShaker.getShakeRadius(), 0.001f).
  3. Validate that the minimum shake radius is set to the default value using assertEquals(0.001f, cameraShaker.getMinimumRadius(), 0.001f).
  4. Confirm that the fall-off factor is set to its default value using assertEquals(0.8f, cameraShaker.getFallOffFactor(), 0.001f).

Expected Outcome: The CameraShaker class should initialize with default values for shake radius, minimum radius, and fall-off factor.


Clone this wiki locally