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

Ensure that cache_enable propagates to the end of UIAElementInfo.iter_descendants #1334

Open
wants to merge 5 commits into
base: atspi
Choose a base branch
from

Conversation

junkmd
Copy link
Contributor

@junkmd junkmd commented Sep 19, 2023

In #207, the cache_enable argument was added to the constructor and made to propagate down to the end of descendants. However, when iter_descendants was introduced in #475, cache_enable wasn't implemented to propagate down to the end.

Upon reviewing past issues and PRs, it appears that not propagating cache_enable down to the end in iter_descendants was not intentional but simply overlooked.

This PR addresses that inconsistency.

@junkmd junkmd changed the title Ensure that cache_enable propagates to the end of iter_descendants Ensure that cache_enable propagates to the end of UIAElementInfo.iter_descendants Sep 19, 2023
@junkmd junkmd marked this pull request as draft September 19, 2023 09:10
@codecov
Copy link

codecov bot commented Sep 19, 2023

Codecov Report

Merging #1334 (d62b902) into atspi (bf7f789) will increase coverage by 0.07%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##            atspi    #1334      +/-   ##
==========================================
+ Coverage   94.15%   94.22%   +0.07%     
==========================================
  Files          60       60              
  Lines       23036    23036              
==========================================
+ Hits        21689    21706      +17     
+ Misses       1347     1330      -17     

In pywinauto#207, the `cache_enable` argument was added to the
constructor, propagating to `children` and `descendants`. However, when
`iter_children` and `iter_descendants` were introduced in
pywinauto#475, `cache_enable` wasn't implemented to propagate.

From reviewing past issues and PRs, it appears that not propagating
`cache_enable` was unintentional and simply overlooked.
pywinauto#1001 and pywinauto#1012 refactored the
code without changing the current behavior, resulting in a complex
conditional implementation.
with `is_element_satisfying_criteria`

When `iter_descendants` is called recursively, it goes through
`iter_descendants` first, so only elements filtered by
`is_element_satisfying_criteria` are `yield`ed.
@junkmd junkmd force-pushed the update_uia_elem_info_iter_descendants branch from 4cf42b9 to f736587 Compare September 19, 2023 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant