Cherrypick Handle stripnewlines for plain text list to 23.04

Handle stripping new lines when the plain text input is a markdown list.


(cherry picked from commit a0ae8b28b2)
This commit is contained in:
James Graham
2023-03-27 13:30:27 +00:00
committed by Tobias Fella
parent a3b4f05e2c
commit 566743bc19
3 changed files with 16 additions and 8 deletions

View File

@@ -347,6 +347,9 @@ void TextHandlerTest::receiveStripNewlines()
const QString testInputStringRich = QStringLiteral("Test<br>many<br />new<br>lines.");
const QString testOutputString = QStringLiteral("Test many new lines.");
const QString testInputStringPlain2 = QStringLiteral("* List\n* Items");
const QString testOutputString2 = QStringLiteral("List Items");
TextHandler testTextHandler;
testTextHandler.setData(testInputStringPlain);
@@ -354,9 +357,11 @@ void TextHandlerTest::receiveStripNewlines()
QCOMPARE(testTextHandler.handleRecieveRichText(Qt::PlainText, nullptr, nullptr, true), testOutputString);
testTextHandler.setData(testInputStringRich);
QCOMPARE(testTextHandler.handleRecievePlainText(Qt::RichText, true), testOutputString);
QCOMPARE(testTextHandler.handleRecieveRichText(Qt::RichText, nullptr, nullptr, true), testOutputString);
testTextHandler.setData(testInputStringPlain2);
QCOMPARE(testTextHandler.handleRecievePlainText(Qt::RichText, true), testOutputString2);
}
/**