diff options
author | Damien Caliste <[email protected]> | 2025-06-18 11:43:13 +0200 |
---|---|---|
committer | Damien Caliste <[email protected]> | 2025-06-23 15:16:19 +0200 |
commit | 27f9fdedfff51c4a0664fd36ed52624b43d88430 (patch) | |
tree | 406b169b959ecad13cf6c38acd0386ae30fedd44 /tests | |
parent | 40673be64fd311c219fcc4f2c29774e2265bdc6a (diff) |
Add a convenient function in QMailMessage to
properly compute the In-Reply-to: and References:
headers when replying to a message.
Change-Id: Ibe962383d95e101b612258eb0ced980fef7e7203
Reviewed-by: Pekka Vuorela <[email protected]>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/tst_qmailmessage/tst_qmailmessage.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/tst_qmailmessage/tst_qmailmessage.cpp b/tests/tst_qmailmessage/tst_qmailmessage.cpp index 484c2154..e3091edc 100644 --- a/tests/tst_qmailmessage/tst_qmailmessage.cpp +++ b/tests/tst_qmailmessage/tst_qmailmessage.cpp @@ -112,6 +112,8 @@ private slots: void inReplyTo(); void setInReplyTo(); + void setInResponseTo(); + void setSingleHeaderField(); /* void status(); @@ -1287,6 +1289,32 @@ void tst_QMailMessage::setInReplyTo() testSingleHeader("In-Reply-To"); } +void tst_QMailMessage::setInResponseTo() +{ + const QString id = QLatin1String("12345"); + const QString id2 = QLatin1String("1234"); + QMailMessage message; + message.setHeaderField(QLatin1String("Message-ID"), id); + message.setHeaderField(QLatin1String("References"), id2); + + QMailMessage reply; + reply.setInResponseTo(message); + QCOMPARE(reply.inReplyTo(), id); + QCOMPARE(reply.headerField(QLatin1String("References")).content(), + QString::fromLatin1("%1 %2").arg(id2).arg(id).toUtf8()); + + QMailMessage noref; + noref.setHeaderField(QLatin1String("Message-ID"), id); + noref.setInReplyTo(id2); + + QMailMessage forward; + forward.setInResponseTo(noref); + QCOMPARE(forward.inReplyTo(), id); + QCOMPARE(forward.headerField(QLatin1String("References")).content(), + QString::fromLatin1("%1 %2").arg(id2).arg(id).toUtf8()); + +} + void tst_QMailMessage::serverUid() { // Tested by: setServerUid |