Added import friends from vcards test

This commit is contained in:
Sylvain Berfini 2015-12-16 11:54:34 +01:00
parent 698c3e55cd
commit 8c823fc039
4 changed files with 49 additions and 4 deletions

View file

@ -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;
}

View file

@ -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\

22
tester/common/vcards.vcf Normal file
View file

@ -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

View file

@ -16,13 +16,36 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#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 = {