diff options
| author | Olivier Goffart <ogoffart@woboq.com> | 2012-07-03 11:17:27 +0200 |
|---|---|---|
| committer | Jeremy Lainé <jeremy.laine@m4x.org> | 2012-07-04 10:00:27 +0200 |
| commit | 0ae287b2c624df43b3744f79911d11baa0699c68 (patch) | |
| tree | 66424bce0a60d073ffe7f5591b2973a0f4e2388b /tests/tests.cpp | |
| parent | 2c54c28a78bde8bfa40652fe01bf810945bfc027 (diff) | |
| download | qxmpp-0ae287b2c624df43b3744f79911d11baa0699c68.tar.gz | |
Fix time computation in QXmppArchiveIq
In message archive, the secs attribute is the time ellapsed since the
last message, not the time passed since the beginning of the collection.
Quoting the XEP-0136 §4.6
The time in whole seconds of the message relative to the previous
message in the collection (or, for the first message, relative to the
start of the collection) SHOULD be specified with a 'secs' attribute.
(This behaviour was changed in the revision 0.7 of the JEP-0136)
Signed-off-by: Jeremy Lainé <jeremy.laine@m4x.org>
Diffstat (limited to 'tests/tests.cpp')
| -rw-r--r-- | tests/tests.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/tests.cpp b/tests/tests.cpp index 2bf32909..e1c66ed5 100644 --- a/tests/tests.cpp +++ b/tests/tests.cpp @@ -224,6 +224,7 @@ void TestPackets::testArchiveChat() ">" "<from secs=\"0\"><body>Art thou not Romeo, and a Montague?</body></from>" "<to secs=\"11\"><body>Neither, fair saint, if either thee dislike.</body></to>" + "<from secs=\"7\"><body>How cam'st thou hither, tell me, and wherefore?</body></from>" "</chat>" "</iq>"); @@ -232,13 +233,16 @@ void TestPackets::testArchiveChat() QCOMPARE(iq.type(), QXmppIq::Result); QCOMPARE(iq.id(), QLatin1String("chat_1")); QCOMPARE(iq.chat().with(), QLatin1String("juliet@capulet.com")); - QCOMPARE(iq.chat().messages().size(), 2); + QCOMPARE(iq.chat().messages().size(), 3); QCOMPARE(iq.chat().messages()[0].isReceived(), true); QCOMPARE(iq.chat().messages()[0].body(), QLatin1String("Art thou not Romeo, and a Montague?")); QCOMPARE(iq.chat().messages()[0].date(), QDateTime(QDate(1469, 7, 21), QTime(2, 56, 15), Qt::UTC)); QCOMPARE(iq.chat().messages()[1].isReceived(), false); QCOMPARE(iq.chat().messages()[1].date(), QDateTime(QDate(1469, 7, 21), QTime(2, 56, 26), Qt::UTC)); QCOMPARE(iq.chat().messages()[1].body(), QLatin1String("Neither, fair saint, if either thee dislike.")); + QCOMPARE(iq.chat().messages()[2].isReceived(), true); + QCOMPARE(iq.chat().messages()[2].date(), QDateTime(QDate(1469, 7, 21), QTime(2, 56, 33), Qt::UTC)); + QCOMPARE(iq.chat().messages()[2].body(), QLatin1String("How cam'st thou hither, tell me, and wherefore?")); serializePacket(iq, xml); } |
