"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/libedata-cal/test-cal-cache-search.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-cache-search.c  (evolution-data-server-3.32.4.tar.xz):test-cal-cache-search.c  (evolution-data-server-3.34.0.tar.xz)
skipping to change at line 39 skipping to change at line 39
const gchar *expr) const gchar *expr)
{ {
GSList *components = NULL, *link; GSList *components = NULL, *link;
GHashTable *res; GHashTable *res;
ECalBackendSExp *sexp; ECalBackendSExp *sexp;
ETimezoneCache *zone_cache; ETimezoneCache *zone_cache;
gboolean success; gboolean success;
GError *error = NULL; GError *error = NULL;
res = g_hash_table_new_full ((GHashFunc) e_cal_component_id_hash, (GEqual Func) e_cal_component_id_equal, res = g_hash_table_new_full ((GHashFunc) e_cal_component_id_hash, (GEqual Func) e_cal_component_id_equal,
(GDestroyNotify) e_cal_component_free_id, g_object_unref); e_cal_component_id_free, g_object_unref);
zone_cache = E_TIMEZONE_CACHE (cal_cache); zone_cache = E_TIMEZONE_CACHE (cal_cache);
/* Get all the components stored in the summary. */ /* Get all the components stored in the summary. */
success = e_cal_cache_search_components (cal_cache, NULL, &components, NU LL, &error); success = e_cal_cache_search_components (cal_cache, NULL, &components, NU LL, &error);
g_assert_no_error (error); g_assert_no_error (error);
g_assert (success); g_assert (success);
g_assert_nonnull (components); g_assert_nonnull (components);
sexp = e_cal_backend_sexp_new (expr); sexp = e_cal_backend_sexp_new (expr);
skipping to change at line 95 skipping to change at line 95
printf (" [%d]: %s%s%s\n", ii, sd->uid, sd->rid ? ", " : "", sd->rid ? sd->rid : ""); printf (" [%d]: %s%s%s\n", ii, sd->uid, sd->rid ? ", " : "", sd->rid ? sd->rid : "");
} }
printf ("\n"); printf ("\n");
printf (" Found %d in traverse:\n", g_hash_table_size (should_be)); printf (" Found %d in traverse:\n", g_hash_table_size (should_be));
ii = 0; ii = 0;
g_hash_table_iter_init (&iter, should_be); g_hash_table_iter_init (&iter, should_be);
while (g_hash_table_iter_next (&iter, &key, NULL)) { while (g_hash_table_iter_next (&iter, &key, NULL)) {
ECalComponentId *id = key; ECalComponentId *id = key;
const gchar *rid = e_cal_component_id_get_rid (id);
printf (" [%d]: %s%s%s\n", ii, id->uid, id->rid ? ", " : "", id->rid ? id->rid : ""); printf (" [%d]: %s%s%s\n", ii, e_cal_component_id_get_uid (i d), rid ? ", " : "", rid ? rid : "");
ii++; ii++;
} }
printf ("\n"); printf ("\n");
} }
#endif #endif
static void static void
test_search_result_equal (GSList *items, test_search_result_equal (GSList *items,
GHashTable *should_be, GHashTable *should_be,
skipping to change at line 123 skipping to change at line 124
for (link = items; link; link = g_slist_next (link)) { for (link = items; link; link = g_slist_next (link)) {
g_assert (check_cb (should_be, link->data)); g_assert (check_cb (should_be, link->data));
} }
} }
static gboolean static gboolean
search_data_check_cb (GHashTable *should_be, search_data_check_cb (GHashTable *should_be,
gpointer item_data) gpointer item_data)
{ {
ECalCacheSearchData *sd = item_data; ECalCacheSearchData *sd = item_data;
ECalComponentId id; ECalComponentId *id;
gboolean contains;
g_assert (sd != NULL); g_assert (sd != NULL);
g_assert (sd->uid != NULL); g_assert (sd->uid != NULL);
id.uid = sd->uid; id = e_cal_component_id_new (sd->uid, sd->rid);
id.rid = sd->rid;
contains = g_hash_table_contains (should_be, id);
e_cal_component_id_free (id);
return g_hash_table_contains (should_be, &id); return contains;
} }
static gboolean static gboolean
component_check_cb (GHashTable *should_be, component_check_cb (GHashTable *should_be,
gpointer item_data) gpointer item_data)
{ {
ECalComponent *comp = item_data; ECalComponent *comp = item_data;
ECalComponentId *id; ECalComponentId *id;
gboolean contains; gboolean contains;
g_assert (comp != NULL); g_assert_nonnull (comp);
id = e_cal_component_get_id (comp); id = e_cal_component_get_id (comp);
g_assert (id != NULL); g_assert_nonnull (id);
g_assert (id->uid != NULL); g_assert_nonnull (e_cal_component_id_get_uid (id));
contains = g_hash_table_contains (should_be, id); contains = g_hash_table_contains (should_be, id);
e_cal_component_free_id (id); e_cal_component_id_free (id);
return contains; return contains;
} }
static gboolean static gboolean
id_check_cb (GHashTable *should_be, id_check_cb (GHashTable *should_be,
gpointer item_data) gpointer item_data)
{ {
ECalComponentId *id = item_data; ECalComponentId *id = item_data;
g_assert (id != NULL); g_assert_nonnull (id);
g_assert (id->uid != NULL); g_assert_nonnull (e_cal_component_id_get_uid (id));
return g_hash_table_contains (should_be, id); return g_hash_table_contains (should_be, id);
} }
static void static void
test_search_expr (TCUFixture *fixture, test_search_expr (TCUFixture *fixture,
const gchar *expr, const gchar *expr,
const gchar *expects) const gchar *expects)
{ {
GSList *items = NULL; GSList *items = NULL;
skipping to change at line 215 skipping to change at line 220
if (expects) { if (expects) {
GSList *link; GSList *link;
gboolean negate = *expects == '!'; gboolean negate = *expects == '!';
if (negate) if (negate)
expects++; expects++;
for (link = items; link; link = g_slist_next (link)) { for (link = items; link; link = g_slist_next (link)) {
ECalComponentId *id = link->data; ECalComponentId *id = link->data;
if (g_strcmp0 (id->uid, expects) == 0) if (g_strcmp0 (e_cal_component_id_get_uid (id), expects) == 0)
break; break;
} }
if (link && negate) if (link && negate)
g_error ("Found '%s' in result of '%s', though it should not be there", expects, expr); g_error ("Found '%s' in result of '%s', though it should not be there", expects, expr);
else if (!link && !negate) else if (!link && !negate)
g_error ("Not found '%s' in result of '%s', though it sho uld be there", expects, expr); g_error ("Not found '%s' in result of '%s', though it sho uld be there", expects, expr);
} }
test_search_result_equal (items, should_be, id_check_cb); test_search_result_equal (items, should_be, id_check_cb);
g_slist_free_full (items, (GDestroyNotify) e_cal_component_free_id); g_slist_free_full (items, e_cal_component_id_free);
g_hash_table_destroy (should_be); g_hash_table_destroy (should_be);
} }
static void static void
test_search (TCUFixture *fixture, test_search (TCUFixture *fixture,
const gchar *expr, const gchar *expr,
const gchar *expects) const gchar *expects)
{ {
gchar *not_expr; gchar *not_expr;
 End of changes. 12 change blocks. 
14 lines changed or deleted 19 lines changed or added

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