diff --git a/common/lib/capa/capa/inputtypes.py b/common/lib/capa/capa/inputtypes.py index 33e9048131..0bbf54d153 100644 --- a/common/lib/capa/capa/inputtypes.py +++ b/common/lib/capa/capa/inputtypes.py @@ -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) diff --git a/common/lib/capa/capa/tests/test_inputtypes.py b/common/lib/capa/capa/tests/test_inputtypes.py index 992af14bf9..ba20f84cb1 100644 --- a/common/lib/capa/capa/tests/test_inputtypes.py +++ b/common/lib/capa/capa/tests/test_inputtypes.py @@ -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):