summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Reitter <treitter@gmail.com>2009-12-17 09:26:00 -0800
committerTravis Reitter <treitter@gmail.com>2010-01-15 13:29:59 -0800
commit5361c1d2f16c180c86463d0d5c7f7ae3e5a5dc32 (patch)
tree0b4f205b739d9688473ee4295934fb5de446b146
parentdc754c4b66d8eaf66686736eb5360fd8a838ed98 (diff)
downloadevolution-data-server-5361c1d2f16c180c86463d0d5c7f7ae3e5a5dc32.tar.gz
Add test for EDataCal method 'getCalAddress'.
-rw-r--r--calendar/tests/ecal/Makefile.am5
-rw-r--r--calendar/tests/ecal/ecal-test-utils.c15
-rw-r--r--calendar/tests/ecal/ecal-test-utils.h3
-rw-r--r--calendar/tests/ecal/test-ecal-get-cal-address.c28
4 files changed, 51 insertions, 0 deletions
diff --git a/calendar/tests/ecal/Makefile.am b/calendar/tests/ecal/Makefile.am
index 8d87c49e9..f8375676b 100644
--- a/calendar/tests/ecal/Makefile.am
+++ b/calendar/tests/ecal/Makefile.am
@@ -30,9 +30,11 @@ test_scripts = \
test-runner.sh \
cleanup.sh
+# ordered by relative complexity
TESTS = \
test-ecal-remove \
test-ecal-open \
+ test-ecal-get-cal-address \
$(NULL)
# The test program
@@ -42,6 +44,9 @@ TEST_ECAL_CPPFLAGS= \
$(libecal_test_utils_la_CPPFLAGS) \
$(NULL)
+# ordered alphanumerically
+test_ecal_get_cal_address_LDADD=$(TEST_ECAL_LIBS)
+test_ecal_get_cal_address_CPPFLAGS=$(TEST_ECAL_CPPFLAGS)
test_ecal_open_LDADD=$(TEST_ECAL_LIBS)
test_ecal_open_CPPFLAGS=$(TEST_ECAL_CPPFLAGS)
test_ecal_remove_LDADD=$(TEST_ECAL_LIBS)
diff --git a/calendar/tests/ecal/ecal-test-utils.c b/calendar/tests/ecal/ecal-test-utils.c
index 185e71f6c..142dd4be9 100644
--- a/calendar/tests/ecal/ecal-test-utils.c
+++ b/calendar/tests/ecal/ecal-test-utils.c
@@ -141,3 +141,18 @@ ecal_test_utils_cal_remove (ECal *cal)
g_object_unref (cal);
}
+
+char*
+ecal_test_utils_cal_get_cal_address (ECal *cal)
+{
+ GError *error = NULL;
+ char *address = NULL;
+
+ if (!e_cal_get_cal_address (cal, &address, &error)) {
+ g_warning ("failed to get calendar address; %s\n", error->message);
+ exit(1);
+ }
+ g_print ("successfully got the calendar address\n");
+
+ return address;
+}
diff --git a/calendar/tests/ecal/ecal-test-utils.h b/calendar/tests/ecal/ecal-test-utils.h
index ed5104291..e4ffc40c2 100644
--- a/calendar/tests/ecal/ecal-test-utils.h
+++ b/calendar/tests/ecal/ecal-test-utils.h
@@ -47,4 +47,7 @@ ecal_test_utils_cal_async_open (ECal *cal,
void
ecal_test_utils_cal_remove (ECal *cal);
+char*
+ecal_test_utils_cal_get_cal_address (ECal *cal);
+
#endif /* _ECAL_TEST_UTILS_H */
diff --git a/calendar/tests/ecal/test-ecal-get-cal-address.c b/calendar/tests/ecal/test-ecal-get-cal-address.c
new file mode 100644
index 000000000..b015d398f
--- /dev/null
+++ b/calendar/tests/ecal/test-ecal-get-cal-address.c
@@ -0,0 +1,28 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <stdlib.h>
+#include <libecal/e-cal.h>
+
+#include "ecal-test-utils.h"
+
+gint
+main (gint argc, gchar **argv)
+{
+ ECal *cal;
+ char *uri = NULL;
+ char *address;
+
+ g_type_init ();
+
+ cal = ecal_test_utils_cal_new_temp (&uri, E_CAL_SOURCE_TYPE_EVENT);
+ ecal_test_utils_cal_open (cal, FALSE);
+
+ address = ecal_test_utils_cal_get_cal_address (cal);
+ g_print ("calendar address: '%s'\n", address);
+
+ ecal_test_utils_cal_remove (cal);
+
+ g_free (address);
+
+ return 0;
+}