tst_QPrinter: Use qWaitForWindowActive() to wait for dialog
Instead of an unconditional wait. The QSKIP is necessary because the PDF format is non-native and the Windows implementation of QPrintDialog doesn't work then. The macOS implementation has the same warning, so add the check for that OS as well. The test has previously passed, since it hasn't seen not actually opening the dialog as an issue. Change-Id: Ib53e378b232580358f13e0c5206404412f9e6ee2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>bb10
parent
a9d903d18f
commit
b49a2e671a
|
|
@ -592,10 +592,14 @@ void tst_QPrinter::printDialogCompleter()
|
|||
{
|
||||
QPrintDialog dialog;
|
||||
dialog.printer()->setOutputFileName(testPdfFileName(QLatin1String("file")));
|
||||
#if defined(Q_OS_WIN) || defined(Q_OS_DARWIN)
|
||||
if (dialog.printer()->outputFormat() != QPrinter::NativeFormat)
|
||||
QSKIP("Dialog cannot be used with non-native formats");
|
||||
#endif
|
||||
dialog.setEnabledOptions(QAbstractPrintDialog::PrintToFile);
|
||||
dialog.show();
|
||||
|
||||
QTest::qWait(100);
|
||||
QVERIFY(QTest::qWaitForWindowActive(&dialog));
|
||||
|
||||
QTest::keyClick(&dialog, Qt::Key_Tab);
|
||||
QTest::keyClick(&dialog, 'P');
|
||||
|
|
|
|||
Loading…
Reference in New Issue