From 9d6b4d11424cdcd6c572cdcc50b3b790b6e673c0 Mon Sep 17 00:00:00 2001 From: Jordi Pujol Foyo Date: Fri, 13 Dec 2019 14:27:11 +0100 Subject: New features for QPdfWriter Added new API setDocumentXmpMetadata/documentXmpMetadata and addFileAttachment [ChangeLog][QtGui][QPdfWriter] New API to provide external document XMP metadata and attach files to PDF. Fixes: QTBUG-78651 Fixes: QTBUG-78764 Change-Id: Ic0b37e8d12899f907001db469080594c14c87655 Reviewed-by: Eirik Aavitsland --- .../gui/painting/qpdfwriter/tst_qpdfwriter.cpp | 23 ++++++++++++++++++++++ 1 file changed, 23 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 b2b2b685ae..3fbe16575d 100644 --- a/tests/auto/gui/painting/qpdfwriter/tst_qpdfwriter.cpp +++ b/tests/auto/gui/painting/qpdfwriter/tst_qpdfwriter.cpp @@ -112,6 +112,29 @@ void tst_QPdfWriter::basics() QCOMPARE(writer.pageLayout().fullRect(QPageLayout::Millimeter), QRectF(0, 0, 297, 210)); QCOMPARE(writer.pageLayout().paintRect(QPageLayout::Millimeter), QRectF(50, 50, 197, 110)); + + QByteArray metadata ( + "\n" + "\n" + " \"\n" + " \n" + " \n" + " \n" + " TITLE\n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + " \n" + "\n" + "\n" + ); + + QCOMPARE(writer.documentXmpMetadata(), QByteArray()); + writer.setDocumentXmpMetadata(metadata); + QCOMPARE(writer.documentXmpMetadata(), metadata); } // Test the old page metrics methods, see also QPrinter tests for the same. -- cgit v1.2.3