TextInfos must inherit from BaseContentRecogTextInfo #12157
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Link to issue number:
Part of #12123
Implements deprecation announced in: #11510
Summary of the issue:
TextInfo
s that are used in content recognition modulecontentRecog
must inherit fromBaseContentRecogTextInfo
Description of how this pull request fixes the issue:
Code was which manually added
BaseContentRecogTextInfo
API functionsupdateCaret, updateSelection
toTextInfo
s is removed.Unused helper functions for the removed code was also removed
Instances where
RuntimeError
s were passed intoRecogResultNVDAObject
were replaced with raising the errors directly.Testing strategy:
RecogResultNVDAObject.makeTextInfo
ti
can be assigned from 3 locations, but only two ways:self.result.makeTextInfo
andself._selection.copy()
self._selection
is set from the__init__
, (self._selection = self.makeTextInfo(textInfos.POSITION_FIRST)
) and will be the result ofti = self.result.makeTextInfo
. So we only have to look at where result comes from.result
is passed in when the class is created, looking for usages ofRecogResultNVDAObject
, it is only fromdef _recogOnResult
but result is passed into that as well.def recognize
inuwpOcr.py
LinesWordsResult(data, imgInfo)
is passed eventually passed intoRecogResultNVDAObject
via_recogOnResult
, theRuntimeError
s passed in are handled in_recogOnResult
LinesWordsResult.makeTextInfo
creates aLwrTextInfo
object, which subclassesBaseContentRecogTextInfo
Search the code base for usages of
_patchTextInfo
and confirm the only usages are self references and in the removed code.Search the code base for usages of
_setSelection
and confirm the only usages are in the removed code.Known issues with pull request:
None
Change log entry:
Developer Changes
Code Review Checklist: