summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2010-10-22 10:53:01 (GMT)
committerKevin Smith <git@kismith.co.uk>2010-10-22 10:53:01 (GMT)
commit5b22db817bfc84db5ce1956ec1cb4a6d9f98e35b (patch)
treef3f8d8a30391471e2d5ac0f7e9103e7713aa2933 /Swiften/Chat/UnitTest
parent784e8b04bc510e18a75f8f696713366bc00f3cab (diff)
downloadswift-5b22db817bfc84db5ce1956ec1cb4a6d9f98e35b.zip
swift-5b22db817bfc84db5ce1956ec1cb4a6d9f98e35b.tar.bz2
Don't send composing events to offline users.
Resolves: #637
Diffstat (limited to 'Swiften/Chat/UnitTest')
-rw-r--r--Swiften/Chat/UnitTest/ChatStateNotifierTest.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/Swiften/Chat/UnitTest/ChatStateNotifierTest.cpp b/Swiften/Chat/UnitTest/ChatStateNotifierTest.cpp
index 2fa4c26..045a245 100644
--- a/Swiften/Chat/UnitTest/ChatStateNotifierTest.cpp
+++ b/Swiften/Chat/UnitTest/ChatStateNotifierTest.cpp
@@ -50,6 +50,7 @@ class ChatStateNotifierTest : public CppUnit::TestFixture {
CPPUNIT_TEST(testStartTypingReply_CapsIncluded);
CPPUNIT_TEST(testCancelledNewMessage);
CPPUNIT_TEST(testContinueTypingReply_CapsIncluded);
+ CPPUNIT_TEST(testTypeReplies_WentOffline);
CPPUNIT_TEST(testContactShouldReceiveStates_CapsOnly);
CPPUNIT_TEST(testContactShouldReceiveStates_CapsNorActive);
CPPUNIT_TEST(testContactShouldReceiveStates_ActiveOverrideOn);
@@ -63,6 +64,7 @@ private:
public:
void setUp() {
notifier_ = new ChatStateNotifier();
+ notifier_->setContactIsOnline(true);
monitor_ = new ChatStateMonitor(notifier_);
}
@@ -134,8 +136,21 @@ public:
notifier_->setUserIsTyping();
notifier_->setUserIsTyping();
CPPUNIT_ASSERT_EQUAL(1, monitor_->composingCallCount);
+ notifier_->userSentMessage();
+ notifier_->setUserIsTyping();
+ CPPUNIT_ASSERT_EQUAL(2, monitor_->composingCallCount);
+
}
+ void testTypeReplies_WentOffline() {
+ notifier_->setContactHas85Caps(true);
+ notifier_->setUserIsTyping();
+ CPPUNIT_ASSERT_EQUAL(1, monitor_->composingCallCount);
+ notifier_->setContactIsOnline(false);
+ notifier_->userSentMessage();
+ notifier_->setUserIsTyping();
+ CPPUNIT_ASSERT_EQUAL(1, monitor_->composingCallCount);
+ }
};