add note about mysterious -15 in the code

This commit is contained in:
Victor Shnayder
2012-10-27 20:00:18 -04:00
parent cc8f0a1634
commit 6324eeeecb
2 changed files with 3 additions and 1 deletions

View File

@@ -510,7 +510,8 @@ class ImageInput(InputTypeBase):
# if value is of the form [x,y] then parse it and send along coordinates of previous answer
m = re.match('\[([0-9]+),([0-9]+)]', self.value.strip().replace(' ', ''))
if m:
# TODO (vshnayder): why is there a "-15" here??
# Note: we subtract 15 to compensate for the size of the dot on the screen.
# (which supposedly has size 30).
(self.gx, self.gy) = [int(x) - 15 for x in m.groups()]
else:
(self.gx, self.gy) = (0, 0)

View File

@@ -400,6 +400,7 @@ class ImageInputTest(unittest.TestCase):
self.assertEqual(context, expected)
def test_with_value(self):
# Check that compensating for the dot size works properly.
self.check('[50,40]', 35, 25)
def test_without_value(self):