summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/text/qtextmarkdownimporter/tst_qtextmarkdownimporter.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2022-05-16 13:32:44 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2022-05-20 00:49:18 +0200
commitff153d9874f728c9ec3ab40b87f55ccf0239e538 (patch)
tree46afbebf305371caa52917772f837aac2838f292 /tests/auto/gui/text/qtextmarkdownimporter/tst_qtextmarkdownimporter.cpp
parentd75c595eac9c44b2c0b36a5e574d3c299ff468c3 (diff)
Avoid ending Markdown fenced code blocks with gratuitous blank lines
This caused unnecessary empty <pre> blocks when converting markdown to HTML, made code blocks too large using QSyntaxHighlighter to highlight the whole block, and caused assymmetry when rewriting markdown. Pick-to: 6.3 Fixes: QTBUG-101031 Change-Id: I08016577ccb92edb4afae31d7df3259cb011d5c8 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'tests/auto/gui/text/qtextmarkdownimporter/tst_qtextmarkdownimporter.cpp')
-rw-r--r--tests/auto/gui/text/qtextmarkdownimporter/tst_qtextmarkdownimporter.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/tests/auto/gui/text/qtextmarkdownimporter/tst_qtextmarkdownimporter.cpp b/tests/auto/gui/text/qtextmarkdownimporter/tst_qtextmarkdownimporter.cpp
index b8d53ca194..686187cc77 100644
--- a/tests/auto/gui/text/qtextmarkdownimporter/tst_qtextmarkdownimporter.cpp
+++ b/tests/auto/gui/text/qtextmarkdownimporter/tst_qtextmarkdownimporter.cpp
@@ -380,7 +380,7 @@ void tst_QTextMarkdownImporter::avoidBlankLineAtBeginning_data()
QTest::newRow("Text block") << QString("Markdown text") << 1;
QTest::newRow("Headline") << QString("Markdown text\n============") << 1;
- QTest::newRow("Code block") << QString(" Markdown text") << 2;
+ QTest::newRow("Code block") << QString(" Markdown text") << 1;
QTest::newRow("Unordered list") << QString("* Markdown text") << 1;
QTest::newRow("Ordered list") << QString("1. Markdown text") << 1;
QTest::newRow("Blockquote") << QString("> Markdown text") << 1;
@@ -501,18 +501,17 @@ void tst_QTextMarkdownImporter::fencedCodeBlocks_data()
QTest::addColumn<QString>("expectedFenceChar");
QTest::addColumn<QString>("rewrite");
- // TODO shouldn't add empty blocks: QTBUG-101031
QTest::newRow("backtick fence with language")
<< "```pseudocode\nprint('hello world\\n')\n```\n"
- << 2 << 0 << "pseudocode" << "`"
+ << 1 << 0 << "pseudocode" << "`"
<< "```pseudocode\nprint('hello world\\n')\n```\n\n";
QTest::newRow("tilde fence with language")
<< "~~~pseudocode\nprint('hello world\\n')\n~~~\n"
- << 2 << 0 << "pseudocode" << "~"
+ << 1 << 0 << "pseudocode" << "~"
<< "~~~pseudocode\nprint('hello world\\n')\n~~~\n\n";
QTest::newRow("embedded backticks")
<< "```\nnone `one` ``two``\n```\nplain\n```\n```three``` ````four````\n```\nplain\n"
- << 4 << 2 << QString() << "`"
+ << 2 << 2 << QString() << "`"
<< "```\nnone `one` ``two``\n```\nplain\n\n```\n```three``` ````four````\n```\nplain\n\n";
}