diff options
author | Andy Shaw <andy.shaw@digia.com> | 2012-01-19 19:44:54 (GMT) |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-25 12:29:00 (GMT) |
commit | f149b7906cafc032aaff9d61a53079981a6ac497 (patch) | |
tree | c0b909a403ddb0804af7d7f8b4e620c443fce584 /tests/auto | |
parent | 3135b141bf11cd29d7503be0eb5190d351c2e7fd (diff) | |
download | Qt-f149b7906cafc032aaff9d61a53079981a6ac497.zip Qt-f149b7906cafc032aaff9d61a53079981a6ac497.tar.gz Qt-f149b7906cafc032aaff9d61a53079981a6ac497.tar.bz2 |
Fix set/paperSize(QPrinter::PaperSize) on Mac
This fixes the paper size setting on Mac as it would not return the
same paper size that was set with setPaperSize() when calling
paperSize().
Test is included.
Task-number: QTBUG-20882
Change-Id: Ib0064dd40de147d6db2424cdb31021e66894cc37
Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qprinter/tst_qprinter.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/tests/auto/qprinter/tst_qprinter.cpp b/tests/auto/qprinter/tst_qprinter.cpp index ea13995..09d6b26 100644 --- a/tests/auto/qprinter/tst_qprinter.cpp +++ b/tests/auto/qprinter/tst_qprinter.cpp @@ -577,15 +577,22 @@ void tst_QPrinter::outputFormatFromSuffix() void tst_QPrinter::setGetPaperSize() { - QPrinter p; - p.setOutputFormat(QPrinter::PdfFormat); - QSizeF size(500, 10); - p.setPaperSize(size, QPrinter::Millimeter); - QCOMPARE(p.paperSize(QPrinter::Millimeter), size); - QSizeF ptSize = p.paperSize(QPrinter::Point); - //qDebug() << ptSize; - QVERIFY(qAbs(ptSize.width() - size.width() * (72/25.4)) < 1E-4); - QVERIFY(qAbs(ptSize.height() - size.height() * (72/25.4)) < 1E-4); + { + QPrinter p; + p.setOutputFormat(QPrinter::PdfFormat); + QSizeF size(500, 10); + p.setPaperSize(size, QPrinter::Millimeter); + QCOMPARE(p.paperSize(QPrinter::Millimeter), size); + QSizeF ptSize = p.paperSize(QPrinter::Point); + //qDebug() << ptSize; + QVERIFY(qAbs(ptSize.width() - size.width() * (72/25.4)) < 1E-4); + QVERIFY(qAbs(ptSize.height() - size.height() * (72/25.4)) < 1E-4); + } + { + QPrinter p; + p.setPaperSize(QPrinter::Legal); + QCOMPARE(p.paperSize(), QPrinter::Legal); + } } void tst_QPrinter::testPageMargins_data() |