diff options
author | irungentoo <irungentoo@gmail.com> | 2014-12-11 20:10:57 -0500 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2014-12-11 20:10:57 -0500 |
commit | 36851e7b3843de1b9ce260c02a9da6b685338df6 (patch) | |
tree | 648653e261126cd4f67c2c3ca3ee4fb390f68f44 /auto_tests | |
parent | d7f57132772e69c2f9f3596c6525d9d37393f9be (diff) |
Test if everything goes well when a peer leaves the group chat.
Diffstat (limited to 'auto_tests')
-rw-r--r-- | auto_tests/tox_test.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/auto_tests/tox_test.c b/auto_tests/tox_test.c index 6f6d8617..be5cce8a 100644 --- a/auto_tests/tox_test.c +++ b/auto_tests/tox_test.c | |||
@@ -480,6 +480,9 @@ void print_group_invite_callback(Tox *tox, int32_t friendnumber, uint8_t type, c | |||
480 | if (*((uint32_t *)userdata) != 234212) | 480 | if (*((uint32_t *)userdata) != 234212) |
481 | return; | 481 | return; |
482 | 482 | ||
483 | if (type != TOX_GROUPCHAT_TYPE_TEXT) | ||
484 | return; | ||
485 | |||
483 | int g_num; | 486 | int g_num; |
484 | 487 | ||
485 | if ((g_num = tox_join_groupchat(tox, friendnumber, data, length)) == -1) | 488 | if ((g_num = tox_join_groupchat(tox, friendnumber, data, length)) == -1) |
@@ -596,6 +599,24 @@ START_TEST(test_many_group) | |||
596 | } | 599 | } |
597 | 600 | ||
598 | ck_assert_msg(num_recv == NUM_GROUP_TOX, "Failed to recv group messages."); | 601 | ck_assert_msg(num_recv == NUM_GROUP_TOX, "Failed to recv group messages."); |
602 | tox_del_groupchat(toxes[NUM_GROUP_TOX - 1], 0); | ||
603 | |||
604 | for (j = 0; j < 10; ++j) { | ||
605 | for (i = 0; i < NUM_GROUP_TOX; ++i) { | ||
606 | tox_do(toxes[i]); | ||
607 | } | ||
608 | |||
609 | c_sleep(50); | ||
610 | } | ||
611 | |||
612 | for (i = 0; i < (NUM_GROUP_TOX - 1); ++i) { | ||
613 | ck_assert_msg(tox_group_number_peers(toxes[i], 0) == (NUM_GROUP_TOX - 1), "Bad number of group peers."); | ||
614 | } | ||
615 | |||
616 | for (i = 0; i < NUM_GROUP_TOX; ++i) { | ||
617 | tox_kill(toxes[i]); | ||
618 | } | ||
619 | |||
599 | printf("test_many_group succeeded, took %llu seconds\n", time(NULL) - cur_time); | 620 | printf("test_many_group succeeded, took %llu seconds\n", time(NULL) - cur_time); |
600 | } | 621 | } |
601 | END_TEST | 622 | END_TEST |