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

Application.window and findwindows.find_elements can accept keys specified in *ElementInfo.renamed_props #1342

Open
wants to merge 1 commit into
base: atspi
Choose a base branch
from

Conversation

junkmd
Copy link
Contributor

@junkmd junkmd commented Sep 25, 2023

fixes #1338

Note:

I don't have a Windows environment with an English interface, so I actually verified it with the following test code on a Windows environment with a Japanese interface.

    def test_window(self):
        """Test that window_() works correctly"""
        app = Application()

        self.assertRaises(AppNotConnected, app.window_, **{'title' : 'not connected'})

        app.start(_notepad_exe())

        self.assertRaises(ValueError, app.windows_, **{'backend' : 'uia'})

        name = app.window(name="無題 - メモ帳")
        name_re = app.window(name_re="無題[ -]+メモ帳")
        title = app.window(title="無題 - メモ帳")
        title_re = app.window(title_re="無題[ -]+メモ帳")
        classname = app.window(class_name="Notepad")
        classname_re = app.window(class_name_re="Not..ad")
        handle = app.window(handle=name.handle)
        bestmatch = app.window(best_match="メモ帳Notepad")

        self.assertNotEqual(name.handle, None)
        self.assertNotEqual(name.handle, 0)

        self.assertEqual(name.handle, name_re.handle)
        self.assertEqual(name.handle, title.handle)
        self.assertEqual(name.handle, title_re.handle)
        self.assertEqual(name.handle, classname.handle)
        self.assertEqual(name.handle, classname_re.handle)
        self.assertEqual(name.handle, handle.handle)
        self.assertEqual(name.handle, bestmatch.handle)

        app.UntitledNotepad.menu_select("ファイル->メモ帳の終了")

I changed the arguments to English to make it work in the CI environment with an English interface, and then I committed and pushed the changes.

@codecov
Copy link

codecov bot commented Sep 25, 2023

Codecov Report

Merging #1342 (271cc2e) into atspi (bf7f789) will increase coverage by 0.04%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##            atspi    #1342      +/-   ##
==========================================
+ Coverage   94.15%   94.20%   +0.04%     
==========================================
  Files          60       60              
  Lines       23036    23037       +1     
==========================================
+ Hits        21689    21701      +12     
+ Misses       1347     1336      -11     

@junkmd junkmd changed the title Application.windows and findwindows.find_windows can accept keys specified in *ElementInfo.renamed_props Application.window and findwindows.find_elements can accept keys specified in *ElementInfo.renamed_props Sep 26, 2023
`Application.window` and `findwindows.find_elements` can now accept keys
specified in `*ElementInfo.renamed_props`
@junkmd junkmd force-pushed the fix_find_windows_accepts_title branch from 1c0307d to 271cc2e Compare September 26, 2023 00:27
@junkmd junkmd added the bug label Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression in atspi branch causes call to Application.windows() to raise RuntimeError
1 participant