diff options
author | Andy Shaw <andy.shaw@digia.com> | 2013-10-10 22:57:08 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-12 00:02:04 +0200 |
commit | 3fe242781e88224d121ebca730db5ebe4fb98ec6 (patch) | |
tree | 83686e51074ca336cb6ab3654633ca5eadf6c7b8 /tests/auto | |
parent | 257e98917c2b9c1bc06272eb663a73ee57c094c1 (diff) |
Export the block's line-height settings to html
Task-number: QTBUG-28404
Change-Id: I87e03ecd981c302a5aefdadf7bcfd9729e37bd13
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp index 10e79065ee..307e5a6210 100644 --- a/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp @@ -113,6 +113,7 @@ private slots: void toHtmlBodyBgColorRgba(); void toHtmlBodyBgColorTransparent(); void toHtmlRootFrameProperties(); + void toHtmlLineHeightProperties(); void capitalizationHtmlInExport(); void wordspacingHtmlExport(); @@ -1856,6 +1857,25 @@ void tst_QTextDocument::toHtmlRootFrameProperties() QCOMPARE(doc.toHtml(), expectedOutput); } +void tst_QTextDocument::toHtmlLineHeightProperties() +{ + CREATE_DOC_AND_CURSOR(); + + QTextBlock block = doc.firstBlock(); + QTextBlockFormat blockFormat = block.blockFormat(); + blockFormat.setLineHeight(200, QTextBlockFormat::ProportionalHeight); + cursor.setBlockFormat(blockFormat); + + cursor.insertText("Blah"); + QString expectedOutput("<p DEFAULTBLOCKSTYLE line-height:200%;\">Blah</p>"); + + expectedOutput.prepend(htmlHead); + expectedOutput.replace("DEFAULTBLOCKSTYLE", "style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"); + expectedOutput.append(htmlTail); + + QCOMPARE(doc.toHtml(), expectedOutput); +} + void tst_QTextDocument::capitalizationHtmlInExport() { doc->setPlainText("Test"); |