"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/libecal/client/test-cal-client-modify-object.c" between
evolution-data-server-3.32.4.tar.xz and evolution-data-server-3.34.0.tar.xz

About: Evolution-Data-Server manages access to the calendar, tasks and addressbook information available for Evolution and other applications.

test-cal-client-modify-object.c  (evolution-data-server-3.32.4.tar.xz):test-cal-client-modify-object.c  (evolution-data-server-3.34.0.tar.xz)
skipping to change at line 19 skipping to change at line 19
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public Licens e * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public Licens e
* for more details. * for more details.
* *
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
* *
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <libecal/libecal.h> #include <libecal/libecal.h>
#include <libical/ical.h>
#include "e-test-server-utils.h" #include "e-test-server-utils.h"
static ETestServerClosure cal_closure_sync = static ETestServerClosure cal_closure_sync =
{ E_TEST_SERVER_CALENDAR, NULL, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, FALSE, N ULL, FALSE }; { E_TEST_SERVER_CALENDAR, NULL, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, FALSE, N ULL, FALSE };
static ETestServerClosure cal_closure_async = static ETestServerClosure cal_closure_async =
{ E_TEST_SERVER_CALENDAR, NULL, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, FALSE, N ULL, TRUE }; { E_TEST_SERVER_CALENDAR, NULL, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, FALSE, N ULL, TRUE };
#define EVENT_SUMMARY "Creation of new test event" #define EVENT_SUMMARY "Creation of new test event"
static void static void
setup_cal (ECalClient *cal_client) setup_cal (ECalClient *cal_client)
{ {
struct icaltimetype now; ICalTime *dtstart, *dtend;
icalcomponent *icalcomp; ICalComponent *icomp;
gchar *uid = NULL; gchar *uid = NULL;
GError *error = NULL; GError *error = NULL;
now = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ()); dtstart = i_cal_time_new_current_with_zone (i_cal_timezone_get_utc_timezo
icalcomp = icalcomponent_new (ICAL_VEVENT_COMPONENT); ne ());
icalcomponent_set_summary (icalcomp, "Initial" EVENT_SUMMARY); dtend = i_cal_time_clone (dtstart);
icalcomponent_set_dtstart (icalcomp, now); i_cal_time_adjust (dtend, 0, 1, 0, 0);
icalcomponent_set_dtend (icalcomp, icaltime_from_timet_with_zone (icalt
ime_as_timet (now) + 60 * 60 * 60, 0, NULL)); icomp = i_cal_component_new (I_CAL_VEVENT_COMPONENT);
i_cal_component_set_summary (icomp, "Initial" EVENT_SUMMARY);
i_cal_component_set_dtstart (icomp, dtstart);
i_cal_component_set_dtend (icomp, dtend);
if (!e_cal_client_create_object_sync (cal_client, icalcomp, &uid, NULL, & g_clear_object (&dtstart);
error)) g_clear_object (&dtend);
if (!e_cal_client_create_object_sync (cal_client, icomp, E_CAL_OPERATION_
FLAG_NONE, &uid, NULL, &error))
g_error ("create object sync: %s", error->message); g_error ("create object sync: %s", error->message);
icalcomponent_free (icalcomp); g_object_unref (icomp);
g_object_set_data_full (G_OBJECT (cal_client), "use-uid", uid, g_free); g_object_set_data_full (G_OBJECT (cal_client), "use-uid", uid, g_free);
} }
static void static void
test_result (icalcomponent *icalcomp) test_result (ICalComponent *icomp)
{ {
g_assert (icalcomp != NULL); g_assert_nonnull (icomp);
g_assert_cmpstr (icalcomponent_get_summary (icalcomp), ==, EVENT_SUMMARY) g_assert_cmpstr (i_cal_component_get_summary (icomp), ==, EVENT_SUMMARY);
;
} }
static void static void
test_modify_object_sync (ETestServerFixture *fixture, test_modify_object_sync (ETestServerFixture *fixture,
gconstpointer user_data) gconstpointer user_data)
{ {
ECalClient *cal_client; ECalClient *cal_client;
GError *error = NULL; GError *error = NULL;
icalcomponent *icalcomp = NULL; ICalComponent *icomp = NULL;
const gchar *uid; const gchar *uid;
cal_client = E_TEST_SERVER_UTILS_SERVICE (fixture, ECalClient); cal_client = E_TEST_SERVER_UTILS_SERVICE (fixture, ECalClient);
setup_cal (cal_client); setup_cal (cal_client);
uid = g_object_get_data (G_OBJECT (cal_client), "use-uid"); uid = g_object_get_data (G_OBJECT (cal_client), "use-uid");
g_assert (uid != NULL); g_assert (uid != NULL);
if (!e_cal_client_get_object_sync (cal_client, uid, NULL, &icalcomp, NULL , &error)) if (!e_cal_client_get_object_sync (cal_client, uid, NULL, &icomp, NULL, & error))
g_error ("get object sync: %s", error->message); g_error ("get object sync: %s", error->message);
icalcomponent_set_summary (icalcomp, EVENT_SUMMARY); i_cal_component_set_summary (icomp, EVENT_SUMMARY);
if (!e_cal_client_modify_object_sync (cal_client, icalcomp, E_CAL_OBJ_MOD _ALL, NULL, &error)) if (!e_cal_client_modify_object_sync (cal_client, icomp, E_CAL_OBJ_MOD_AL L, E_CAL_OPERATION_FLAG_NONE, NULL, &error))
g_error ("modify object sync: %s", error->message); g_error ("modify object sync: %s", error->message);
icalcomponent_free (icalcomp); g_object_unref (icomp);
if (!e_cal_client_get_object_sync (cal_client, uid, NULL, &icalcomp, NULL , &error)) if (!e_cal_client_get_object_sync (cal_client, uid, NULL, &icomp, NULL, & error))
g_error ("get object sync after modification: %s", error->message ); g_error ("get object sync after modification: %s", error->message );
test_result (icalcomp); test_result (icomp);
icalcomponent_free (icalcomp); g_object_unref (icomp);
} }
static void static void
async_modify_result_ready (GObject *source_object, async_modify_result_ready (GObject *source_object,
GAsyncResult *result, GAsyncResult *result,
gpointer user_data) gpointer user_data)
{ {
ECalClient *cal_client; ECalClient *cal_client;
GError *error = NULL; GError *error = NULL;
icalcomponent *icalcomp = NULL; ICalComponent *icomp = NULL;
const gchar *uid; const gchar *uid;
GMainLoop *loop = (GMainLoop *) user_data; GMainLoop *loop = (GMainLoop *) user_data;
cal_client = E_CAL_CLIENT (source_object); cal_client = E_CAL_CLIENT (source_object);
uid = g_object_get_data (G_OBJECT (cal_client), "use-uid"); uid = g_object_get_data (G_OBJECT (cal_client), "use-uid");
if (!e_cal_client_modify_object_finish (cal_client, result, &error)) if (!e_cal_client_modify_object_finish (cal_client, result, &error))
g_error ("modify object finish: %s", error->message); g_error ("modify object finish: %s", error->message);
if (!e_cal_client_get_object_sync (cal_client, uid, NULL, &icalcomp, NULL , &error)) if (!e_cal_client_get_object_sync (cal_client, uid, NULL, &icomp, NULL, & error))
g_error ("get object sync after async modification: %s", error->m essage); g_error ("get object sync after async modification: %s", error->m essage);
test_result (icalcomp); test_result (icomp);
icalcomponent_free (icalcomp); g_object_unref (icomp);
g_main_loop_quit (loop); g_main_loop_quit (loop);
} }
static void static void
test_modify_object_async (ETestServerFixture *fixture, test_modify_object_async (ETestServerFixture *fixture,
gconstpointer user_data) gconstpointer user_data)
{ {
ECalClient *cal_client; ECalClient *cal_client;
GError *error = NULL; GError *error = NULL;
icalcomponent *icalcomp = NULL; ICalComponent *icomp = NULL;
const gchar *uid; const gchar *uid;
cal_client = E_TEST_SERVER_UTILS_SERVICE (fixture, ECalClient); cal_client = E_TEST_SERVER_UTILS_SERVICE (fixture, ECalClient);
setup_cal (cal_client); setup_cal (cal_client);
uid = g_object_get_data (G_OBJECT (cal_client), "use-uid"); uid = g_object_get_data (G_OBJECT (cal_client), "use-uid");
g_assert (uid != NULL); g_assert (uid != NULL);
if (!e_cal_client_get_object_sync (cal_client, uid, NULL, &icalcomp, NULL , &error)) if (!e_cal_client_get_object_sync (cal_client, uid, NULL, &icomp, NULL, & error))
g_error ("get object sync: %s", error->message); g_error ("get object sync: %s", error->message);
icalcomponent_set_summary (icalcomp, EVENT_SUMMARY); i_cal_component_set_summary (icomp, EVENT_SUMMARY);
e_cal_client_modify_object (cal_client, icalcomp, E_CAL_OBJ_MOD_ALL, NULL e_cal_client_modify_object (cal_client, icomp, E_CAL_OBJ_MOD_ALL, E_CAL_O
, async_modify_result_ready, fixture->loop); PERATION_FLAG_NONE, NULL, async_modify_result_ready, fixture->loop);
icalcomponent_free (icalcomp); g_object_unref (icomp);
g_main_loop_run (fixture->loop); g_main_loop_run (fixture->loop);
} }
gint gint
main (gint argc, main (gint argc,
gchar **argv) gchar **argv)
{ {
g_test_init (&argc, &argv, NULL); g_test_init (&argc, &argv, NULL);
g_test_bug_base ("http://bugzilla.gnome.org/"); g_test_bug_base ("http://bugzilla.gnome.org/");
 End of changes. 21 change blocks. 
34 lines changed or deleted 38 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)