From b49a2e671a6c01bec0f0140a81f5501074ec8856 Mon Sep 17 00:00:00 2001 From: Kari Oikarinen Date: Tue, 3 Apr 2018 13:41:41 +0300 Subject: 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 --- tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp index 88bae686ab..f68cf5c59c 100644 --- a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp +++ b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp @@ -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'); -- cgit v1.2.3