-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
43649e1
commit 919858f
Showing
3 changed files
with
105 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
source/core/src/test/com/csse3200/game/rendering/CameraShakerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.csse3200.game.rendering; | ||
|
||
import com.badlogic.gdx.graphics.OrthographicCamera; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
|
||
public class CameraShakerTest { | ||
|
||
private CameraShaker cameraShaker; | ||
private OrthographicCamera camera; | ||
|
||
@BeforeEach | ||
public void setUp() { | ||
camera = new OrthographicCamera(); | ||
cameraShaker = new CameraShaker(camera); | ||
} | ||
|
||
@Test | ||
public void testStartShaking() { | ||
assertFalse(cameraShaker.isCameraShaking()); | ||
cameraShaker.startShaking(); | ||
assertTrue(cameraShaker.isCameraShaking()); | ||
} | ||
|
||
@Test | ||
public void testReset() { | ||
cameraShaker.startShaking(); | ||
cameraShaker.reset(); | ||
assertFalse(cameraShaker.isCameraShaking()); | ||
assertEquals(cameraShaker.origPosition, camera.position); | ||
} | ||
|
||
@Test | ||
public void testDefaultConstructorValues() { | ||
assertEquals(0.05f, cameraShaker.getShakeRadius(), 0.001f); | ||
assertEquals(0.001f, cameraShaker.getMinimumRadius(), 0.001f); | ||
assertEquals(0.8f, cameraShaker.getFallOffFactor(), 0.001f); | ||
} | ||
|
||
} |