Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormesonium <mesonium@posteo.eu>2022-11-25 19:54:55 +0300
committerPhilipp Hörist <philipp@hoerist.com>2022-12-08 15:14:05 +0300
commitca5f6104ddd79801ce800c98706647369777f9f5 (patch)
treedb38cc71684a1a6b6c7695ead0201be6f2375d42 /test
parent278ea27680f87a36a1d2eb14a7bfe520eb4d7377 (diff)
feat: Preview: Add audio preview controls and visualization
* Remove the delay when starting a playback * Don't scrub during seek when dragging the slider * Don't open audio stream connections before playing * Determine the duration early to prevent missing duration info + Show total duration + Add option to display remaining play time + Add possibility to seek by clicking into the seekbar + Add possibility to seek by scrolling with the mouse wheel + Add fast forward and rewind buttons + Add buttons to change the playback speed + Add automatic restoration of the audio player settings in a session + Add automatic stop of other streams when starting to play + Add a visualization of the RMS peaks
Diffstat (limited to 'test')
-rw-r--r--test/no_gui/test_text_helpers.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/no_gui/test_text_helpers.py b/test/no_gui/test_text_helpers.py
index 86897829c..c71b8ee8e 100644
--- a/test/no_gui/test_text_helpers.py
+++ b/test/no_gui/test_text_helpers.py
@@ -2,6 +2,7 @@ import unittest
from gajim.common.text_helpers import escape_iri_path_segment
from gajim.common.text_helpers import jid_to_iri
+from gajim.common.text_helpers import format_duration
class Test(unittest.TestCase):
@@ -30,6 +31,30 @@ class Test(unittest.TestCase):
self.assertEqual(jid_to_iri(jid),
r'xmpp:my%5C20self@%5B::1%5D/home', jid)
+ def test_format_duration_width(self):
+ def do(total_seconds, expected):
+ self.assertEqual(format_duration(0.0, total_seconds*1e9), expected)
+
+ do( 0, '0:00')
+ do( 60, '0:00')
+ do( 10*60, '00:00')
+ do( 60*60, '0:00:00')
+ do( 10*60*60, '00:00:00')
+ do(100*60*60, '000:00:00')
+
+ def test_format_duration(self):
+ def do(duration, expected):
+ self.assertEqual(format_duration(duration, 100*60*60*1e9), expected)
+
+ do( 1.0, '000:00:00')
+ do( 999999999.0, '000:00:00')
+ do( 1000000000.0, '000:00:01')
+ do( 59999999999.0, '000:00:59')
+ do( 60000000000.0, '000:01:00')
+ do( 3599999999999.0, '000:59:59')
+ do( 3600000000000.0, '001:00:00')
+ do(3599999999999999.0, '999:59:59')
+
if __name__ == '__main__':
unittest.main()