Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vision Rect conversion bug #12424

Closed
FalkoBabbage opened this issue May 17, 2021 · 0 comments · Fixed by #14671
Closed

vision Rect conversion bug #12424

FalkoBabbage opened this issue May 17, 2021 · 0 comments · Fixed by #14671
Labels
component/vision Framework for assisting users with low vision good first issue github features these at https://github.com/nvaccess/nvda/contribute p4 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority quick fix
Milestone

Comments

@FalkoBabbage
Copy link
Contributor

FalkoBabbage commented May 17, 2021

Steps to reproduce:

Open Pycharm and focus on the main text field. Open Python Console and do the following:

from vision.util import getContextRect
from vision.constants import Context
getContextRect(Context.CARET, focus)

Actual behavior:

The following error occurs:
AttributeError: 'RectLTRB' object has no attribute 'toLTRB'

Expected behavior:

return a RectLTRB of the current caret position.

System configuration

NVDA installed/portable/running from source:

running from source, but also occurs on installed and portable versions

NVDA version:

2020.4

Windows version:

windows 10

Name and version of other software in use when reproducing the issue:

NA

Other information about your system:

Other questions

Does the issue still occur after restarting your computer?

yes

Have you tried any other versions of NVDA? If so, please report their behaviors.

no

If add-ons are disabled, is your problem still occurring?

yes

Does the issue still occur after you run the COM Registration Fixing Tool in NVDA's tools menu?

yes

The bug is kinda obvious when looking at the code. There is just a line rect.ToLTRB() and it does not check what kind of rectangle it is. In most cases this rect is a rectLTWH so ToLTRB makes sense.
It is easily fixed by an if statement checking whether the rectangle is already LTRB. However, it might be more robust to add the function ToLTRB() to LocationHelper.rectLTRB that returns itself. I kinda suspect that there are more of these bugs lurking arround in the vision framework and just plugging a function ToLTRB() into rectLTRB would spare some if-statements in the vision framework.

@ehollig ehollig added the component/vision Framework for assisting users with low vision label Nov 11, 2022
@seanbudd seanbudd added p4 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority quick fix good first issue github features these at https://github.com/nvaccess/nvda/contribute labels Dec 29, 2022
seanbudd pushed a commit that referenced this issue Apr 3, 2023
Fixes #12424

Summary of the issue:
JABTextInfo can return rectLTRB which is then used in the boudingRects property. this can be an issue for functions that expect rectLTWH types to be returned.

Description of user facing changes
None

Description of development approach
walked through where JABTextInfo could return a rectLTRB instance. found it
@nvaccessAuto nvaccessAuto added this to the 2023.2 milestone Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/vision Framework for assisting users with low vision good first issue github features these at https://github.com/nvaccess/nvda/contribute p4 https://github.com/nvaccess/nvda/blob/master/projectDocs/issues/triage.md#priority quick fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants