summaryrefslogtreecommitdiffstats
path: root/tests/auto/qprinterinfo/tst_qprinterinfo.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-09-30 12:47:15 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-09-30 13:26:05 (GMT)
commit0986dab7c77fced09ddb4400b20d3939f4ba1002 (patch)
treefea071aa4acfcc6f9ec0ef61c92397c685ec49b5 /tests/auto/qprinterinfo/tst_qprinterinfo.cpp
parentcf8dcda1316198f2e54195cf7b7137c7ae05f91b (diff)
downloadQt-0986dab7c77fced09ddb4400b20d3939f4ba1002.zip
Qt-0986dab7c77fced09ddb4400b20d3939f4ba1002.tar.gz
Qt-0986dab7c77fced09ddb4400b20d3939f4ba1002.tar.bz2
Add more debug information to the QPrinterInfo test
Reviewed-by: Paul
Diffstat (limited to 'tests/auto/qprinterinfo/tst_qprinterinfo.cpp')
-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 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);