summaryrefslogtreecommitdiff
path: root/tests/test_functions_audio.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_functions_audio.py')
-rw-r--r--tests/test_functions_audio.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/test_functions_audio.py b/tests/test_functions_audio.py
new file mode 100644
index 0000000..de6aa2a
--- /dev/null
+++ b/tests/test_functions_audio.py
@@ -0,0 +1,36 @@
+import os
+
+from blc2.functions.audio import Audio
+
+def test_audio(aws):
+ a = Audio(aws)
+
+ a.fade_out = 1000
+ a.fade_in = 1000
+ a.filename = "nonexistant"
+
+ assert a.audio_scope == {"nonexistant"}
+ assert not a.scope
+ assert a.duration == 0
+ assert a.actual_duration == 0
+
+ a.filename = "tests/silence.m4a"
+ assert a.audio_scope == {"tests/silence.m4a"}
+ assert a.duration == 2024
+ assert a.actual_duration == 3024
+
+ a.fade_out = 500
+ assert a.fade_out == 500
+ assert a.duration == 2524
+ assert a.actual_duration == 3024
+
+ lc, ac, _ = a.render(0)
+ assert not lc
+ assert len(ac) == 1
+ assert ac[0][1:] == ("tests/silence.m4a", 0, 1000, 2524, 500)
+
+ _, ac2, _ = a.render(3000)
+ assert ac2 == ac
+
+ _, ac, _ = a.render(5000)
+ assert not ac