summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp')
-rw-r--r--tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp b/tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp
index 13449299cb..b60b07ea30 100644
--- a/tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp
+++ b/tests/auto/gui/text/qtextmarkdownwriter/tst_qtextmarkdownwriter.cpp
@@ -51,6 +51,7 @@ private slots:
void testWriteParagraph();
void testWriteList();
void testWriteEmptyList();
+ void testWriteCheckboxListItemEndingWithCode();
void testWriteNestedBulletLists_data();
void testWriteNestedBulletLists();
void testWriteNestedNumericLists();
@@ -133,6 +134,34 @@ void tst_QTextMarkdownWriter::testWriteEmptyList()
QCOMPARE(documentToUnixMarkdown(), QString::fromLatin1("- \n"));
}
+void tst_QTextMarkdownWriter::testWriteCheckboxListItemEndingWithCode()
+{
+ QTextCursor cursor(document);
+ QTextList *list = cursor.createList(QTextListFormat::ListDisc);
+ cursor.insertText("Image.originalSize property (not necessary; PdfDocument.pagePointSize() substitutes)");
+ list->add(cursor.block());
+ {
+ auto fmt = cursor.block().blockFormat();
+ fmt.setMarker(QTextBlockFormat::MarkerType::Unchecked);
+ cursor.setBlockFormat(fmt);
+ }
+ cursor.movePosition(QTextCursor::PreviousWord, QTextCursor::MoveAnchor, 2);
+ cursor.movePosition(QTextCursor::Left, QTextCursor::MoveAnchor);
+ cursor.movePosition(QTextCursor::PreviousWord, QTextCursor::KeepAnchor, 4);
+ QCOMPARE(cursor.selectedText(), QString::fromLatin1("PdfDocument.pagePointSize()"));
+ auto fmt = cursor.charFormat();
+ fmt.setFontFixedPitch(true);
+ cursor.setCharFormat(fmt);
+ cursor.movePosition(QTextCursor::PreviousWord, QTextCursor::MoveAnchor, 5);
+ cursor.movePosition(QTextCursor::Left, QTextCursor::MoveAnchor);
+ cursor.movePosition(QTextCursor::PreviousWord, QTextCursor::KeepAnchor, 4);
+ QCOMPARE(cursor.selectedText(), QString::fromLatin1("Image.originalSize"));
+ cursor.setCharFormat(fmt);
+
+ QCOMPARE(documentToUnixMarkdown(), QString::fromLatin1(
+ "- [ ] `Image.originalSize` property (not necessary; `PdfDocument.pagePointSize()`\n substitutes)\n"));
+}
+
void tst_QTextMarkdownWriter::testWriteNestedBulletLists_data()
{
QTest::addColumn<bool>("checkbox");