Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,19 @@ function(auto_test target)
endif()
endfunction()

function(auto_test_cc target)
if(AUTOTEST AND NOT (MSVC AND ARGV1 STREQUAL "MSVC_DONT_BUILD"))
add_executable(auto_${target}_test ${CPUFEATURES}
auto_tests/${target}_test.cc)
target_link_modules(auto_${target}_test toxcore misc_tools)
if(NOT ARGV1 STREQUAL "DONT_RUN")
add_test(NAME ${target} COMMAND ${CROSSCOMPILING_EMULATOR} auto_${target}_test)
set_tests_properties(${target} PROPERTIES TIMEOUT "${TEST_TIMEOUT_SECONDS}")
set_property(TEST ${target} PROPERTY ENVIRONMENT "LLVM_PROFILE_FILE=${target}.profraw")
endif()
endif()
endfunction()

auto_test(TCP)
auto_test(conference)
auto_test(conference_double_invite)
Expand Down Expand Up @@ -454,6 +467,7 @@ if(BUILD_TOXAV)
auto_test(conference_av)
auto_test(toxav_basic)
auto_test(toxav_many)
auto_test_cc(toxav_mt)
endif()

################################################################################
Expand Down
16 changes: 10 additions & 6 deletions auto_tests/toxav_basic_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ static void iterate_tox(Tox *bootstrap, Tox *Alice, Tox *Bob)
tox_iterate(Bob, nullptr);
}

static bool toxav_audio_send_frame_helper(ToxAV *av, uint32_t friend_number, Toxav_Err_Send_Frame *error)
{
const static int16_t PCM[960] = {0};
return toxav_audio_send_frame(av, 0, PCM, sizeof(PCM), 1, 48000, nullptr);
}

static void regular_call_flow(
Tox *Alice, Tox *Bob, Tox *bootstrap,
ToxAV *AliceAV, ToxAV *BobAV,
Expand Down Expand Up @@ -516,17 +522,15 @@ static void test_av_flows(void)
}
}

int16_t PCM[5670];

iterate_tox(bootstrap, Alice, Bob);
ck_assert_call_control(AliceAV, 0, TOXAV_CALL_CONTROL_PAUSE);
iterate_tox(bootstrap, Alice, Bob);
ck_assert(!toxav_audio_send_frame(AliceAV, 0, PCM, 960, 1, 48000, nullptr));
ck_assert(!toxav_audio_send_frame(BobAV, 0, PCM, 960, 1, 48000, nullptr));
ck_assert(!toxav_audio_send_frame_helper(AliceAV, 0, nullptr));
ck_assert(!toxav_audio_send_frame_helper(BobAV, 0, nullptr));
ck_assert_call_control(AliceAV, 0, TOXAV_CALL_CONTROL_RESUME);
iterate_tox(bootstrap, Alice, Bob);
ck_assert(toxav_audio_send_frame(AliceAV, 0, PCM, 960, 1, 48000, nullptr));
ck_assert(toxav_audio_send_frame(BobAV, 0, PCM, 960, 1, 48000, nullptr));
ck_assert(toxav_audio_send_frame_helper(AliceAV, 0, nullptr));
ck_assert(toxav_audio_send_frame_helper(BobAV, 0, nullptr));
iterate_tox(bootstrap, Alice, Bob);

{
Expand Down
Loading