about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-12-20 03:11:02 +0000
committerJames Booth <boothj5@gmail.com>2015-12-20 03:11:02 +0000
commit94169705b5467db3cdf0ab52732be0ef27c9a919 (patch)
tree263bffcc3a9f1c2e6148c412ac83a8b28a994370
parent9f34373b46fa2d8be6fd2f24a423a15351cd1e33 (diff)
downloadprofani-tty-94169705b5467db3cdf0ab52732be0ef27c9a919.tar.gz
Added functional test for muc console message
-rw-r--r--tests/functionaltests/functionaltests.c2
-rw-r--r--tests/functionaltests/test_muc.c30
-rw-r--r--tests/functionaltests/test_muc.h1
3 files changed, 32 insertions, 1 deletions
diff --git a/tests/functionaltests/functionaltests.c b/tests/functionaltests/functionaltests.c
index b5dfa3ae..3f79ccc8 100644
--- a/tests/functionaltests/functionaltests.c
+++ b/tests/functionaltests/functionaltests.c
@@ -94,7 +94,7 @@ int main(int argc, char* argv[]) {
         PROF_FUNC_TEST(shows_history_message),
         PROF_FUNC_TEST(shows_occupant_join),
         PROF_FUNC_TEST(shows_message),
-
+        PROF_FUNC_TEST(shows_message_in_console_when_window_not_focussed),
     };
 
     return run_tests(all_tests);
diff --git a/tests/functionaltests/test_muc.c b/tests/functionaltests/test_muc.c
index 5911209e..47cbd84e 100644
--- a/tests/functionaltests/test_muc.c
+++ b/tests/functionaltests/test_muc.c
@@ -222,3 +222,33 @@ shows_message(void **state)
 
     assert_true(prof_output_regex("testoccupant: .+a new message"));
 }
+
+void
+shows_message_in_console_when_window_not_focussed(void **state)
+{
+    prof_connect();
+
+    stbbr_for_id("prof_join_2",
+        "<presence id=\"prof_join_2\" lang=\"en\" to=\"stabber@localhost/profanity\" from=\"testroom@conference.localhost/stabber\">"
+            "<c hash=\"sha-1\" xmlns=\"http://jabber.org/protocol/caps\" node=\"http://www.profanity.im\" ver=\"*\"/>"
+            "<x xmlns=\"http://jabber.org/protocol/muc#user\">"
+                "<item role=\"participant\" jid=\"stabber@localhost/profanity\" affiliation=\"none\"/>"
+            "</x>"
+            "<status code=\"110\"/>"
+        "</presence>"
+    );
+
+    prof_input("/join testroom@conference.localhost");
+    assert_true(prof_output_exact("-> You have joined the room as stabber, role: participant, affiliation: none"));
+
+    prof_input("/win 1");
+    prof_output_exact("Profanity. Type /help for help informatiosn.");
+
+    stbbr_send(
+        "<message type=\"groupchat\" to=\"stabber@localhost/profanity\" from=\"testroom@conference.localhost/testoccupant\">"
+            "<body>a new message</body>"
+        "</message>"
+    );
+
+    assert_true(prof_output_exact("<< incoming from testoccupant in testroom@conference.localhost (win 2)"));
+}
diff --git a/tests/functionaltests/test_muc.h b/tests/functionaltests/test_muc.h
index 5b7690cb..5293e50c 100644
--- a/tests/functionaltests/test_muc.h
+++ b/tests/functionaltests/test_muc.h
@@ -8,3 +8,4 @@ void shows_subject_on_join(void **state);
 void shows_history_message(void **state);
 void shows_occupant_join(void **state);
 void shows_message(void **state);
+void shows_message_in_console_when_window_not_focussed(void **state);