blob: 35483a52ea079a5cbafe1c145bd551ba29b2b36f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
import unittest
from pathlib import Path
from sliceitoff.sfx import sfx
class TestSfx(unittest.TestCase):
def test_sfx_is_created_on_import(self):
self.assertEqual("<class 'sliceitoff.sfx.sfx.Sfx'>", str(type(sfx)))
def test_sfx_is_always_same(self):
from sliceitoff.sfx import sfx as sfx2
self.assertEqual(sfx, sfx2)
def test_init_works(self):
sfx.init( Path(__file__).parent.parent.resolve()
.joinpath('src').joinpath('sliceitoff').joinpath('assets'))
def test_play(self):
sfx.play("laser")
def test_music(self):
sfx.music("baby")
sfx.music("baby")
sfx.music("glass")
sfx.music(None)
def test_sfx_volume_control(self):
old_vol = sfx.sfx_volume
sfx.sfx_up()
self.assertNotEqual(old_vol, sfx.sfx_volume)
for _ in range(10):
sfx.sfx_up()
self.assertEqual(old_vol, sfx.sfx_volume)
def test_music_volume_control(self):
old_vol = sfx.music_volume
sfx.music(None)
sfx.music_up()
sfx.music("glass")
self.assertNotEqual(old_vol, sfx.music_volume)
for _ in range(10):
sfx.music_up()
self.assertEqual(old_vol, sfx.music_volume)
|