diff options
Diffstat (limited to 'tests/auto/printsupport')
-rw-r--r-- | tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp index fef7c4905d..81a53bd6b6 100644 --- a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp +++ b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp @@ -1516,7 +1516,13 @@ void tst_QPrinter::outputFormat() QCOMPARE(printer.printerName(), QString()); } else { QCOMPARE(printer.outputFormat(), QPrinter::NativeFormat); - QCOMPARE(printer.printerName(), QPrinterInfo::defaultPrinter().printerName()); + + // If no printer is default, the first available printer should be used. + // Otherwise, the default printer should be used. + if (QPrinterInfo::defaultPrinter().isNull()) + QCOMPARE(printer.printerName(), QPrinterInfo::availablePrinters().at(0).printerName()); + else + QCOMPARE(printer.printerName(), QPrinterInfo::defaultPrinter().printerName()); } printer.setOutputFormat(QPrinter::PdfFormat); |