Skip to content

Commit

Permalink
Add test for child_window() with depth parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
eltimen committed Oct 11, 2020
1 parent cd63acc commit eb404e0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pywinauto/unittests/test_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -1169,6 +1169,19 @@ def test_depth(self):
len(self.app['Font'].descendants(depth=1)),
len(self.app['Font'].descendants(depth=2)))

if UIA_support:
def test_child_window_depth(self):
"""Test that child_window() with depth works correctly"""
# TODO fix same elements at different tree levels on win32 backend and switch test back to win32
_app = Application(backend="uia").start("Notepad")
_dlgspec = _app.UntitledNotepad
_dlgspec.menu_select("Format -> Font")
font = _dlgspec.child_window(name="Font")

with self.assertRaises(findbestmatch.MatchError):
font.child_window(best_match="ListBox0", depth=1).wrapper_object()
font.child_window(best_match="ListBox0", depth=2).wrapper_object()

def test_print_control_identifiers(self):
"""Make sure print_control_identifiers() doesn't crash"""
self.dlgspec.print_control_identifiers()
Expand Down

0 comments on commit eb404e0

Please sign in to comment.