diff options
Diffstat (limited to 'auto_tests/self_conference_title_change_test.c')
-rw-r--r-- | auto_tests/self_conference_title_change_test.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/auto_tests/self_conference_title_change_test.c b/auto_tests/self_conference_title_change_test.c index f0896101..a91aa0b4 100644 --- a/auto_tests/self_conference_title_change_test.c +++ b/auto_tests/self_conference_title_change_test.c | |||
@@ -21,6 +21,7 @@ | |||
21 | * along with Tox. If not, see <http://www.gnu.org/licenses/>. | 21 | * along with Tox. If not, see <http://www.gnu.org/licenses/>. |
22 | * | 22 | * |
23 | */ | 23 | */ |
24 | #define _XOPEN_SOURCE 500 | ||
24 | 25 | ||
25 | #include <stdio.h> | 26 | #include <stdio.h> |
26 | #include <stdlib.h> | 27 | #include <stdlib.h> |
@@ -30,6 +31,8 @@ | |||
30 | #include "../toxcore/tox.h" | 31 | #include "../toxcore/tox.h" |
31 | #include "../toxencryptsave/toxencryptsave.h" | 32 | #include "../toxencryptsave/toxencryptsave.h" |
32 | 33 | ||
34 | #include "helpers.h" | ||
35 | |||
33 | static const char *newtitle = "kitten over darknet"; | 36 | static const char *newtitle = "kitten over darknet"; |
34 | 37 | ||
35 | static void cbtitlechange(Tox *tox, uint32_t conference_number, uint32_t peer_number, const uint8_t *title, | 38 | static void cbtitlechange(Tox *tox, uint32_t conference_number, uint32_t peer_number, const uint8_t *title, |
@@ -44,7 +47,6 @@ static void cbtitlechange(Tox *tox, uint32_t conference_number, uint32_t peer_nu | |||
44 | int main(void) | 47 | int main(void) |
45 | { | 48 | { |
46 | uint32_t conference_number; | 49 | uint32_t conference_number; |
47 | struct timespec sleeptime; | ||
48 | struct Tox_Options to; | 50 | struct Tox_Options to; |
49 | Tox *t; | 51 | Tox *t; |
50 | TOX_ERR_CONFERENCE_NEW conference_err; | 52 | TOX_ERR_CONFERENCE_NEW conference_err; |
@@ -62,11 +64,7 @@ int main(void) | |||
62 | } | 64 | } |
63 | 65 | ||
64 | tox_iterate(t, NULL); | 66 | tox_iterate(t, NULL); |
65 | 67 | c_sleep(tox_iteration_interval(t)); | |
66 | sleeptime.tv_sec = 0; | ||
67 | sleeptime.tv_nsec = tox_iteration_interval(t) * 1E6; | ||
68 | |||
69 | nanosleep(&sleeptime, NULL); | ||
70 | 68 | ||
71 | if (!tox_conference_set_title(t, conference_number, (const uint8_t *)newtitle, strlen(newtitle), &title_err)) { | 69 | if (!tox_conference_set_title(t, conference_number, (const uint8_t *)newtitle, strlen(newtitle), &title_err)) { |
72 | tox_kill(t); | 70 | tox_kill(t); |
@@ -75,7 +73,7 @@ int main(void) | |||
75 | } | 73 | } |
76 | 74 | ||
77 | tox_iterate(t, NULL); | 75 | tox_iterate(t, NULL); |
78 | nanosleep(&sleeptime, NULL); | 76 | c_sleep(tox_iteration_interval(t)); |
79 | tox_iterate(t, NULL); | 77 | tox_iterate(t, NULL); |
80 | 78 | ||
81 | fprintf(stderr, "error: title was not changed in callback. exiting.\n"); | 79 | fprintf(stderr, "error: title was not changed in callback. exiting.\n"); |