diff options
author | Andy Shaw <andy.shaw@digia.com> | 2012-10-18 13:34:26 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-10-22 01:54:15 (GMT) |
commit | e737ea6dbc0430075d30ad995d402437c7231da1 (patch) | |
tree | 9491ef0f99b4d38772b66e39f74dff573222ffb1 /tests/auto/qtextodfwriter | |
parent | 11e820a6a1cee10bed2992a594407dadc9d4dab5 (diff) | |
download | Qt-e737ea6dbc0430075d30ad995d402437c7231da1.zip Qt-e737ea6dbc0430075d30ad995d402437c7231da1.tar.gz Qt-e737ea6dbc0430075d30ad995d402437c7231da1.tar.bz2 |
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 <simon.hausmann@digia.com>
(cherry picked from qtbase/d060620e6cd3c94e7e0ff809b21593b9c0da0be2)
Diffstat (limited to 'tests/auto/qtextodfwriter')
-rw-r--r-- | tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp b/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp index 43f859c..9a62277 100644 --- a/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp +++ b/tests/auto/qtextodfwriter/tst_qtextodfwriter.cpp @@ -72,6 +72,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 @@ -422,5 +423,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( + "<style:style style:name=\"s0\" style:family=\"section\">" + "<style:section-properties fo:margin-top=\"15pt\" fo:margin-bottom=\"15pt\"" + " fo:margin-left=\"15pt\" fo:margin-right=\"15pt\"/>" + "</style:style>"); + QCOMPARE(getContentFromXml(), xml); +} + QTEST_MAIN(tst_QTextOdfWriter) #include "tst_qtextodfwriter.moc" |