QPrinter - Add more tests

Add more missing tests.

Change-Id: I801c5c67731075ccb3e62377c0eccc420e708365
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
This commit is contained in:
John Layt 2014-02-19 15:07:10 +01:00 committed by The Qt Project
parent f05e48381b
commit aab29d546c

View File

@ -1259,6 +1259,8 @@ void tst_QPrinter::fullPage()
QCOMPARE(pdf.fullPage(), false);
pdf.setFullPage(true);
QCOMPARE(pdf.fullPage(), true);
pdf.setFullPage(false);
QCOMPARE(pdf.fullPage(), false);
QPrinter native;
if (native.outputFormat() == QPrinter::NativeFormat) {
@ -1275,6 +1277,17 @@ void tst_QPrinter::fullPage()
QCOMPARE(native.fullPage(), expected);
native.setOutputFormat(QPrinter::NativeFormat);
QCOMPARE(native.fullPage(), expected);
// Test set/get
expected = false;
native.setFullPage(expected);
QCOMPARE(native.fullPage(), expected);
// Test value preservation
native.setOutputFormat(QPrinter::PdfFormat);
QCOMPARE(native.fullPage(), expected);
native.setOutputFormat(QPrinter::NativeFormat);
QCOMPARE(native.fullPage(), expected);
} else {
QSKIP("No printers installed, cannot test NativeFormat, please install printers to test");
}
@ -1310,6 +1323,17 @@ void tst_QPrinter::orientation()
QCOMPARE(native.orientation(), expected);
native.setOutputFormat(QPrinter::NativeFormat);
QCOMPARE(native.orientation(), expected);
// Test set/get
expected = QPrinter::Portrait;
native.setOrientation(expected);
QCOMPARE(native.orientation(), expected);
// Test value preservation
native.setOutputFormat(QPrinter::PdfFormat);
QCOMPARE(native.orientation(), expected);
native.setOutputFormat(QPrinter::NativeFormat);
QCOMPARE(native.orientation(), expected);
} else {
QSKIP("No printers installed, cannot test NativeFormat, please install printers to test");
}
@ -1710,13 +1734,8 @@ void tst_QPrinter::resolution()
// Test set/get
int expected = 333;
#ifdef Q_OS_MAC
// Set resolution does nothing on OSX, see QTBUG-7000
expected = native.resolution();
foreach (int supported, native.supportedResolutions()) {
if (supported != expected) {
expected = supported;
break;
}
}
#endif // Q_OS_MAC
native.setResolution(expected);
QCOMPARE(native.resolution(), expected);