From efb84b6189f9e98c6dd29c22f00ad760445196c2 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 27 Mar 2017 15:48:37 +0200 Subject: Copy stretch to multifont fontDef If we do not the fontDef of the multifont will be the default 0. Task-number: QTBUG-59443 Change-Id: Ib223517975b2a57b2371e309d12cd8f918d30825 Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../gui/painting/qpdfwriter/tst_qpdfwriter.cpp | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'tests/auto/gui/painting/qpdfwriter/tst_qpdfwriter.cpp') diff --git a/tests/auto/gui/painting/qpdfwriter/tst_qpdfwriter.cpp b/tests/auto/gui/painting/qpdfwriter/tst_qpdfwriter.cpp index 00e00ecd6b..c1a8f7f0de 100644 --- a/tests/auto/gui/painting/qpdfwriter/tst_qpdfwriter.cpp +++ b/tests/auto/gui/painting/qpdfwriter/tst_qpdfwriter.cpp @@ -29,8 +29,11 @@ #include #include #include +#include #include #include +#include +#include class tst_QPdfWriter : public QObject { @@ -40,6 +43,7 @@ private slots: void basics(); void testPageMetrics_data(); void testPageMetrics(); + void qtbug59443(); }; void tst_QPdfWriter::basics() @@ -245,6 +249,28 @@ void tst_QPdfWriter::testPageMetrics() QCOMPARE(writer.pageLayout().paintRect(QPageLayout::Millimeter), QRectF(leftMMf, topMMf, heightMMf - leftMMf - rightMMf, widthMMf - topMMf - bottomMMf)); } +void tst_QPdfWriter::qtbug59443() +{ + // Do not crash or assert + QTemporaryFile file; + QVERIFY2(file.open(), qPrintable(file.errorString())); + QPdfWriter writer(file.fileName()); + writer.setPageSize(QPdfWriter::A4); + QTextDocument doc; + doc.documentLayout()->setPaintDevice(&writer); + + doc.setUndoRedoEnabled(false); + QTextCursor cursor(&doc); + QFont font = doc.defaultFont(); + font.setFamily("Calibri"); + font.setPointSize(8); + doc.setDefaultFont(font); + + cursor.insertText(QString::fromStdWString(L"기초하며, 베어링제조업체와 타\n")); + doc.print(&writer); + +} + QTEST_MAIN(tst_QPdfWriter) #include "tst_qpdfwriter.moc" -- cgit v1.2.3