From bd8e52f7f09e7015034c0ce3b42b7aec471401e6 Mon Sep 17 00:00:00 2001 From: Maciej Kisielewski Date: Thu, 16 May 2019 15:52:36 +0200 Subject: hotkey_tests: add volume down key test Signed-off-by: Maciej Kisielewski --- bin/hotkey_tests.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'bin') diff --git a/bin/hotkey_tests.py b/bin/hotkey_tests.py index 12b2d39c..8815aee4 100755 --- a/bin/hotkey_tests.py +++ b/bin/hotkey_tests.py @@ -380,6 +380,22 @@ class HotKeyTesting: self.kb.press_key(KeyCodes.KEY_VOLUMEUP, repetitions=3, delay=0.2) return vc.before < vc.after + def check_volume_down(self): + """ + Check if the volume down key has an effect on ALSA + """ + # if the volume is already on min, then lowering it won't make any + # difference, so first, let's raise it before establishing the baseline + self.kb.press_key(KeyCodes.KEY_VOLUMEUP, repetitions=4, delay=0.2) + self.kb.press_key(KeyCodes.KEY_VOLUMEDOWN) + # let's grab output of alsa mixer to establish what is the baseline + # before we start raising the volume + vc = VolumeChange() + with self._monitored_volume_change(vc): + self.kb.press_key( + KeyCodes.KEY_VOLUMEDOWN, repetitions=3, delay=0.2) + return vc.before > vc.after + @contextlib.contextmanager def _monitored_volume_change(self, vc): before = subprocess.check_output('amixer').decode( -- cgit v1.2.3