Browse files

client: bugfix, request framebuffers updates when expecing, thanks Gu…

…y Sheffer for reporting

 - VNC protocol requires clients to continually request frame buffer updates,
 - vncdotool neverr successfully match, when used with correctly implemented servers,
    as only a single update was requested.
  • Loading branch information...
1 parent b0243aa commit 6e5e748b3b9ff8027a8e65d21c6f02edd72dea0e @sibson committed Apr 21, 2012
Showing with 3 additions and 1 deletion.
  1. +2 −0 tests/unit/test_client.py
  2. +1 −1 vncdotool/client.py
View
2 tests/unit/test_client.py
@@ -114,13 +114,15 @@ def test_expectCompareFails(self):
cli.deferred = mock.Mock()
cli.expected = [2, 2, 2]
cli.updates = mock.Mock()
+ cli.framebufferUpdateRequest = mock.Mock()
image = mock.Mock()
image.histogram.return_value = [1, 1, 1]
cli._expectCompare(image, 0)
assert not cli.deferred.callback.called
assert cli.updates.get.called
+ cli.framebufferUpdateRequest.assert_called_once_with(incremental=1)
update = cli.updates.get.return_value
update.addCallback.assert_called_once_with(cli._expectCompare, 0)
View
2 vncdotool/client.py
@@ -190,7 +190,6 @@ def expectScreen(self, filename, maxrms=0):
def _expectCompare(self, image, maxrms):
hist = image.histogram()
-
rms = math.sqrt(
reduce(operator.add, map(
lambda a, b: (a - b) ** 2, hist, self.expected)) / len(hist))
@@ -204,6 +203,7 @@ def _expectCompare(self, image, maxrms):
d = self.updates.get()
d.addCallback(self._expectCompare, maxrms)
+ self.framebufferUpdateRequest(incremental=1)
def mouseMove(self, x, y):
""" Move the mouse pointer to position (x, y)

0 comments on commit 6e5e748

Please sign in to comment.