[evolution-data-server/treitter-client-gdbus] Port EDataCal method 'getSchedulingInformation' and add a regression test.



commit 662598acc2e580d80e08191008a34c9b7420b8c0
Author: Travis Reitter <treitter gmail com>
Date:   Thu Dec 17 10:51:18 2009 -0800

    Port EDataCal method 'getSchedulingInformation' and add a regression test.

 calendar/libecal/e-cal.c                         |    2 +-
 calendar/libecal/e-data-cal-gdbus-bindings.h     |   14 ++++
 calendar/tests/ecal/Makefile.am                  |    3 +
 calendar/tests/ecal/ecal-test-utils.c            |   84 ++++++++++++++++++++++
 calendar/tests/ecal/ecal-test-utils.h            |    3 +
 calendar/tests/ecal/test-ecal-get-capabilities.c |   22 ++++++
 6 files changed, 127 insertions(+), 1 deletions(-)
---
diff --git a/calendar/libecal/e-cal.c b/calendar/libecal/e-cal.c
index f15a7e4..ee6eeca 100644
--- a/calendar/libecal/e-cal.c
+++ b/calendar/libecal/e-cal.c
@@ -1714,7 +1714,7 @@ load_static_capabilities (ECal *ecal, GError **error)
 	}
 
 	LOCK_CONN ();
-	if (!org_gnome_evolution_dataserver_calendar_Cal_get_scheduling_information (priv->proxy, &priv->capabilities, error)) {
+	if (!e_data_cal_gdbus_get_scheduling_information_sync (priv->gdbus_proxy, &priv->capabilities, error)) {
 		UNLOCK_CONN ();
 		E_CALENDAR_CHECK_STATUS (E_CALENDAR_STATUS_CORBA_EXCEPTION, error);
 	}
diff --git a/calendar/libecal/e-data-cal-gdbus-bindings.h b/calendar/libecal/e-data-cal-gdbus-bindings.h
index 4964169..981f7f3 100644
--- a/calendar/libecal/e-data-cal-gdbus-bindings.h
+++ b/calendar/libecal/e-data-cal-gdbus-bindings.h
@@ -172,4 +172,18 @@ e_data_cal_gdbus_get_ldap_attribute_sync (GDBusProxy  *proxy,
         return demarshal_retvals__STRING (retvals, attr);
 }
 
+static gboolean
+e_data_cal_gdbus_get_scheduling_information_sync (GDBusProxy  *proxy,
+						  char       **caps,
+						  GError     **error)
+{
+        GVariant *parameters;
+        GVariant *retvals;
+
+        parameters = g_variant_new ("()");
+	retvals = g_dbus_proxy_invoke_method_sync (proxy, "getSchedulingInformation", parameters, -1, NULL, error);
+
+        return demarshal_retvals__STRING (retvals, caps);
+}
+
 G_END_DECLS
diff --git a/calendar/tests/ecal/Makefile.am b/calendar/tests/ecal/Makefile.am
index 6c5910e..876b354 100644
--- a/calendar/tests/ecal/Makefile.am
+++ b/calendar/tests/ecal/Makefile.am
@@ -37,6 +37,7 @@ TESTS = \
         test-ecal-get-alarm-email-address	\
         test-ecal-get-cal-address		\
         test-ecal-get-ldap-attribute		\
+        test-ecal-get-capabilities		\
         $(NULL)
 
 # The test program
@@ -53,6 +54,8 @@ test_ecal_get_cal_address_LDADD=$(TEST_ECAL_LIBS)
 test_ecal_get_cal_address_CPPFLAGS=$(TEST_ECAL_CPPFLAGS)
 test_ecal_get_ldap_attribute_LDADD=$(TEST_ECAL_LIBS)
 test_ecal_get_ldap_attribute_CPPFLAGS=$(TEST_ECAL_CPPFLAGS)
+test_ecal_get_capabilities_LDADD=$(TEST_ECAL_LIBS)
+test_ecal_get_capabilities_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 1eea7d8..052243e 100644
--- a/calendar/tests/ecal/ecal-test-utils.c
+++ b/calendar/tests/ecal/ecal-test-utils.c
@@ -178,3 +178,87 @@ ecal_test_utils_cal_get_ldap_attribute (ECal *cal)
 
 	return attr;
 }
+
+static const char*
+b2s (gboolean value)
+{
+        return value ? "true" : "false";
+}
+
+void
+ecal_test_utils_cal_get_capabilities (ECal *cal)
+{
+        g_print ("calendar capabilities:\n");
+        g_print ("        One alarm only:                  %s\n"
+                 "        Organizers must attend meetings: %s\n"
+                 "        Organizers must accept meetings: %s\n"
+                 "        Master object for recurrences:   %s\n"
+                 "        Can save schedules:              %s\n"
+                 "        No alarm repeat:                 %s\n"
+                 "        No audio alarms:                 %s\n"
+                 "        No display alarms:               %s\n"
+                 "        No email alarms:                 %s\n"
+                 "        No procedure alarms:             %s\n"
+                 "        No task assignment:              %s\n"
+                 "        No 'this and future':            %s\n"
+                 "        No 'this and prior':             %s\n"
+                 "        No transparency:                 %s\n"
+                 "        Organizer not email address:     %s\n"
+                 "        Remove alarms:                   %s\n"
+                 "        Create messages:                 %s\n"
+                 "        No conv. to assigned task:       %s\n"
+                 "        No conv. to recurring:           %s\n"
+                 "        No general options:              %s\n"
+                 "        Requires send options:           %s\n"
+                 "        Delegate supported:              %s\n"
+                 "        No organizer required:           %s\n"
+                 "        Delegate to many:                %s\n"
+                 "        Has unaccepted meeting:          %s\n"
+                 ,
+		 b2s (e_cal_get_one_alarm_only (cal)),
+		 b2s (e_cal_get_organizer_must_attend (cal)),
+		 b2s (e_cal_get_organizer_must_accept (cal)),
+		 b2s (e_cal_get_recurrences_no_master (cal)),
+		 b2s (e_cal_get_save_schedules (cal)),
+		 b2s (e_cal_get_static_capability (cal,
+				 CAL_STATIC_CAPABILITY_NO_ALARM_REPEAT)),
+		 b2s (e_cal_get_static_capability (cal,
+				 CAL_STATIC_CAPABILITY_NO_AUDIO_ALARMS)),
+		 b2s (e_cal_get_static_capability (cal,
+				 CAL_STATIC_CAPABILITY_NO_DISPLAY_ALARMS)),
+		 b2s (e_cal_get_static_capability (cal,
+				 CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS)),
+		 b2s (e_cal_get_static_capability (cal,
+				 CAL_STATIC_CAPABILITY_NO_PROCEDURE_ALARMS)),
+		 b2s (e_cal_get_static_capability (cal,
+				 CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT)),
+		 b2s (e_cal_get_static_capability (cal,
+				 CAL_STATIC_CAPABILITY_NO_THISANDFUTURE)),
+		 b2s (e_cal_get_static_capability (cal,
+				 CAL_STATIC_CAPABILITY_NO_THISANDPRIOR)),
+		 b2s (e_cal_get_static_capability (cal,
+				 CAL_STATIC_CAPABILITY_NO_TRANSPARENCY)),
+		 b2s (e_cal_get_static_capability (cal,
+				 CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS)),
+		 b2s (e_cal_get_static_capability (cal,
+				 CAL_STATIC_CAPABILITY_REMOVE_ALARMS)),
+		 b2s (e_cal_get_static_capability (cal,
+				 CAL_STATIC_CAPABILITY_CREATE_MESSAGES)),
+		 b2s (e_cal_get_static_capability (cal,
+				 CAL_STATIC_CAPABILITY_NO_CONV_TO_ASSIGN_TASK)),
+		 b2s (e_cal_get_static_capability (cal,
+				 CAL_STATIC_CAPABILITY_NO_CONV_TO_RECUR)),
+		 b2s (e_cal_get_static_capability (cal,
+				 CAL_STATIC_CAPABILITY_NO_GEN_OPTIONS)),
+		 b2s (e_cal_get_static_capability (cal,
+				 CAL_STATIC_CAPABILITY_REQ_SEND_OPTIONS)),
+		 b2s (e_cal_get_static_capability (cal,
+				 CAL_STATIC_CAPABILITY_DELEGATE_SUPPORTED)),
+		 b2s (e_cal_get_static_capability (cal,
+				 CAL_STATIC_CAPABILITY_NO_ORGANIZER)),
+		 b2s (e_cal_get_static_capability (cal,
+				 CAL_STATIC_CAPABILITY_DELEGATE_TO_MANY)),
+		 b2s (e_cal_get_static_capability (cal,
+				 CAL_STATIC_CAPABILITY_HAS_UNACCEPTED_MEETING))
+		 );
+}
diff --git a/calendar/tests/ecal/ecal-test-utils.h b/calendar/tests/ecal/ecal-test-utils.h
index ebcb767..0fb522b 100644
--- a/calendar/tests/ecal/ecal-test-utils.h
+++ b/calendar/tests/ecal/ecal-test-utils.h
@@ -56,4 +56,7 @@ ecal_test_utils_cal_get_cal_address (ECal *cal);
 char*
 ecal_test_utils_cal_get_ldap_attribute (ECal *cal);
 
+void
+ecal_test_utils_cal_get_capabilities (ECal *cal);
+
 #endif /* _ECAL_TEST_UTILS_H */
diff --git a/calendar/tests/ecal/test-ecal-get-capabilities.c b/calendar/tests/ecal/test-ecal-get-capabilities.c
new file mode 100644
index 0000000..fa68a9f
--- /dev/null
+++ b/calendar/tests/ecal/test-ecal-get-capabilities.c
@@ -0,0 +1,22 @@
+/* -*- 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;
+
+	g_type_init ();
+
+	cal = ecal_test_utils_cal_new_temp (&uri, E_CAL_SOURCE_TYPE_EVENT);
+	ecal_test_utils_cal_open (cal, FALSE);
+	ecal_test_utils_cal_get_capabilities (cal);
+	ecal_test_utils_cal_remove (cal);
+
+	return 0;
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]