-
Notifications
You must be signed in to change notification settings - Fork 4
CameraShaker Test Plan
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.
Objective: Confirm that the startShaking
method activates the camera shaking effect.
Steps:
- Initialize a new
CameraShaker
instance using thesetUp
method. - Assert that the camera is not shaking by default using
assertFalse(cameraShaker.isCameraShaking())
. - Activate the camera shaking effect by calling
cameraShaker.startShaking()
. - 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.
Objective: Ensure that the reset
method deactivates the camera shaking effect and resets the camera's position.
Steps:
- Initialize a new
CameraShaker
instance using thesetUp
method. - Start the camera shaking effect by calling
cameraShaker.startShaking()
. - Reset the camera and its effects by calling
cameraShaker.reset()
. - Verify that the camera is no longer shaking using
assertFalse(cameraShaker.isCameraShaking())
. - 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.
Objective: Confirm that default values for shake radius, minimum radius, and fall off factor are set correctly.
Steps:
- Initialize a new
CameraShaker
instance using thesetUp
method. - Validate that the shake radius is set to the default value using
assertEquals(0.05f, cameraShaker.getShakeRadius(), 0.001f)
. - Validate that the minimum shake radius is set to the default value using
assertEquals(0.001f, cameraShaker.getMinimumRadius(), 0.001f)
. - 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.