summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-09-30 14:47:15 +0200
committerOlivier Goffart <ogoffart@trolltech.com>2009-09-30 15:26:05 +0200
commit0986dab7c77fced09ddb4400b20d3939f4ba1002 (patch)
treefea071aa4acfcc6f9ec0ef61c92397c685ec49b5
parentcf8dcda1316198f2e54195cf7b7137c7ae05f91b (diff)
Add more debug information to the QPrinterInfo test
Reviewed-by: Paul
-rw-r--r--tests/auto/qprinterinfo/tst_qprinterinfo.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/tests/auto/qprinterinfo/tst_qprinterinfo.cpp b/tests/auto/qprinterinfo/tst_qprinterinfo.cpp
index e397b76a95..2fa75151ae 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);