mirror of
https://github.com/savoirfairelinux/jami-client-qt.git
synced 2025-12-17 15:55:23 +08:00
messages display: fix the display of links
The links are now postprocessed to compensate for the malfunctions of md4c. It now displays properly even with a + or - in it. It's also checked by the unittests. GitLab: #1903 Change-Id: I0d7f520a7a3fe06fb89107fe6b08f83325218cd4
This commit is contained in:
committed by
Page Magnier-Slimani
parent
84ac5dba02
commit
65d3befad8
@@ -107,6 +107,41 @@ TEST_F(MessageParserFixture, ALinkIsParsedCorrectly)
|
||||
// The rest of the link info is not tested here.
|
||||
}
|
||||
|
||||
/*!
|
||||
* WHEN We parse a text body with a link and a + or a -.
|
||||
* THEN The HTML body should be returned correctly including the link even if MD4C doesn't detect it.
|
||||
*/
|
||||
TEST_F(MessageParserFixture, AComplexLinkIsParsedCorrectly)
|
||||
{
|
||||
auto linkColor = QColor::fromRgb(0, 0, 255);
|
||||
auto backgroundColor = QColor::fromRgb(0, 0, 255);
|
||||
|
||||
QSignalSpy messageParsedSpy(globalEnv.messageParser.data(), &MessageParser::messageParsed);
|
||||
QSignalSpy linkInfoReadySpy(globalEnv.messageParser.data(), &MessageParser::linkInfoReady);
|
||||
|
||||
// Parse a message with a link containing a + or a -.
|
||||
globalEnv.messageParser->parseMessage("msgId_03",
|
||||
"https://review.jami.net/q/status:open+-is:wip",
|
||||
false,
|
||||
linkColor,
|
||||
backgroundColor);
|
||||
|
||||
// Wait for the messageParsed signal which should be emitted once.
|
||||
messageParsedSpy.wait();
|
||||
EXPECT_EQ(messageParsedSpy.count(), 1);
|
||||
|
||||
QList<QVariant> messageParserArguments = messageParsedSpy.takeFirst();
|
||||
EXPECT_TRUE(messageParserArguments.at(0).typeId() == qMetaTypeId<QString>());
|
||||
EXPECT_EQ(messageParserArguments.at(0).toString(), "msgId_03");
|
||||
EXPECT_TRUE(messageParserArguments.at(1).typeId() == qMetaTypeId<QString>());
|
||||
EXPECT_EQ(messageParserArguments.at(1).toString(),
|
||||
"<style>a{color:#0000ff;}</style><p><a "
|
||||
"href=\"https://review.jami.net/q/status:open+-is:wip\">https://review.jami.net/q/"
|
||||
"status:open+-is:wip</a></p>\n");
|
||||
|
||||
// The rest of the link info is not tested here.
|
||||
}
|
||||
|
||||
/*!
|
||||
* WHEN We parse a text body with end of line characters.
|
||||
* THEN The HTML body should be returned correctly with the end of line characters.
|
||||
|
||||
Reference in New Issue
Block a user