diff options
author | Maciej Kisielewski <maciej.kisielewski@canonical.com> | 2019-05-16 15:52:36 +0200 |
---|---|---|
committer | Maciej Kisielewski <maciej.kisielewski@canonical.com> | 2019-05-21 14:08:47 +0200 |
commit | bd8e52f7f09e7015034c0ce3b42b7aec471401e6 (patch) | |
tree | 586e3c775fe2c9c77a8d3a562eeb69a98ba42a6e /bin | |
parent | 9ef060aa31f55f382dc7cb763f36df7a90bdbfc1 (diff) |
hotkey_tests: add volume down key test
Signed-off-by: Maciej Kisielewski <maciej.kisielewski@canonical.com>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/hotkey_tests.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/bin/hotkey_tests.py b/bin/hotkey_tests.py index 12b2d39..8815aee 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( |