From 6e5e748b3b9ff8027a8e65d21c6f02edd72dea0e Mon Sep 17 00:00:00 2001 From: Marc Sibson Date: Sat, 21 Apr 2012 20:33:46 -0700 Subject: [PATCH] client: bugfix, request framebuffers updates when expecing, thanks Guy 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. --- tests/unit/test_client.py | 2 ++ vncdotool/client.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/unit/test_client.py b/tests/unit/test_client.py index 10e1e701..295e10ad 100644 --- a/tests/unit/test_client.py +++ b/tests/unit/test_client.py @@ -114,6 +114,7 @@ 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] @@ -121,6 +122,7 @@ def test_expectCompareFails(self): 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) diff --git a/vncdotool/client.py b/vncdotool/client.py index 19453b70..43904679 100644 --- a/vncdotool/client.py +++ b/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)