summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>2014-01-31 15:00:59 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-05 09:10:25 +0100
commit35579f6fe73edcc61a266ba16d25d6c97f1dd225 (patch)
tree0223933e35cae256e0a842a210ca45333bef0119 /tests/auto/gui
parent11189af016c1deeefed476c5cc3a408f6ee79a2d (diff)
Support empty inline elements in block tags in QTextDocument
This fixes the following case: <blockquote> <span />Foobar </blockquote> Qt would see the end of <span>, 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 <blockquote> <span>Foo</span>Foobar </blockquote> 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 <simon.hausmann@digia.com>
Diffstat (limited to 'tests/auto/gui')
-rw-r--r--tests/auto/gui/text/qtextdocumentfragment/tst_qtextdocumentfragment.cpp7
1 files changed, 7 insertions, 0 deletions
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("<!--StartFragment--><blockquote><span/>Foobar</blockquote><!--EndFragment-->"));
+ QVERIFY(doc->firstBlock().blockFormat().leftMargin() > 0);
+}
+
QTEST_MAIN(tst_QTextDocumentFragment)
#include "tst_qtextdocumentfragment.moc"