Sound Effects Test Plan - UQcsse3200/2026-studio-2 GitHub Wiki

Unit tests cover the sound trigger logic with audio mocked. Manual tests below cover what JUnit can't meaningfully check (whether a sound is actually heard, timing, and the settings slider UI).

Setup: run ./gradlew desktop:run from source/.


1. Unit Tests

Test class What it checks
SoundEffectsTest Plays a loaded sound at the given volume, does nothing if the sound isn't loaded or there's no resource service, loads/unloads the full list
PlayerSoundComponentTest Jump, random hurt grunt, item vs coin pickup use different sounds, potion gulp only for potions, rope swing limited to once per 1.5s, item switch
ChaseSoundComponentTest Plays on chaseStart, doesn't repeat within 10s, plays again after 10s, silent if not loaded
CrumblingPlatformComponentTest Silent before the player touches it, sounds repeat and get louder while crumbling
EnemyDeathComponentTest Death sound plays only once even if health updates again, enemy still removed once
GameVolumeTest Volume scales sounds, clamps between 0 and 1, playing music updates when the volume changes, defaults to 100%

Existing bow, spin the wheel and combat tests were updated to check sounds are played through GameVolume.

2. Not Unit Tested

  • Settings volume slider UI (SettingsMenuDisplay, SettingsMenuDisplayInGame): needs a real stage and skin. Covered by the VOL tests below.
  • Sounds wired into screens/areas (level complete in LevelsGameScreen, music in each screen/area, loading in SandboxGameArea): screens aren't unit tested in this project. Covered by the SFX tests below.
  • Final crack when a crumbling platform breaks: needs a real texture renderer. Covered by SFX-9.
  • Poison flask smash: needs physics collisions. Covered by SFX-6.

3. Sound Effects

ID Steps Expected Result
SFX-1 Start Level 1 and press SPACE. Jump sound plays.
SFX-2 Get hit by an enemy several times. A hurt grunt plays each time, and the grunts vary (4 different sounds).
SFX-3 Pick up an item, then pick up a coin. The item and the coin play two different sounds.
SFX-4 Select a health or speed potion (number key) and press E. Two gulps play one after the other.
SFX-5 Right click to fire an arrow. Bow shot sound plays.
SFX-6 Select a poison potion, aim and press E at an enemy or the ground. A bottle smash plays when the flask hits.
SFX-7 Walk towards a skeleton warrior or archer until it chases you. It laughs once. Moving away and back within 10 seconds doesn't make it laugh again.
SFX-8 Get close to a vulture until it chases you. It screeches once (different sound to the skeletons).
SFX-9 In Level 2, stand on a crumbling platform. A rock breaking sound repeats and gets louder, with a loud crack when the platform disappears.
SFX-10 Kill an enemy. Enemy death sound plays once.
SFX-11 Swing on a rope with the rope arrow. A rope creak plays while swinging, not every frame.
SFX-12 Switch items with number keys or , / .. A soft tick plays.
SFX-13 Reach the exit at the end of Level 1. Level complete sound plays as the level changes.
SFX-14 Open the Sandbox from the main menu and repeat SFX-1 to SFX-10. All sounds play in the sandbox too.
SFX-15 Press buttons in the main menu, settings and pause menu. Every button clicks, and the click isn't cut off when the screen changes.

4. Volume Setting

ID Steps Expected Result
VOL-1 From the main menu, click Settings. A Volume row with a slider and percentage appears under UI Scale, matching the other settings.
VOL-2 Drag the Volume slider. The menu music gets quieter/louder straight away and the percentage updates.
VOL-3 Set it to around 30%, press Apply, exit, then reopen Settings. The slider is still at 30%.
VOL-4 Drag the slider, then click Exit without Apply. The volume goes back to the saved value.
VOL-5 With the volume at 30%, play Level 1. Music and all sound effects are quieter than at 100%.
VOL-6 Press ESC, open Settings from the pause menu and drag the slider. The gameplay music changes straight away.
VOL-7 Play a minigame (Blackjack, Cyclops, Spin the Wheel) at a low volume. Minigame music and sounds follow the volume.
VOL-8 Close the game and reopen it. The saved volume is used from the start (main menu music).
VOL-9 Set the volume back to 100% and Apply. Everything sounds the same as before the slider was added.