summaryrefslogtreecommitdiffstats
path: root/tests/auto/printsupport/kernel/qprinterinfo
diff options
context:
space:
mode:
authorJohn Layt <jlayt@kde.org>2012-05-14 20:17:16 +0100
committerQt by Nokia <qt-info@nokia.com>2012-05-24 09:48:27 +0200
commit36f469bdb1c705f0082610a4fe9fd88b90accd24 (patch)
treefa96b0b3091d1730966a20d142add5d12d87d400 /tests/auto/printsupport/kernel/qprinterinfo
parentce5c1db2d3db7d7c7af28e9053ca591f76c6101c (diff)
QtPrintSupport - Modify Platform Plugin QPrinterInfo api
Change the way the printsupport plugin creates QPrinterInfo objects, provide platform api to return a named printer, and expose this as static public api in QPrinterInfo. Only the Mac plugin used the old api, the other plugins will have direct support added in separate commits, but will use the default implementation for now. Change-Id: I7d6b6556eb39919cfb15bc0e814afbaf13c5712c Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'tests/auto/printsupport/kernel/qprinterinfo')
-rw-r--r--tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp b/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp
index 70a00edb10..ad51b910eb 100644
--- a/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp
+++ b/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp
@@ -68,6 +68,7 @@ private slots:
void testForPaperSizes();
void testConstructors();
void testAssignment();
+ void namedPrinter();
private:
QString getDefaultPrinterFromSystem();
@@ -373,6 +374,24 @@ void tst_QPrinterInfo::testAssignment()
}
}
+void tst_QPrinterInfo::namedPrinter()
+{
+ QList<QPrinterInfo> printers = QPrinterInfo::availablePrinters();
+
+ QStringList printerNames;
+
+ foreach (const QPrinterInfo &pi, printers) {
+ QPrinterInfo pi2 = QPrinterInfo::printerInfo(pi.printerName());
+ qDebug() << "Printer: " << pi2.printerName() << " : "
+ << pi2.isNull() << " : " << pi2.isDefault();
+ QCOMPARE(pi2.printerName(), pi.printerName());
+ QCOMPARE(pi2.supportedPaperSizes(), pi.supportedPaperSizes());
+ QCOMPARE(pi2.isNull(), pi.isNull());
+ QCOMPARE(pi2.isDefault(), pi.isDefault());
+ }
+}
+
+
#endif
QTEST_MAIN(tst_QPrinterInfo)