From 35579f6fe73edcc61a266ba16d25d6c97f1dd225 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Fri, 31 Jan 2014 15:00:59 +0100 Subject: Support empty inline elements in block tags in QTextDocument This fixes the following case:
Foobar
Qt would see the end of , and consider the current block tag as closed, thus resetting the block format, thus losing the margin set for the current block (due to blockquote). If you do
FooFoobar
instead, then the same would not happen, since hasBlock is set to false when we append text to the current inline node. [ChangeLog][QTextDocument] Add support for empty inline elements in block tags. Task-number: QTBUG-33336 Change-Id: Ic566edfec96cb8d44d1c02932bb195bc921d1580 Reviewed-by: Simon Hausmann --- .../gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests') diff --git a/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp b/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp index 009b536d7e..4274753c37 100644 --- a/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp +++ b/tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp @@ -266,6 +266,7 @@ private slots: void html_metaInBody(); void html_importImageWithoutAspectRatio(); void html_fromFirefox(); + void html_emptyInlineInsideBlock(); private: inline void setHtml(const QString &html) @@ -4004,5 +4005,11 @@ void tst_QTextDocumentFragment::html_fromFirefox() QCOMPARE(doc->toPlainText(), QString::fromLatin1("Test Text ")); } +void tst_QTextDocumentFragment::html_emptyInlineInsideBlock() +{ + doc->setHtml(QString::fromLatin1("
Foobar
")); + QVERIFY(doc->firstBlock().blockFormat().leftMargin() > 0); +} + QTEST_MAIN(tst_QTextDocumentFragment) #include "tst_qtextdocumentfragment.moc" -- cgit v1.2.3