summaryrefslogtreecommitdiffstats
path: root/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
diff options
context:
space:
mode:
authorJohn Layt <jlayt@kde.org>2014-01-28 15:05:17 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-17 13:46:13 +0100
commit1ffd79bfb7261268ea4b56d29122a48334a115a1 (patch)
tree122ab42a54d4c0d8db030690887d9a5bbcae8446 /tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
parentdbc50e06df8465e6de02ac0b4458e1a3f3f8568c (diff)
QPrinter - Fix winPageSize() on Mac and Linux
Using QPageSize internally provides the Windows ID on all platforms so remove the conditional compile on the QPrinter api and add support to the print engines. Change-Id: I31e23d5090a9b6ceb087c29dead050b0ee1855a5 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp')
-rw-r--r--tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
index 1211c75a3d..613623759c 100644
--- a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
+++ b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
@@ -1687,42 +1687,46 @@ void tst_QPrinter::supportedResolutions()
void tst_QPrinter::windowsPageSize()
{
// winPageSize() / setWinPageSize() / PPK_WindowsPageSize
- // PdfFormat: ifdef'd out TODO remove ifdef
- // NativeFormat, Cups: ifdef'd out TODO remove ifdef
+ // PdfFormat: Supported, defaults to printer default
+ // NativeFormat, Cups: Supported, defaults to printer default
// NativeFormat, Win: Supported, defaults to printer default
- // NativeFormat, Mac: ifdef'd out TODO remove ifdef
+ // NativeFormat, Mac: Supported, defaults to printer default
+
+ QPrinter pdf;
+ pdf.setOutputFormat(QPrinter::PdfFormat);
+ QCOMPARE(pdf.winPageSize(), 9); // DMPAPER_A4
+ pdf.setWinPageSize(1); // DMPAPER_LETTER
+ QCOMPARE(pdf.winPageSize(), 1);
-#ifdef Q_OS_WIN
QPrinter native;
if (native.outputFormat() == QPrinter::NativeFormat) {
// Test set/get
native.setPaperSize(QPrinter::A4);
QCOMPARE(native.pageSize(), QPrinter::A4);
- QCOMPARE(native.winPageSize(), DMPAPER_A4);
+ QCOMPARE(native.winPageSize(), 9); // DMPAPER_A4
native.setPaperSize(QPrinter::Letter);
QCOMPARE(native.pageSize(), QPrinter::Letter);
- QCOMPARE(native.winPageSize(), DMPAPER_LETTER);
+ QCOMPARE(native.winPageSize(), 1); // DMPAPER_LETTER
- native.setWinPageSize(DMPAPER_A4);
+ native.setWinPageSize(9); // DMPAPER_A4
QCOMPARE(native.pageSize(), QPrinter::A4);
- QCOMPARE(native.winPageSize(), DMPAPER_A4);
+ QCOMPARE(native.winPageSize(), 9); // DMPAPER_A4
- native.setWinPageSize(DMPAPER_LETTER);
+ native.setWinPageSize(1); // DMPAPER_LETTER
QCOMPARE(native.pageSize(), QPrinter::Letter);
- QCOMPARE(native.winPageSize(), DMPAPER_LETTER);
+ QCOMPARE(native.winPageSize(), 1); // DMPAPER_LETTER
// Test value preservation
native.setOutputFormat(QPrinter::PdfFormat);
QCOMPARE(native.pageSize(), QPrinter::Letter);
- QCOMPARE(native.winPageSize(), DMPAPER_LETTER);
+ QCOMPARE(native.winPageSize(), 1); // DMPAPER_LETTER
native.setOutputFormat(QPrinter::NativeFormat);
QCOMPARE(native.pageSize(), QPrinter::Letter);
- QCOMPARE(native.winPageSize(), DMPAPER_LETTER);
+ QCOMPARE(native.winPageSize(), 1); // DMPAPER_LETTER
} else {
QSKIP("No printers installed, cannot test NativeFormat, please install printers to test");
}
-#endif // Q_OS_WIN
}
// Test QPrinter setters/getters for non-QPrintEngine options