Merge lp:~sylvain-pineau/checkbox/fix-1495929 into lp:checkbox

Proposed by Sylvain Pineau
Status: Merged
Approved by: Zygmunt Krynicki
Approved revision: 4007
Merged at revision: 4007
Proposed branch: lp:~sylvain-pineau/checkbox/fix-1495929
Merge into: lp:checkbox
Diff against target: 58 lines (+29/-8)
2 files modified
checkbox-support/checkbox_support/parsers/pactl.py (+15/-8)
checkbox-support/checkbox_support/parsers/tests/test_pactl.py (+14/-0)
To merge this branch: bzr merge lp:~sylvain-pineau/checkbox/fix-1495929
Reviewer Review Type Date Requested Status
Zygmunt Krynicki (community) Approve
Review via email: mp+271108@code.launchpad.net

Description of the change

A fix for the pactl parser of checkbox-support to be compatible with a new syntax of Volume properties (Vivid)

To post a comment you must log in.
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

really nice, +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'checkbox-support/checkbox_support/parsers/pactl.py'
2--- checkbox-support/checkbox_support/parsers/pactl.py 2014-08-11 17:20:51 +0000
3+++ checkbox-support/checkbox_support/parsers/pactl.py 2015-09-15 11:42:39 +0000
4@@ -351,14 +351,21 @@
5 VolumeAttributeValue = (
6 p.Combine(
7 p.Or([
8- p.Literal("(invalid)"),
9- p.Regex("([0-9]+: +[0-9]+% ?)+")
10- ])
11- + p.LineEnd()
12- + p.Optional(p.White('\t').suppress())
13- + p.Or([
14- p.Literal("(invalid)"),
15- p.Regex("([0-9]+: -?([0-9]+\.[0-9]+|inf) dB ?)+"),
16+ p.Or([
17+ p.Literal("(invalid)"),
18+ p.Regex("([0-9]+: +[0-9]+% ?)+")
19+ ])
20+ + p.LineEnd()
21+ + p.Optional(p.White('\t').suppress())
22+ + p.Or([
23+ p.Literal("(invalid)"),
24+ p.Regex("([0-9]+: -?([0-9]+\.[0-9]+|inf) dB ?)+"),
25+ ]),
26+ p.Or([
27+ p.Literal("(invalid)"),
28+ p.Regex("([\w\-]+: [0-9]+ / +[0-9]+% /"
29+ " +-?([0-9]+\.[0-9]+|inf) dB,? *)+")
30+ ])
31 ])
32 + p.LineEnd()
33 + p.Optional(p.White('\t').suppress())
34
35=== modified file 'checkbox-support/checkbox_support/parsers/tests/test_pactl.py'
36--- checkbox-support/checkbox_support/parsers/tests/test_pactl.py 2015-06-10 15:37:53 +0000
37+++ checkbox-support/checkbox_support/parsers/tests/test_pactl.py 2015-09-15 11:42:39 +0000
38@@ -357,6 +357,20 @@
39 '0: -13.40 dB 1: -13.40 dB\n'
40 'balance 0.00\n'))
41
42+ def test_volume_variant1(self):
43+ # pactl Volume properties differ with recent PulseAudio versions
44+ attr = self.assertParses(
45+ pactl.GenericSimpleAttribute.Syntax, (
46+ 'Volume: front-left: 52428 / 80% / -5.81 dB, '
47+ 'front-right: 52428 / 80% / -5.81 dB\n'
48+ ' balance 0.00\n')
49+ )['attribute']
50+ self.assertEqual(attr.name, 'Volume')
51+ self.assertEqual(attr.value, (
52+ 'front-left: 52428 / 80% / -5.81 dB, '
53+ 'front-right: 52428 / 80% / -5.81 dB\n'
54+ 'balance 0.00\n'))
55+
56 def test_inf_volume(self):
57 # LP: 1350168
58 attr = self.assertParses(

Subscribers

People subscribed via source and target branches