diff options
-rw-r--r-- | addressbook/ChangeLog | 8 | ||||
-rw-r--r-- | addressbook/tests/ebook/Makefile.am | 3 | ||||
-rw-r--r-- | addressbook/tests/ebook/test-untyped-phones.c | 46 |
3 files changed, 56 insertions, 1 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 2bf1e2724..d6767bd14 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,5 +1,13 @@ 2004-01-26 Chris Toshok <toshok@ximian.com> + * tests/ebook/Makefile.am (noinst_PROGRAMS): add + test-untyped-phones. + (test_untyped_phones_LDADD): new variable. + + * tests/ebook/test-untyped-phones.c: new test for 40013. + +2004-01-26 Chris Toshok <toshok@ximian.com> + [ fixes bug #53228 ] * tests/ebook/test-categories.c: new test. diff --git a/addressbook/tests/ebook/Makefile.am b/addressbook/tests/ebook/Makefile.am index 6ce5e2333..d85ea4df0 100644 --- a/addressbook/tests/ebook/Makefile.am +++ b/addressbook/tests/ebook/Makefile.am @@ -6,7 +6,7 @@ TEST_LIBS= \ $(top_builddir)/addressbook/libebook/libebook.la\ $(EVOLUTION_ADDRESSBOOK_LIBS) -noinst_PROGRAMS= test-changes test-categories test-date test-ebook test-ebook-view test-photo test-self test-string test-undefinedfield +noinst_PROGRAMS= test-changes test-categories test-date test-ebook test-ebook-view test-photo test-self test-string test-undefinedfield test-untyped-phones test_date_LDADD=$(TEST_LIBS) test_ebook_LDADD=$(TEST_LIBS) @@ -17,3 +17,4 @@ test_photo_LDADD=$(TEST_LIBS) test_self_LDADD=$(TEST_LIBS) test_string_LDADD=$(TEST_LIBS) test_undefinedfield_LDADD=$(TEST_LIBS) +test_untyped_phones_LDADD=$(TEST_LIBS) diff --git a/addressbook/tests/ebook/test-untyped-phones.c b/addressbook/tests/ebook/test-untyped-phones.c new file mode 100644 index 000000000..56f385f42 --- /dev/null +++ b/addressbook/tests/ebook/test-untyped-phones.c @@ -0,0 +1,46 @@ + +#include <libgnome/gnome-init.h> +#include <bonobo/bonobo-main.h> +#include <stdlib.h> +#include <string.h> +#include <libebook/e-book.h> + +/* TEL;WORK:... should map to PHONE_BUSINESS + TEL;FAX:... should map to OTHER_FAX. */ +#define VCARD \ +"BEGIN:vCard\r\n\ +VERSION:3.0\r\n\ +X-EVOLUTION-FILE-AS:test\\, 40013\r\n\ +FN:40013 test\r\n\ +N:40013;test;;;\r\n\ +TEL;WORK:123-123-1234\r\n\ +TEL;FAX:321-321-4321\r\n\ +END:vCard" + +static void +check(gboolean test, char *msg) +{ + printf ("%s - %s\n", test ? "passed" : "failed", msg); +} + +int +main (int argc, char **argv) +{ + EContact *contact; + const char *phone; + + gnome_program_init("test-untyped-phones", "0.0", LIBGNOME_MODULE, argc, argv, NULL); + + if (bonobo_init (&argc, argv) == FALSE) + g_error ("Could not initialize Bonobo"); + + contact = e_contact_new_from_vcard (VCARD); + + phone = e_contact_get_const (contact, E_CONTACT_PHONE_BUSINESS); + check (phone && !strcmp ("123-123-1234", phone), "business phone"); + + phone = e_contact_get_const (contact, E_CONTACT_PHONE_OTHER_FAX); + check (phone && !strcmp ("321-321-4321", phone), "other fax"); + + return 0; +} |