diff options
-rw-r--r-- | tests/auto/qprinterinfo/tst_qprinterinfo.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/tests/auto/qprinterinfo/tst_qprinterinfo.cpp b/tests/auto/qprinterinfo/tst_qprinterinfo.cpp index e397b76..2fa7515 100644 --- a/tests/auto/qprinterinfo/tst_qprinterinfo.cpp +++ b/tests/auto/qprinterinfo/tst_qprinterinfo.cpp @@ -101,6 +101,8 @@ void tst_QPrinterInfo::macFixNameFormat(QString *printerName) #ifdef Q_WS_MAC printerName->replace(QLatin1String("___"), QLatin1String(" @ ")); printerName->replace(QLatin1String("_"), QLatin1String(".")); +#else + Q_UNUSED(printerName); #endif } @@ -282,16 +284,17 @@ void tst_QPrinterInfo::testForPrinters() QCOMPARE(printers.size(), sysPrinters.size()); + QHash<QString, bool> qtPrinters; + + for (int j = 0; j < printers.size(); ++j) { + qtPrinters.insert(printers.at(j).printerName(), !printers.at(j).isNull()); + } + for (int i = 0; i < sysPrinters.size(); ++i) { - bool found = false; - for (int j = 0; j < printers.size(); ++j) { - if (sysPrinters.at(i) == printers.at(j).printerName()) { - QVERIFY(!printers.at(j).isNull()); - found = true; - break; - } + if (!qtPrinters.value(sysPrinters.at(i))) { + qDebug() << "Avaliable printers: " << qtPrinters; + QFAIL(qPrintable(QString("Printer '%1' reported by system, but not reported by Qt").arg(sysPrinters.at(i)))); } - if (!found) QFAIL("Printer reported by system, but not reported by Qt"); } #else QSKIP("Test doesn't work on non-Unix", SkipAll); |