From d1c6f7e5a2e0ee6c50bbf0668e44200bd8469a09 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 14 Oct 2019 17:59:16 +0200 Subject: QTextMarkdownWriter: preserve empty lists 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 --- .../gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp') 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("checkbox"); -- cgit v1.2.3