Permalink
Browse files

client: rms conditional should be inclusive, to allow exact match

  • Loading branch information...
1 parent c4a710e commit ddbccf8632b961ecf552ae342a6fd233eb0605f0 Marc Sibson committed Feb 16, 2011
Showing with 13 additions and 2 deletions.
  1. +12 −1 tests/unit/test_client.py
  2. +1 −1 vncdotool/client.py
View
@@ -94,13 +94,24 @@ def test_expectCompareSuccess(self):
d.callback.assert_called_once_with(client)
assert client.deferred is None
+ def test_expectCompareExactSuccess(self):
+ client = self.client
+ d = client.deferred = mock.Mock()
+ client.expected = [2, 2, 2]
+ image = mock.Mock()
+ image.histogram.return_value = [2, 2, 2]
+ client._expectCompare(image, 0)
+
+ d.callback.assert_called_once_with(client)
+ assert client.deferred is None
+
def test_expectCompareFails(self):
client = self.client
client.deferred = mock.Mock()
client.expected = [2, 2, 2]
client.updates = mock.Mock()
image = mock.Mock()
- image.histogram.return_value = [1, 2, 3]
+ image.histogram.return_value = [1, 1, 1]
client._expectCompare(image, 0)
View
@@ -164,7 +164,7 @@ def _expectCompare(self, image, maxrms):
self.log('rms %d', rms)
- if rms < maxrms:
+ if rms <= maxrms:
self.deferred.callback(self)
self.deferred = None
return

0 comments on commit ddbccf8

Please sign in to comment.