diff options
author | John Layt <jlayt@kde.org> | 2013-12-18 21:51:12 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-17 13:45:44 +0100 |
commit | b0428926cece7bc362bc24c2eb1621b9fef737c7 (patch) | |
tree | e5497f1b5c2f7bdacb5e7e0ba9898f9423884e26 /tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp | |
parent | cf8b8340f3d283830a6aca2f708e839bb70d6d57 (diff) |
QPrinterInfo - Switch to QPlatformPrintDevice
Change the QPrinterInfo implementation to use QPlatformPrintDevice as
the backend. Remove all the old QPrinterInfo related code from the
QPA plugin. Add public api to QPrinterInfo to support some features
from QPlatformPrintDevice.
[ChangeLog][QtPrintSupport][QPrinterInfo] Added new public api for
isRemote(), state(), defaultPageSize(), supportedPageSizes(),
supportsCustomPageSizes(), minimumPhysicalPageSize(),
maximumPhysicalPageSize(), supportedResolutions(),
availablePrinterNames(), and defaultPrinterName(). The use of
availablePrinters() is discouraged due to performance concerns.
Task-number: QTBUG-35248
Change-Id: Ic38323a930549ad67bf04a1a6bb43d623dfe6a33
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp')
-rw-r--r-- | tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp | 94 |
1 files changed, 67 insertions, 27 deletions
diff --git a/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp b/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp index fb2609b7ec..294c90fdd3 100644 --- a/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp +++ b/tests/auto/printsupport/kernel/qprinterinfo/tst_qprinterinfo.cpp @@ -267,8 +267,14 @@ void tst_QPrinterInfo::testForPaperSizes() // In the meantime just exercise the code path and print-out for inspection. QList<QPrinterInfo> printers = QPrinterInfo::availablePrinters(); - for (int i = 0; i < printers.size(); ++i) - qDebug() << "Printer: " << printers.at(i).printerName() << " Paper Sizes: " << printers.at(i).supportedPaperSizes(); + for (int i = 0; i < printers.size(); ++i) { + qDebug() << "Printer : " << printers.at(i).printerName() << printers.at(i).defaultPageSize(); + qDebug() << "Paper Sizes : " << printers.at(i).supportedPageSizes(); + qDebug() << "Custom Sizes : " << printers.at(i).supportsCustomPageSizes(); + qDebug() << "Physical Sizes: " << printers.at(i).minimumPhysicalPageSize() + << printers.at(i).maximumPhysicalPageSize(); + qDebug() << ""; + } } void tst_QPrinterInfo::testConstructors() @@ -284,17 +290,41 @@ void tst_QPrinterInfo::testConstructors() for (int i = 0; i < printers.size(); ++i) { QPrinterInfo copy1(printers.at(i)); - QCOMPARE(copy1.printerName(), printers.at(i).printerName()); - QCOMPARE(copy1.isNull(), printers.at(i).isNull()); - QCOMPARE(copy1.isDefault(), printers.at(i).isDefault()); - QCOMPARE(copy1.supportedPaperSizes(), printers.at(i).supportedPaperSizes()); + QCOMPARE(copy1.printerName(), printers.at(i).printerName()); + QCOMPARE(copy1.description(), printers.at(i).description()); + QCOMPARE(copy1.location(), printers.at(i).location()); + QCOMPARE(copy1.makeAndModel(), printers.at(i).makeAndModel()); + QCOMPARE(copy1.isNull(), printers.at(i).isNull()); + QCOMPARE(copy1.isDefault(), printers.at(i).isDefault()); + QCOMPARE(copy1.isRemote(), printers.at(i).isRemote()); + QCOMPARE(copy1.state(), printers.at(i).state()); + QCOMPARE(copy1.supportedPageSizes(), printers.at(i).supportedPageSizes()); + QCOMPARE(copy1.defaultPageSize(), printers.at(i).defaultPageSize()); + QCOMPARE(copy1.supportsCustomPageSizes(), printers.at(i).supportsCustomPageSizes()); + QCOMPARE(copy1.minimumPhysicalPageSize(), printers.at(i).minimumPhysicalPageSize()); + QCOMPARE(copy1.maximumPhysicalPageSize(), printers.at(i).maximumPhysicalPageSize()); + QCOMPARE(copy1.supportedPaperSizes(), printers.at(i).supportedPaperSizes()); + QCOMPARE(copy1.supportedSizesWithNames(), printers.at(i).supportedSizesWithNames()); + QCOMPARE(copy1.supportedResolutions(), printers.at(i).supportedResolutions()); QPrinter printer(printers.at(i)); QPrinterInfo copy2(printer); - QCOMPARE(copy2.printerName(), printers.at(i).printerName()); - QCOMPARE(copy2.isNull(), printers.at(i).isNull()); - QCOMPARE(copy2.isDefault(), printers.at(i).isDefault()); - QCOMPARE(copy2.supportedPaperSizes(), printers.at(i).supportedPaperSizes()); + QCOMPARE(copy2.printerName(), printers.at(i).printerName()); + QCOMPARE(copy2.description(), printers.at(i).description()); + QCOMPARE(copy2.location(), printers.at(i).location()); + QCOMPARE(copy2.makeAndModel(), printers.at(i).makeAndModel()); + QCOMPARE(copy2.isNull(), printers.at(i).isNull()); + QCOMPARE(copy2.isDefault(), printers.at(i).isDefault()); + QCOMPARE(copy2.isRemote(), printers.at(i).isRemote()); + QCOMPARE(copy2.state(), printers.at(i).state()); + QCOMPARE(copy2.supportedPageSizes(), printers.at(i).supportedPageSizes()); + QCOMPARE(copy2.defaultPageSize(), printers.at(i).defaultPageSize()); + QCOMPARE(copy2.supportsCustomPageSizes(), printers.at(i).supportsCustomPageSizes()); + QCOMPARE(copy2.minimumPhysicalPageSize(), printers.at(i).minimumPhysicalPageSize()); + QCOMPARE(copy2.maximumPhysicalPageSize(), printers.at(i).maximumPhysicalPageSize()); + QCOMPARE(copy2.supportedPaperSizes(), printers.at(i).supportedPaperSizes()); + QCOMPARE(copy2.supportedSizesWithNames(), printers.at(i).supportedSizesWithNames()); + QCOMPARE(copy2.supportedResolutions(), printers.at(i).supportedResolutions()); } } @@ -311,13 +341,20 @@ void tst_QPrinterInfo::testAssignment() for (int i = 0; i < printers.size(); ++i) { QPrinterInfo copy; copy = printers.at(i); - QCOMPARE(copy.printerName(), printers.at(i).printerName()); - QCOMPARE(copy.isNull(), printers.at(i).isNull()); - QCOMPARE(copy.isDefault(), printers.at(i).isDefault()); - QCOMPARE(copy.description(), printers.at(i).description()); - QCOMPARE(copy.location(), printers.at(i).location()); - QCOMPARE(copy.makeAndModel(), printers.at(i).makeAndModel()); - QCOMPARE(copy.supportedPaperSizes(), printers.at(i).supportedPaperSizes()); + QCOMPARE(copy.printerName(), printers.at(i).printerName()); + QCOMPARE(copy.description(), printers.at(i).description()); + QCOMPARE(copy.location(), printers.at(i).location()); + QCOMPARE(copy.makeAndModel(), printers.at(i).makeAndModel()); + QCOMPARE(copy.isNull(), printers.at(i).isNull()); + QCOMPARE(copy.isDefault(), printers.at(i).isDefault()); + QCOMPARE(copy.isRemote(), printers.at(i).isRemote()); + QCOMPARE(copy.state(), printers.at(i).state()); + QCOMPARE(copy.supportedPageSizes(), printers.at(i).supportedPageSizes()); + QCOMPARE(copy.defaultPageSize(), printers.at(i).defaultPageSize()); + QCOMPARE(copy.supportsCustomPageSizes(), printers.at(i).supportsCustomPageSizes()); + QCOMPARE(copy.minimumPhysicalPageSize(), printers.at(i).minimumPhysicalPageSize()); + QCOMPARE(copy.maximumPhysicalPageSize(), printers.at(i).maximumPhysicalPageSize()); + QCOMPARE(copy.supportedResolutions(), printers.at(i).supportedResolutions()); } } @@ -329,16 +366,19 @@ void tst_QPrinterInfo::namedPrinter() foreach (const QPrinterInfo &pi, printers) { QPrinterInfo pi2 = QPrinterInfo::printerInfo(pi.printerName()); - qDebug() << "Printer: " << pi2.printerName() << " : " << pi2.description() << " : " - << pi2.location() << " : " << pi2.makeAndModel() << " : " - << pi2.isNull() << " : " << pi2.isDefault(); - QCOMPARE(pi2.printerName(), pi.printerName()); - QCOMPARE(pi2.description(), pi.description()); - QCOMPARE(pi2.location(), pi.location()); - QCOMPARE(pi2.makeAndModel(), pi.makeAndModel()); - QCOMPARE(pi2.supportedPaperSizes(), pi.supportedPaperSizes()); - QCOMPARE(pi2.isNull(), pi.isNull()); - QCOMPARE(pi2.isDefault(), pi.isDefault()); + QCOMPARE(pi2.printerName(), pi.printerName()); + QCOMPARE(pi2.description(), pi.description()); + QCOMPARE(pi2.location(), pi.location()); + QCOMPARE(pi2.makeAndModel(), pi.makeAndModel()); + QCOMPARE(pi2.isNull(), pi.isNull()); + QCOMPARE(pi2.isDefault(), pi.isDefault()); + QCOMPARE(pi2.isRemote(), pi.isRemote()); + QCOMPARE(pi2.supportedPageSizes(), pi.supportedPageSizes()); + QCOMPARE(pi2.defaultPageSize(), pi.defaultPageSize()); + QCOMPARE(pi2.supportsCustomPageSizes(), pi.supportsCustomPageSizes()); + QCOMPARE(pi2.minimumPhysicalPageSize(), pi.minimumPhysicalPageSize()); + QCOMPARE(pi2.maximumPhysicalPageSize(), pi.maximumPhysicalPageSize()); + QCOMPARE(pi2.supportedResolutions(), pi.supportedResolutions()); } } #endif // QT_NO_PRINTER |