Skip to content

Commit

Permalink
Issue pythonarcade#688, add unit test for using Path in Sound constru…
Browse files Browse the repository at this point in the history
…ctor.
  • Loading branch information
pvcraven committed May 19, 2020
1 parent eab8d9f commit 6cc7ce5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/unit2/test_sound.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os
from pathlib import Path
import arcade

SCREEN_WIDTH = 800
Expand All @@ -13,10 +15,17 @@ def __init__(self, width, height):
"""
super().__init__(width, height)

file_path = os.path.dirname(os.path.abspath(__file__))
os.chdir(file_path)

arcade.set_background_color(arcade.color.WHITE)
self.laser_wav = arcade.load_sound(":resources:sounds/laser1.wav")
self.laser_mp3 = arcade.load_sound(":resources:sounds/laser1.mp3")
self.laser_ogg = arcade.load_sound(":resources:sounds/laser1.ogg")

soundpath = Path("../../arcade/resources/sounds")
self.coin = arcade.Sound(soundpath / "coin1.wav", streaming=True)

self.frame_count = 0

def update(self, dt):
Expand All @@ -36,6 +45,7 @@ def update(self, dt):

if self.frame_count == 200:
self.laser_mp3.stop()
self.coin.play()

def on_draw(self):
"""
Expand Down

0 comments on commit 6cc7ce5

Please sign in to comment.