about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-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);