From d060620e6cd3c94e7e0ff809b21593b9c0da0be2 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 18 Oct 2012 15:34:26 +0200 Subject: Use the right properties when checking the frame's margins Changed it to check the Frame*Margin property instead of the Block*Margin property as this was incorrect for a QTextFrameFormat. Task-number: QTBUG-22173 Change-Id: I2c3066165fb592ed034874b1180593822859f933 Reviewed-by: Simon Hausmann --- .../gui/text/qtextodfwriter/tst_qtextodfwriter.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'tests') diff --git a/tests/auto/gui/text/qtextodfwriter/tst_qtextodfwriter.cpp b/tests/auto/gui/text/qtextodfwriter/tst_qtextodfwriter.cpp index 74a7ac95ea..c287ef30ac 100644 --- a/tests/auto/gui/text/qtextodfwriter/tst_qtextodfwriter.cpp +++ b/tests/auto/gui/text/qtextodfwriter/tst_qtextodfwriter.cpp @@ -69,6 +69,7 @@ private slots: void testWriteAll(); void testWriteSection(); void testWriteTable(); + void testWriteFrameFormat(); private: /// closes the document and returns the part of the XML stream that the test wrote @@ -419,5 +420,23 @@ void tst_QTextOdfWriter::testWriteTable() QCOMPARE(getContentFromXml(), xml); } +void tst_QTextOdfWriter::testWriteFrameFormat() +{ + QTextFrameFormat tff; + tff.setTopMargin(20); + tff.setBottomMargin(20); + tff.setLeftMargin(20); + tff.setRightMargin(20); + QTextCursor tc(document); + odfWriter->writeFrameFormat(*xmlWriter, tff, 0); + // Value of 15pt is based on the pixelToPoint() calculation done in qtextodfwriter.cpp + QString xml = QString::fromLatin1( + "" + "" + ""); + QCOMPARE(getContentFromXml(), xml); +} + QTEST_MAIN(tst_QTextOdfWriter) #include "tst_qtextodfwriter.moc" -- cgit v1.2.3