From 4231f551d031bd82ce35fec63485882b31e2d1dc Mon Sep 17 00:00:00 2001 From: Linus Jahn Date: Sun, 30 Dec 2018 15:19:28 +0100 Subject: Implement XEP-0319: Last User Interaction in Presence --- tests/qxmpppresence/tst_qxmpppresence.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests') diff --git a/tests/qxmpppresence/tst_qxmpppresence.cpp b/tests/qxmpppresence/tst_qxmpppresence.cpp index 5283f8ed..69908cd7 100644 --- a/tests/qxmpppresence/tst_qxmpppresence.cpp +++ b/tests/qxmpppresence/tst_qxmpppresence.cpp @@ -22,6 +22,7 @@ * */ +#include #include #include "QXmppPresence.h" @@ -40,6 +41,7 @@ private slots: void testPresenceWithMucItem(); void testPresenceWithMucPassword(); void testPresenceWithMucSupport(); + void testPresenceWithLastUserInteraction(); }; void tst_QXmppPresence::testPresence_data() @@ -231,5 +233,26 @@ void tst_QXmppPresence::testPresenceWithMucSupport() serializePacket(presence, xml); } +void tst_QXmppPresence::testPresenceWithLastUserInteraction() +{ + const QByteArray xml( + "" + "" + ""); + + QXmppPresence presence; + parsePacket(presence, xml); + QVERIFY(!presence.lastUserInteraction().isNull()); + QVERIFY(presence.lastUserInteraction().isValid()); + QCOMPARE(presence.lastUserInteraction(), QDateTime(QDate(1969, 7, 21), + QTime(2, 56, 15), Qt::UTC)); + serializePacket(presence, xml); + + QDateTime another(QDate(2025, 2, 5), QTime(15, 32, 8), Qt::UTC); + presence.setLastUserInteraction(another); + QCOMPARE(presence.lastUserInteraction(), another); +} + QTEST_MAIN(tst_QXmppPresence) #include "tst_qxmpppresence.moc" -- cgit v1.2.3