evolution-data-server/evolution-data-server-3.28.5-test-cal-meta-backend-without-evolution.patch

118 lines
4.6 KiB
Diff

diff -up evolution-data-server-3.28.5/tests/libedata-cal/components/event-7.ics.test-cal-meta-backend-without-evolution evolution-data-server-3.28.5/tests/libedata-cal/components/event-7.ics
--- evolution-data-server-3.28.5/tests/libedata-cal/components/event-7.ics.test-cal-meta-backend-without-evolution 2020-01-16 08:28:52.842204524 +0100
+++ evolution-data-server-3.28.5/tests/libedata-cal/components/event-7.ics 2020-01-16 08:30:30.726203170 +0100
@@ -6,7 +6,7 @@ DTEND;TZID=/freeassociation.sourceforge.
SEQUENCE:1
SUMMARY:With attachment
TRANSP:OPAQUE
-ATTACH:file:///usr/share/icons/hicolor/48x48/apps/evolution.png
+ATTACH:$EVENT1URI$
CLASS:PUBLIC
CREATED:20170221T125054Z
LAST-MODIFIED:20170221T125054Z
diff -up evolution-data-server-3.28.5/tests/libedata-cal/test-cal-cache-utils.c.test-cal-meta-backend-without-evolution evolution-data-server-3.28.5/tests/libedata-cal/test-cal-cache-utils.c
--- evolution-data-server-3.28.5/tests/libedata-cal/test-cal-cache-utils.c.test-cal-meta-backend-without-evolution 2018-07-30 15:17:06.000000000 +0200
+++ evolution-data-server-3.28.5/tests/libedata-cal/test-cal-cache-utils.c 2020-01-16 08:28:52.842204524 +0100
@@ -114,13 +114,10 @@ tcu_fixture_teardown (TCUFixture *fixtur
}
gchar *
-tcu_new_icalstring_from_test_case (const gchar *case_name)
+tcu_get_test_case_filename (const gchar *case_name)
{
gchar *filename;
gchar *case_filename;
- GFile * file;
- GError *error = NULL;
- gchar *icalstring = NULL;
case_filename = g_strdup_printf ("%s.ics", case_name);
@@ -132,16 +129,48 @@ tcu_new_icalstring_from_test_case (const
else
filename = g_build_filename (SRCDIR, "..", "libedata-cal", "components", case_filename, NULL);
+ g_free (case_filename);
+
+ return filename;
+}
+
+gchar *
+tcu_new_icalstring_from_test_case (const gchar *case_name)
+{
+ gchar *filename;
+ GFile * file;
+ GError *error = NULL;
+ gchar *icalstring = NULL, *uripart;
+
+ filename = tcu_get_test_case_filename (case_name);
+
file = g_file_new_for_path (filename);
if (!g_file_load_contents (file, NULL, &icalstring, NULL, NULL, &error))
g_error (
"Failed to read test iCal string file '%s': %s",
filename, error->message);
- g_free (case_filename);
g_free (filename);
g_object_unref (file);
+ uripart = strstr (icalstring, "$EVENT1URI$");
+ if (uripart) {
+ gchar *uri;
+ GString *str;
+
+ filename = tcu_get_test_case_filename ("event-1");
+ uri = g_filename_to_uri (filename, NULL, NULL);
+ g_free (filename);
+
+ str = g_string_new_len (icalstring, uripart - icalstring);
+ g_string_append (str, uri);
+ g_string_append (str, uripart + 11);
+ g_free (icalstring);
+ g_free (uri);
+
+ icalstring = g_string_free (str, FALSE);
+ }
+
return icalstring;
}
diff -up evolution-data-server-3.28.5/tests/libedata-cal/test-cal-cache-utils.h.test-cal-meta-backend-without-evolution evolution-data-server-3.28.5/tests/libedata-cal/test-cal-cache-utils.h
--- evolution-data-server-3.28.5/tests/libedata-cal/test-cal-cache-utils.h.test-cal-meta-backend-without-evolution 2018-07-30 15:17:06.000000000 +0200
+++ evolution-data-server-3.28.5/tests/libedata-cal/test-cal-cache-utils.h 2020-01-16 08:28:52.842204524 +0100
@@ -46,6 +46,7 @@ ECalComponent * tcu_new_component_from_t
void tcu_add_component_from_test_case (TCUFixture *fixture,
const gchar *case_name,
ECalComponent **out_component);
+gchar * tcu_get_test_case_filename (const gchar *case_name);
G_END_DECLS
diff -up evolution-data-server-3.28.5/tests/libedata-cal/test-cal-meta-backend.c.test-cal-meta-backend-without-evolution evolution-data-server-3.28.5/tests/libedata-cal/test-cal-meta-backend.c
--- evolution-data-server-3.28.5/tests/libedata-cal/test-cal-meta-backend.c.test-cal-meta-backend-without-evolution 2018-07-30 15:17:06.000000000 +0200
+++ evolution-data-server-3.28.5/tests/libedata-cal/test-cal-meta-backend.c 2020-01-16 08:28:52.842204524 +0100
@@ -1274,6 +1274,7 @@ static void
test_get_attachment_uris (ECalMetaBackend *meta_backend)
{
ECalBackendSyncClass *backend_class;
+ gchar *expected_uri, *filename;
GSList *uris = NULL;
GError *error = NULL;
@@ -1306,7 +1307,13 @@ test_get_attachment_uris (ECalMetaBacken
g_assert_no_error (error);
g_assert_nonnull (uris);
g_assert_cmpint (g_slist_length (uris), ==, 1);
- g_assert_cmpstr (uris->data, ==, "file:///usr/share/icons/hicolor/48x48/apps/evolution.png");
+
+ filename = tcu_get_test_case_filename ("event-1");
+ expected_uri = g_filename_to_uri (filename, NULL, NULL);
+ g_free (filename);
+
+ g_assert_cmpstr (uris->data, ==, expected_uri);
+ g_free (expected_uri);
g_slist_free_full (uris, g_free);
}