aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/backend/ebook/tests/ebook
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/backend/ebook/tests/ebook')
-rw-r--r--addressbook/backend/ebook/tests/ebook/.cvsignore7
-rw-r--r--addressbook/backend/ebook/tests/ebook/Makefile.am12
-rw-r--r--addressbook/backend/ebook/tests/ebook/test-changes.c89
-rw-r--r--addressbook/backend/ebook/tests/ebook/test-date.c36
-rw-r--r--addressbook/backend/ebook/tests/ebook/test-ebook.c110
-rw-r--r--addressbook/backend/ebook/tests/ebook/test-photo.c59
-rw-r--r--addressbook/backend/ebook/tests/ebook/test-string.c27
7 files changed, 0 insertions, 340 deletions
diff --git a/addressbook/backend/ebook/tests/ebook/.cvsignore b/addressbook/backend/ebook/tests/ebook/.cvsignore
deleted file mode 100644
index 8dbec11b01..0000000000
--- a/addressbook/backend/ebook/tests/ebook/.cvsignore
+++ /dev/null
@@ -1,7 +0,0 @@
-Makefile
-Makefile.in
-test-date
-test-ebook
-test-changes
-test-photo
-test-string
diff --git a/addressbook/backend/ebook/tests/ebook/Makefile.am b/addressbook/backend/ebook/tests/ebook/Makefile.am
deleted file mode 100644
index 7147690482..0000000000
--- a/addressbook/backend/ebook/tests/ebook/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-
-TEST_LIBS=$(top_builddir)/addressbook/backend/ebook/libebook.la
-
-INCLUDES=-I$(srcdir)/../../.. @EVOLUTION_ADDRESSBOOK_CFLAGS@
-
-noinst_PROGRAMS= test-changes test-date test-ebook test-photo test-string
-
-test_date_LDFLAGS=$(TEST_LIBS)
-test_ebook_LDFLAGS=$(TEST_LIBS)
-test_changes_LDFLAGS=$(TEST_LIBS)
-test_photo_LDFLAGS=$(TEST_LIBS)
-test_string_LDFLAGS=$(TEST_LIBS)
diff --git a/addressbook/backend/ebook/tests/ebook/test-changes.c b/addressbook/backend/ebook/tests/ebook/test-changes.c
deleted file mode 100644
index f1e65adaa0..0000000000
--- a/addressbook/backend/ebook/tests/ebook/test-changes.c
+++ /dev/null
@@ -1,89 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-#include "ebook/e-book.h"
-#include <libgnome/gnome-init.h>
-#include <bonobo/bonobo-main.h>
-#include <stdlib.h>
-
-#define NEW_VCARD "BEGIN:VCARD\n\
-X-EVOLUTION-FILE-AS:Toshok, Chris\n\
-FN:Chris Toshok\n\
-EMAIL;INTERNET:toshok@ximian.com\n\
-ORG:Ximian, Inc.;\n\
-END:VCARD"
-
-static char file_template[]="file:///tmp/change-test-XXXXXX";
-
-int
-main (int argc, char **argv)
-{
- EBook *book;
- gboolean status;
- EContact *contact;
- GList *changes;
- GError *error = NULL;
- EBookChange *change;
-
- gnome_program_init("test-changes", "0.0", LIBGNOME_MODULE, argc, argv, NULL);
-
- if (bonobo_init (&argc, argv) == FALSE)
- g_error ("Could not initialize Bonobo");
-
- mktemp (file_template);
-
- /* create a temp addressbook in /tmp */
- book = e_book_new ();
-
- printf ("loading addressbook\n");
- if (!e_book_load_uri (book, file_template, FALSE, &error)) {
- printf ("failed to open addressbook: `%s': %s\n", file_template, error->message);
- exit(0);
- }
-
- /* get an initial change set */
- if (!e_book_get_changes (book, "changeidtest", &changes, &error)) {
- printf ("failed to get changes: %s\n", error->message);
- exit(0);
- }
-
- /* make a change to the book */
- contact = e_contact_new_from_vcard (NEW_VCARD);
- if (!e_book_add_contact (book, contact, &error)) {
- printf ("failed to add new contact: %s\n", error->message);
- exit(0);
- }
-
- /* get another change set */
- if (!e_book_get_changes (book, "changeidtest", &changes, &error)) {
- printf ("failed to get second set of changes: %s\n", error->message);
- exit(0);
- }
-
- /* make sure that 1 change has occurred */
- if (g_list_length (changes) != 1) {
- printf ("got back %d changes, was expecting 1\n", g_list_length (changes));
- exit(0);
- }
-
- change = changes->data;
- if (change->change_type != E_BOOK_CHANGE_CARD_ADDED) {
- printf ("was expecting a CARD_ADDED change, but didn't get it.\n");
- exit(0);
- }
-
- printf ("got changed vcard back: %s\n", e_contact_get_const (change->contact, E_CONTACT_UID));
-
- e_book_free_change_list (changes);
-
-
- if (!e_book_remove (book, &error)) {
- printf ("failed to remove book; %s\n", error->message);
- exit(0);
- }
-
- g_object_unref (book);
-
- bonobo_main_quit();
-
- return 0;
-}
diff --git a/addressbook/backend/ebook/tests/ebook/test-date.c b/addressbook/backend/ebook/tests/ebook/test-date.c
deleted file mode 100644
index afe37cf224..0000000000
--- a/addressbook/backend/ebook/tests/ebook/test-date.c
+++ /dev/null
@@ -1,36 +0,0 @@
-
-#include "ebook/e-book.h"
-#include <libgnome/gnome-init.h>
-#include <bonobo/bonobo-main.h>
-#include <stdlib.h>
-
-int
-main (int argc, char **argv)
-{
- EContact *contact;
- EContactDate date, *dp;
-
- gnome_program_init("test-string", "0.0", LIBGNOME_MODULE, argc, argv, NULL);
-
- if (bonobo_init (&argc, argv) == FALSE)
- g_error ("Could not initialize Bonobo");
-
- contact = e_contact_new ();
-
- date.year = 1999;
- date.month = 3;
- date.day = 3;
-
- e_contact_set (contact, E_CONTACT_BIRTH_DATE, &date);
-
- printf ("vcard = \n%s\n", e_vcard_to_string (E_VCARD (contact), EVC_FORMAT_VCARD_30));
-
- dp = e_contact_get (contact, E_CONTACT_BIRTH_DATE);
-
- if (dp->year != date.year
- || dp->month != date.month
- || dp->day != date.day)
- printf ("failed\n");
- else
- printf ("passed\n");
-}
diff --git a/addressbook/backend/ebook/tests/ebook/test-ebook.c b/addressbook/backend/ebook/tests/ebook/test-ebook.c
deleted file mode 100644
index d78d9f3b6a..0000000000
--- a/addressbook/backend/ebook/tests/ebook/test-ebook.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-
-#include "ebook/e-book.h"
-#include <libgnome/gnome-init.h>
-#include <bonobo/bonobo-main.h>
-#include <stdlib.h>
-
-static void
-print_email (EContact *contact)
-{
- char *file_as = e_contact_get (contact, E_CONTACT_FILE_AS);
- GList *emails, *e;
-
- printf ("Contact: %s\n", file_as);
- printf ("Email addresses:\n");
- emails = e_contact_get (contact, E_CONTACT_EMAIL);
- for (e = emails; e; e = e->next) {
- EVCardAttribute *attr = e->data;
- GList *values = e_vcard_attribute_get_values (attr);
- printf ("\t%s\n", values && values->data ? (char*)values->data : "");
- e_vcard_attribute_free (attr);
- }
- g_list_free (emails);
-
- g_free (file_as);
-
- printf ("\n");
-}
-
-static void
-print_all_emails (EBook *book)
-{
- EBookQuery *query;
- gboolean status;
- GList *cards, *c;
-
- query = e_book_query_field_exists (E_CONTACT_FULL_NAME);
-
- status = e_book_get_contacts (book, query, &cards, NULL);
-
- e_book_query_unref (query);
-
- if (status == FALSE) {
- printf ("error %d getting card list\n", status);
- exit(0);
- }
-
- for (c = cards; c; c = c->next) {
- EContact *contact = E_CONTACT (c->data);
-
- print_email (contact);
-
- g_object_unref (contact);
- }
- g_list_free (cards);
-}
-
-static void
-print_one_email (EBook *book)
-{
- EContact *contact;
- GError *error = NULL;
-
- if (!e_book_get_contact (book, "pas-id-0002023", &contact, &error)) {
- printf ("error %d getting card: %s\n", error->code, error->message);
- g_clear_error (&error);
- return;
- }
-
- print_email (contact);
-
- g_object_unref (contact);
-}
-
-int
-main (int argc, char **argv)
-{
- EBook *book;
- gboolean status;
-
- gnome_program_init("test-ebook", "0.0", LIBGNOME_MODULE, argc, argv, NULL);
-
- if (bonobo_init (&argc, argv) == FALSE)
- g_error ("Could not initialize Bonobo");
-
- /*
- ** the actual ebook foo
- */
-
- book = e_book_new ();
-
- printf ("loading addressbook\n");
- status = e_book_load_local_addressbook (book, NULL);
- if (status == FALSE) {
- printf ("failed to open local addressbook\n");
- exit(0);
- }
-
- printf ("printing one contact\n");
- print_one_email (book);
-
- printf ("printing all contacts\n");
- print_all_emails (book);
-
- g_object_unref (book);
-
- bonobo_main_quit();
-
- return 0;
-}
diff --git a/addressbook/backend/ebook/tests/ebook/test-photo.c b/addressbook/backend/ebook/tests/ebook/test-photo.c
deleted file mode 100644
index cbd6817b37..0000000000
--- a/addressbook/backend/ebook/tests/ebook/test-photo.c
+++ /dev/null
@@ -1,59 +0,0 @@
-
-#include "ebook/e-book.h"
-#include <libgnome/gnome-init.h>
-#include <bonobo/bonobo-main.h>
-#include <stdlib.h>
-
-const char *photo_data = "/9j/4AAQSkZJRgABAQEARwBHAAD//gAXQ3JlYXRlZCB3aXRo\
-IFRoZSBHSU1Q/9sAQwAIBgYHBgUIBwcHCQkICgwUDQwLCwwZEhMPFB0aHx4dGhwcICQuJyAiLC\
-McHCg3KSwwMTQ0NB8nOT04MjwuMzQy/9sAQwEJCQkMCwwYDQ0YMiEcITIyMjIyMjIyMjIyMjIy\
-MjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy/8AAEQgAMgAyAwEiAAIRAQMRAf\
-/EABsAAQACAwEBAAAAAAAAAAAAAAAHCAQFBgID/8QAMBAAAgEDAQYEBQQDAAAAAAAAAQIDAAQR\
-BQYSEyExQQdhcYEiI0JRkRQVMqFiguH/xAAaAQADAQEBAQAAAAAAAAAAAAAABAUCBgED/8QAIx\
-EAAgICAQQCAwAAAAAAAAAAAAECAwQRQRITITEUYQUiUf/aAAwDAQACEQMRAD8An+sHUtWtNKjV\
-rmQ7754cajLvjrgfbzPIdzWdVfds9pJb3XdQkMrcFZGj+HqY0bdVV9Tz/wBia+N9vbjvkaxMb5\
-E9N6SJB1HxLEEjJaWsUjD6QzSMPXdGB7E1zV74t63HINy1s4F7CWCTn77wrA0TY86jY3N1qsUk\
-6wxBxBDvYjLHkoUH4j3JP/a0V3s1CvF/QM9tKpw0THeU+TLkj8VLnmzT8y0n9FujBx5bioba/r\
-ZLWx3iPZ7RzLp95GtnqRGVTezHNjruH7/4n+67iqpq7Qi3uYWMMsNynfnE6sM8/Lr6VamFi0KM\
-epUE1Sx7XZHbI+fjxos1H0z3SlKYEjzISI2I64OKqsyu8sck2QYrmPjBvpIYg598Vauoh8VtlY\
-7JW2isoBwpPl6hGByZTyD+o6E+h7UtlVOcPHA/+PyI1Wal6Zp7vaC/06wnTTLtEeUDiKwzu4H8\
-vI9AM9Tiuctkng1Nnk1G5cOoYifB4nI/jB7VjWuoT21qPmwXUCHKlphHKvqG5N6g0/cLi/Rg88\
-FhbkbxlaUSu3kqpnn6kDzqGqbNdPB0XyK4/svZr9RVntL50GePdcKEDqzhVBx7sKtPpayppNos\
-xzKIlDHzxUFeG2zo2n2kivWhK6PpHwwoTnfk65J7kZyT9z5VYADAwKuYtfRA5zPv7tnjgUpSmR\
-EV8bq1hvbWW1uY1khlUo6MMhgeor7UoAje18FtmLe9eeQT3EXPcglkJRPbv71EWu7Dajp2o3MG\
-mlRCkjKQ30jPUe1WlrlNW0RptTleNB84DnjkD0P9VlxT4Nqck9pmn8JuFp2zo0cgCWFi2e7555\
-/NSHXLadso2m3sU0NxlV65HM+VdTW3rgwvsUpSvAFKUoAUxSlAClKUAKUpQB//2Q==";
-
-
-int
-main (int argc, char **argv)
-{
- EContact *contact;
- EContactPhoto *photo, *new_photo;
-
- gnome_program_init("test-photo", "0.0", LIBGNOME_MODULE, argc, argv, NULL);
-
- if (bonobo_init (&argc, argv) == FALSE)
- g_error ("Could not initialize Bonobo");
-
- contact = e_contact_new ();
-
- photo = g_new (EContactPhoto, 1);
- photo->data = g_strdup (photo_data);
- photo->length = _evc_base64_decode_simple (photo->data, strlen (photo_data));
-
- /* set the photo */
- e_contact_set (contact, E_CONTACT_PHOTO, photo);
-
- /* then get the photo */
- new_photo = e_contact_get (contact, E_CONTACT_PHOTO);
-
- /* and compare */
- if (new_photo->length != photo->length)
- g_error ("photo lengths differ");
-
- if (memcmp (new_photo->data, photo->data, photo->length))
- g_error ("photo data differs");
-
- printf ("photo test passed\n");
-}
diff --git a/addressbook/backend/ebook/tests/ebook/test-string.c b/addressbook/backend/ebook/tests/ebook/test-string.c
deleted file mode 100644
index b7cdbb3720..0000000000
--- a/addressbook/backend/ebook/tests/ebook/test-string.c
+++ /dev/null
@@ -1,27 +0,0 @@
-
-#include "ebook/e-book.h"
-#include <libgnome/gnome-init.h>
-#include <bonobo/bonobo-main.h>
-#include <stdlib.h>
-
-#define TEST_ID "test-uid"
-
-int
-main (int argc, char **argv)
-{
- EContact *contact;
-
- gnome_program_init("test-string", "0.0", LIBGNOME_MODULE, argc, argv, NULL);
-
- if (bonobo_init (&argc, argv) == FALSE)
- g_error ("Could not initialize Bonobo");
-
- contact = e_contact_new ();
-
- e_contact_set (contact, E_CONTACT_UID, TEST_ID);
-
- if (!strcmp (e_contact_get_const (contact, E_CONTACT_UID), TEST_ID))
- printf ("passed\n");
- else
- printf ("failed\n");
-}