Move the function to get a subtitle string to eventhandler

This commit is contained in:
James Graham
2023-12-10 13:19:13 +00:00
parent 4751ac6acc
commit 8d717b78ac
7 changed files with 43 additions and 44 deletions

View File

@@ -61,6 +61,8 @@ private Q_SLOTS:
void genericBody_data();
void genericBody();
void nullGenericBody();
void subtitle();
void nullSubtitle();
void mediaInfo();
void nullMediaInfo();
void linkPreviewer();
@@ -348,6 +350,25 @@ void EventHandlerTest::nullGenericBody()
QCOMPARE(noEventHandler.getGenericBody(), QString());
}
void EventHandlerTest::subtitle()
{
auto event = room->messageEvents().at(0).get();
eventHandler.setEvent(event);
QCOMPARE(eventHandler.subtitleText(), QStringLiteral("after: This is an example text message"));
event = room->messageEvents().at(2).get();
eventHandler.setEvent(event);
QCOMPARE(eventHandler.subtitleText(), QStringLiteral("after: This is a highlight @bob:kde.org and this is a link https://kde.org"));
}
void EventHandlerTest::nullSubtitle()
{
QTest::ignoreMessage(QtWarningMsg, "subtitleText called with m_event set to nullptr.");
QCOMPARE(noEventHandler.subtitleText(), QString());
}
void EventHandlerTest::mediaInfo()
{
auto event = room->messageEvents().at(4).get();