mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-18 11:38:08 +00:00
Improved import/export test
This commit is contained in:
parent
8c823fc039
commit
45ff930190
1 changed files with 21 additions and 13 deletions
|
|
@ -20,32 +20,40 @@
|
|||
#include "private.h"
|
||||
#include "liblinphone_tester.h"
|
||||
|
||||
static void linphone_vcard_import_friends_test(void) {
|
||||
static char *create_filepath(const char *dir, const char *filename, const char *ext) {
|
||||
return ms_strdup_printf("%s/%s.%s", dir, filename, ext);
|
||||
}
|
||||
|
||||
static void linphone_vcard_import_export_friends_test(void) {
|
||||
LinphoneCoreManager* manager = linphone_core_manager_new2("empty_rc", FALSE);
|
||||
char *import_filepath = bc_tester_res("common/vcards.vcf");
|
||||
char *export_filepath = create_filepath(bc_tester_get_writable_dir_prefix(), "export_vcards", "vcf");
|
||||
const MSList *friends = linphone_core_get_friend_list(manager->lc);
|
||||
int count = 0;
|
||||
BC_ASSERT_EQUAL(ms_list_size(friends), 0, int, "%d");
|
||||
|
||||
count = linphone_core_import_friends_from_vcard4_file(manager->lc, bc_tester_res("common/vcards.vcf"));
|
||||
count = linphone_core_import_friends_from_vcard4_file(manager->lc, import_filepath);
|
||||
BC_ASSERT_EQUAL(count, 3, int, "%d");
|
||||
friends = linphone_core_get_friend_list(manager->lc);
|
||||
BC_ASSERT_EQUAL(ms_list_size(friends), 3, int, "%d");
|
||||
|
||||
linphone_core_export_friends_as_vcard4_file(manager->lc, export_filepath);
|
||||
|
||||
manager->lc->friends = ms_list_free(manager->lc->friends);
|
||||
friends = linphone_core_get_friend_list(manager->lc);
|
||||
BC_ASSERT_EQUAL(ms_list_size(friends), 0, int, "%d");
|
||||
|
||||
count = linphone_core_import_friends_from_vcard4_file(manager->lc, export_filepath);
|
||||
BC_ASSERT_EQUAL(count, 3, int, "%d");
|
||||
friends = linphone_core_get_friend_list(manager->lc);
|
||||
BC_ASSERT_EQUAL(ms_list_size(friends), 3, int, "%d");
|
||||
|
||||
remove(export_filepath);
|
||||
linphone_core_manager_destroy(manager);
|
||||
}
|
||||
|
||||
static void linphone_vcard_export_friends_test(void) {
|
||||
|
||||
}
|
||||
|
||||
static void linphone_vcard_create_edit_friends_test(void) {
|
||||
|
||||
}
|
||||
|
||||
test_t vcard_tests[] = {
|
||||
{ "Import friends from vCards", linphone_vcard_import_friends_test },
|
||||
{ "Export friends to vCards", linphone_vcard_export_friends_test },
|
||||
{ "Create and edit friends' vCards", linphone_vcard_create_edit_friends_test },
|
||||
{ "Import / Export friends from vCards", linphone_vcard_import_export_friends_test },
|
||||
};
|
||||
|
||||
test_suite_t vcard_test_suite = {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue