"Bugfix #1550891 Projector manager rejecting replies as invalid (backport from trunk)

--------------------------------
lp:~alisonken1/openlp/2.4-bug-1550891 (revision 2622)
[SUCCESS] https://ci.openlp.io/job/Branch-01-Pull/1306/
[SUCCESS] https://ci.openlp.io/job/Branch-02-Functional-Tests/1228/
[SUCCESS] https://ci.openlp.io/job/Branch-03-Interface-Tests/1167/
[SUCCESS] https://ci.openlp.io/job/Branch-04a-Windows_Functional_Tests/1002/
[SUCCESS] https://ci.openlp.io/job/Branch-04b-Windows_I..."

bzr-revno: 2622
This commit is contained in:
Ken Roberts 2016-03-03 20:35:58 +02:00 committed by Raoul Snyman
commit 8a8695dc50
2 changed files with 24 additions and 2 deletions

View File

@ -515,7 +515,7 @@ class PJLink1(QTcpSocket):
self.socket_timer.start() self.socket_timer.start()
try: try:
self.projectorNetwork.emit(S_NETWORK_SENDING) self.projectorNetwork.emit(S_NETWORK_SENDING)
sent = self.write(out) sent = self.write(out.encode('ascii'))
self.waitForBytesWritten(2000) # 2 seconds should be enough self.waitForBytesWritten(2000) # 2 seconds should be enough
if sent == -1: if sent == -1:
# Network error? # Network error?
@ -665,7 +665,15 @@ class PJLink1(QTcpSocket):
:param data: Class that projector supports. :param data: Class that projector supports.
""" """
self.pjlink_class = data # bug 1550891: Projector returns non-standard class response:
# : Expected: %1CLSS=1
# : Received: %1CLSS=Class 1
if len(data) > 1:
# Split non-standard information from response
clss = data.split()[-1]
else:
clss = data
self.pjlink_class = clss
log.debug('(%s) Setting pjlink_class for this projector to "%s"' % (self.ip, self.pjlink_class)) log.debug('(%s) Setting pjlink_class for this projector to "%s"' % (self.ip, self.pjlink_class))
return return

View File

@ -60,3 +60,17 @@ class TestPJLink(TestCase):
"Connection request should have been called with TEST_SALT")) "Connection request should have been called with TEST_SALT"))
self.assertTrue(mock_qmd5_hash.called_with(TEST_PIN, self.assertTrue(mock_qmd5_hash.called_with(TEST_PIN,
"Connection request should have been called with TEST_PIN")) "Connection request should have been called with TEST_PIN"))
def non_standard_class_reply_test(self):
"""
bugfix 1550891 - CLSS request returns non-standard 'Class N' reply
"""
# GIVEN: Test object
pjlink = pjlink_test
# WHEN: Process non-standard reply
pjlink.process_clss('Class 1')
# THEN: Projector class should be set with proper value
self.assertEquals(pjlink.pjlink_class, '1',
'Non-standard class reply should have set proper class')