From 0ae287b2c624df43b3744f79911d11baa0699c68 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 3 Jul 2012 11:17:27 +0200 Subject: Fix time computation in QXmppArchiveIq MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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é --- tests/tests.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tests/tests.cpp') 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() ">" "Art thou not Romeo, and a Montague?" "Neither, fair saint, if either thee dislike." + "How cam'st thou hither, tell me, and wherefore?" "" ""); @@ -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); } -- cgit v1.2.3