Commit 6324eeee by Victor Shnayder

add note about mysterious -15 in the code

parent cc8f0a16
......@@ -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)
......
......@@ -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):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment