Merge lp:~alisonken1/openlp/bug-1550891 into lp:openlp

Proposed by Ken Roberts
Status: Merged
Approved by: Tim Bentley
Approved revision: 2624
Merged at revision: 2624
Proposed branch: lp:~alisonken1/openlp/bug-1550891
Merge into: lp:openlp
Diff against target: 51 lines (+24/-2)
2 files modified
openlp/core/lib/projector/pjlink1.py (+10/-2)
tests/functional/openlp_core_lib/test_projector_pjlink1.py (+14/-0)
To merge this branch: bzr merge lp:~alisonken1/openlp/bug-1550891
Reviewer Review Type Date Requested Status
Tim Bentley Approve
Raoul Snyman Approve
Review via email: mp+287407@code.launchpad.net

This proposal supersedes a proposal from 2016-02-28.

Commit message

Fix Projector Manager receiving non-PJLink reply to initial class query and encoding exception when sending data

Description of the change

- Fix projector manager receiving an invalid class response on initial connection
- Fix string encoding to ascii when sending request to projector

--------------------------------
lp:~alisonken1/openlp/bug-1550891 (revision 2624)
[SUCCESS] https://ci.openlp.io/job/Branch-01-Pull/1301/
[SUCCESS] https://ci.openlp.io/job/Branch-02-Functional-Tests/1223/
[SUCCESS] https://ci.openlp.io/job/Branch-03-Interface-Tests/1162/
[SUCCESS] https://ci.openlp.io/job/Branch-04a-Windows_Functional_Tests/997/
[SUCCESS] https://ci.openlp.io/job/Branch-04b-Windows_Interface_Tests/588/
[SUCCESS] https://ci.openlp.io/job/Branch-05a-Code_Analysis/654/
[FAILURE] https://ci.openlp.io/job/Branch-05b-Test_Coverage/523/
Stopping after failure

To post a comment you must log in.
Revision history for this message
Raoul Snyman (raoul-snyman) :
review: Approve
Revision history for this message
Tim Bentley (trb143) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/core/lib/projector/pjlink1.py'
2--- openlp/core/lib/projector/pjlink1.py 2016-01-09 16:59:42 +0000
3+++ openlp/core/lib/projector/pjlink1.py 2016-02-28 12:59:15 +0000
4@@ -515,7 +515,7 @@
5 self.socket_timer.start()
6 try:
7 self.projectorNetwork.emit(S_NETWORK_SENDING)
8- sent = self.write(out)
9+ sent = self.write(out.encode('ascii'))
10 self.waitForBytesWritten(2000) # 2 seconds should be enough
11 if sent == -1:
12 # Network error?
13@@ -665,7 +665,15 @@
14
15 :param data: Class that projector supports.
16 """
17- self.pjlink_class = data
18+ # bug 1550891: Projector returns non-standard class response:
19+ # : Expected: %1CLSS=1
20+ # : Received: %1CLSS=Class 1
21+ if len(data) > 1:
22+ # Split non-standard information from response
23+ clss = data.split()[-1]
24+ else:
25+ clss = data
26+ self.pjlink_class = clss
27 log.debug('(%s) Setting pjlink_class for this projector to "%s"' % (self.ip, self.pjlink_class))
28 return
29
30
31=== modified file 'tests/functional/openlp_core_lib/test_projector_pjlink1.py'
32--- tests/functional/openlp_core_lib/test_projector_pjlink1.py 2016-01-10 22:10:50 +0000
33+++ tests/functional/openlp_core_lib/test_projector_pjlink1.py 2016-02-28 12:59:15 +0000
34@@ -60,3 +60,17 @@
35 "Connection request should have been called with TEST_SALT"))
36 self.assertTrue(mock_qmd5_hash.called_with(TEST_PIN,
37 "Connection request should have been called with TEST_PIN"))
38+
39+ def non_standard_class_reply_test(self):
40+ """
41+ bugfix 1550891 - CLSS request returns non-standard 'Class N' reply
42+ """
43+ # GIVEN: Test object
44+ pjlink = pjlink_test
45+
46+ # WHEN: Process non-standard reply
47+ pjlink.process_clss('Class 1')
48+
49+ # THEN: Projector class should be set with proper value
50+ self.assertEquals(pjlink.pjlink_class, '1',
51+ 'Non-standard class reply should have set proper class')