Disabling tests in tests/libecal/client
[platform/upstream/evolution-data-server.git] / tests / libecal / test-ecal-add-timezone.c
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2
3 #include <stdlib.h>
4 #include <libecal/libecal.h>
5 #include <libical/ical.h>
6
7 #include "ecal-test-utils.h"
8 #include "e-test-server-utils.h"
9
10 static ETestServerClosure cal_closure =
11         { E_TEST_SERVER_DEPRECATED_CALENDAR, NULL, E_CAL_SOURCE_TYPE_EVENT };
12
13 #define TZID_NEW "XYZ"
14 #define TZNAME_NEW "Ex Wye Zee"
15
16 static void
17 test_add_timezone (ETestServerFixture *fixture,
18                    gconstpointer user_data)
19 {
20         ECal *cal;
21         icalproperty *property;
22         icalcomponent *component;
23         icaltimezone *zone;
24         icaltimezone *zone_final;
25
26         cal = E_TEST_SERVER_UTILS_SERVICE (fixture, ECal);
27
28         /* Build up new timezone */
29         component = icalcomponent_new_vtimezone ();
30         property = icalproperty_new_tzid (TZID_NEW);
31         icalcomponent_add_property (component, property);
32         property = icalproperty_new_tzname (TZNAME_NEW);
33         icalcomponent_add_property (component, property);
34         zone = icaltimezone_new ();
35         icaltimezone_set_component (zone, component);
36
37         /* add */
38         ecal_test_utils_cal_add_timezone (cal, zone);
39
40         /* verify */
41         zone_final = ecal_test_utils_cal_get_timezone (cal, TZID_NEW);
42         g_assert_cmpstr (icaltimezone_get_tzid (zone), ==, icaltimezone_get_tzid (zone_final));
43         g_assert_cmpstr (icaltimezone_get_tznames (zone), ==,icaltimezone_get_tznames (zone_final));
44
45         icaltimezone_free (zone, TRUE);
46 }
47
48 gint
49 main (gint argc,
50       gchar **argv)
51 {
52 #if !GLIB_CHECK_VERSION (2, 35, 1)
53         g_type_init ();
54 #endif
55         g_test_init (&argc, &argv, NULL);
56
57         g_test_add (
58                 "/ECal/AddTimezone", ETestServerFixture, &cal_closure,
59                 e_test_server_utils_setup, test_add_timezone, e_test_server_utils_teardown);
60
61         return e_test_server_utils_run ();
62 }