summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/text/qtextmarkdownwriter
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2019-10-14 17:59:16 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2019-11-05 16:40:18 +0200
commitd1c6f7e5a2e0ee6c50bbf0668e44200bd8469a09 (patch)
treebd35b5f802567cb06d65b09454f6ba3ecd712f7d /tests/auto/gui/text/qtextmarkdownwriter
parent524ab7b5357e66b935a42956ec365a511e62e5ed (diff)
QTextMarkdownWriter: preserve empty listsv5.14.0-beta3
You can save a "skeletal" document with list items to fill in later, the same as you can do in HTML or ODF format. Reading them back via QTextDocument::fromMarkdown() isn't always perfect though. Fixes: QTBUG-79217 Change-Id: Iacdb3e6792250ebdead05f314c9e3d00546eeb9f Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests/auto/gui/text/qtextmarkdownwriter')
-rw-r--r--tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp b/tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp
index 1e6c354f17..d15e856a20 100644
--- a/tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp
+++ b/tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp
@@ -50,6 +50,7 @@ private slots:
void testWriteParagraph_data();
void testWriteParagraph();
void testWriteList();
+ void testWriteEmptyList();
void testWriteNestedBulletLists_data();
void testWriteNestedBulletLists();
void testWriteNestedNumericLists();
@@ -124,6 +125,14 @@ void tst_QTextMarkdownWriter::testWriteList()
"- ListItem 1\n- ListItem 2\n"));
}
+void tst_QTextMarkdownWriter::testWriteEmptyList()
+{
+ QTextCursor cursor(document);
+ cursor.createList(QTextListFormat::ListDisc);
+
+ QCOMPARE(documentToUnixMarkdown(), QString::fromLatin1("- \n"));
+}
+
void tst_QTextMarkdownWriter::testWriteNestedBulletLists_data()
{
QTest::addColumn<bool>("checkbox");