summaryrefslogtreecommitdiff
path: root/tests/test_functions_audio.py
diff options
context:
space:
mode:
authorBen Connors <benconnors@outlook.com>2019-09-26 19:08:01 -0400
committerBen Connors <benconnors@outlook.com>2019-09-26 19:08:01 -0400
commitcefc580a2f38f14c0245c9d6a5acbaa67feaf8d4 (patch)
treea055ef1931c4f8da009aa9f61f4640a37b25e4fe /tests/test_functions_audio.py
parent9bd3390071be3db8c366d44e161e828c8263179b (diff)
Various fixes; start implementing tests
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