Cherrypick Handle quotes in plain strings to 23.04
Unescape quotes in plain strings
(cherry picked from commit 925e20ebb8)
This commit is contained in:
@@ -326,11 +326,19 @@ void TextHandlerTest::receivePlainTextIn()
|
||||
const QString testOutputStringRich = QStringLiteral("<plain text in tag bracket><br>Test link <a href=\"https://kde.org\">https://kde.org</a>.");
|
||||
QString testOutputStringPlain = QStringLiteral("<plain text in tag bracket>\nTest link https://kde.org.");
|
||||
|
||||
// Make sure quotes are maintained in a plain string.
|
||||
const QString testInputString2 = QStringLiteral("last line is \"Time to switch to a new topic.\"");
|
||||
const QString testOutputString2 = QStringLiteral("last line is \"Time to switch to a new topic.\"");
|
||||
|
||||
TextHandler testTextHandler;
|
||||
testTextHandler.setData(testInputString);
|
||||
|
||||
QCOMPARE(testTextHandler.handleRecieveRichText(Qt::PlainText), testOutputStringRich);
|
||||
QCOMPARE(testTextHandler.handleRecievePlainText(), testOutputStringPlain);
|
||||
|
||||
testTextHandler.setData(testInputString2);
|
||||
QCOMPARE(testTextHandler.handleRecieveRichText(Qt::PlainText), testOutputString2);
|
||||
QCOMPARE(testTextHandler.handleRecievePlainText(), testOutputString2);
|
||||
}
|
||||
|
||||
void TextHandlerTest::receiveStripNewlines()
|
||||
|
||||
@@ -371,6 +371,7 @@ QString TextHandler::unescapeHtml(QString stringIn)
|
||||
stringIn.replace(QStringLiteral("<"), QStringLiteral("<"));
|
||||
stringIn.replace(QStringLiteral(">"), QStringLiteral(">"));
|
||||
stringIn.replace(QStringLiteral("&"), QStringLiteral("&"));
|
||||
stringIn.replace(QStringLiteral("""), QStringLiteral("\""));
|
||||
return stringIn;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user