diff --git a/coreapi/friend.c b/coreapi/friend.c index 17ab1fda7..7bfe6b3b5 100644 --- a/coreapi/friend.c +++ b/coreapi/friend.c @@ -212,7 +212,7 @@ int linphone_friend_set_name(LinphoneFriend *lf, const char *name){ LinphoneAddress *fr = lf->uri; LinphoneVCard *vcard = NULL; - if (fr == NULL){ + if (fr == NULL) { ms_error("linphone_friend_set_address() must be called before linphone_friend_set_name()."); return -1; } diff --git a/tester/Makefile.am b/tester/Makefile.am index b330714eb..66e0acc0e 100644 --- a/tester/Makefile.am +++ b/tester/Makefile.am @@ -72,7 +72,7 @@ RCFILES = \ IMAGE_FILES = images/nowebcamCIF.jpg -COMMON_FILE = common/bc_completion +COMMON_FILE = common/bc_completion common/vcards.vcf EXTRA_DIST = tester_hosts\ messages.db\ diff --git a/tester/common/vcards.vcf b/tester/common/vcards.vcf new file mode 100644 index 000000000..7ffd718c6 --- /dev/null +++ b/tester/common/vcards.vcf @@ -0,0 +1,22 @@ +BEGIN:VCARD +VERSION:4.0 +KIND:individual +FN:Sylvain Berfini +N:Berfini;Sylvain;Pascal;; +GENDER:M +IMPP;PREF=1;TYPE=work:sip:sylvain@sip.linphone.org +END:VCARD +BEGIN:VCARD +VERSION:4.0 +KIND:individual +FN:François Grisez +N:Grisez;François;;; +IMPP;TYPE=work:sip:francois@sip.linphone.org +END:VCARD +BEGIN:VCARD +VERSION:4.0 +KIND:individual +FN:Margaux Clerc +GENDER:F +IMPP:sip:margaux@sip.linphone.org +END:VCARD diff --git a/tester/vcard_tester.c b/tester/vcard_tester.c index 21e38d2d3..992c03015 100644 --- a/tester/vcard_tester.c +++ b/tester/vcard_tester.c @@ -16,13 +16,36 @@ along with this program. If not, see . */ - #include "linphonecore.h" #include "private.h" #include "liblinphone_tester.h" -test_t vcard_tests[] = { +static void linphone_vcard_import_friends_test(void) { + LinphoneCoreManager* manager = linphone_core_manager_new2("empty_rc", FALSE); + 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")); + 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_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 }, }; test_suite_t vcard_test_suite = {