Skip to content

Commit

Permalink
client: bugfix, request framebuffers updates when expecing, thanks Gu…
Browse files Browse the repository at this point in the history
…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
sibson committed Apr 22, 2012
1 parent b0243aa commit 6e5e748
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions tests/unit/test_client.py
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion vncdotool/client.py
Expand Up @@ -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))
Expand All @@ -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)
Expand Down

0 comments on commit 6e5e748

Please sign in to comment.