Doc: explain how to ensure the TestCase's window is active

Pick-to: 6.5 6.6 6.7
Change-Id: I0d2e8a8ffdabba9cd6f0aee7dad8e79728c0261b
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
This commit is contained in:
Mitch Curtis 2023-12-20 17:13:35 +08:00
parent f233a5ff9d
commit c9b32cf8e8
1 changed files with 9 additions and 0 deletions

View File

@ -166,6 +166,15 @@ import "testlogger.js" as TestLogger
and mouseMove() methods can be used to simulate mouse events in a
similar fashion.
If your test creates other windows, it's possible that those windows
become active, stealing the focus from the TestCase's window. To ensure
that the TestCase's window is active, use the following code:
\code
testCase.Window.window.requestActivate()
tryCompare(testCase.Window.window, "active", true)
\endcode
\b{Note:} keyboard and mouse events can only be delivered once the
main window has been shown. Attempts to deliver events before then
will fail. Use the \l when and windowShown properties to track