summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2019-05-13 12:58:37 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2019-05-24 15:37:05 +0200
commit7224d0e427d71e559b928c44634839b4791c1416 (patch)
tree86a327b5a31c52a2e94b6d6158a96ac05f63f052 /tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp
parent2c8fa9700cb1eb5f1587bec46b7060ec93c6b1d2 (diff)
QTextMarkdownImporter: don't keep heading level on following list item
When reading a document like # heading - list item and then re-writing it, it turned into # heading - # list item because QTextCursor::insertList() simply calls QTextCursor::insertBlock(), thus inheriting block format from the previous block, without an opportunity to explicitly define the block format. So be more consistent: use QTextMarkdownImporter::insertBlock() for blocks inside list items too. Now it fully defines blockFormat first, then inserts the block, and then adds it to the current list only when the "paragraph" is actually the list item's text (but not when it's a continuation paragraph). Also, be prepared for applying and removing block markers to arbitrary blocks, just in case (they might be useful for block quotes, for example). Change-Id: I391820af9b65e75abce12abab45d2477c49c86ac Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
Diffstat (limited to 'tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp')
-rw-r--r--tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp b/tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp
index 9998794762..b14e810430 100644
--- a/tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp
+++ b/tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp
@@ -357,6 +357,7 @@ void tst_QTextMarkdownWriter::rewriteDocument_data()
QTest::newRow("block quotes") << "blockquotes.md";
QTest::newRow("example") << "example.md";
+ QTest::newRow("list items after headings") << "headingsAndLists.md";
}
void tst_QTextMarkdownWriter::rewriteDocument()