summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2021-11-08 16:19:08 +0100
committerMilan Crha <mcrha@redhat.com>2021-11-08 16:19:08 +0100
commitc6c2aeb9ba6b400586686b6eb0c9dd1a2d3be979 (patch)
tree7d9df7251e4d8b0571a583034b0078ea02a4ce8a /tests
parente75d242255e8852b75b977a453999941a7b1b0ca (diff)
downloadevolution-data-server-c6c2aeb9ba6b400586686b6eb0c9dd1a2d3be979.tar.gz
I#366 - Calendar: Correct 'occur-in-time-range?' for zero-length events
Closes https://gitlab.gnome.org/GNOME/evolution-data-server/-/issues/366
Diffstat (limited to 'tests')
-rw-r--r--tests/libedata-cal/components/event-0.ics12
-rw-r--r--tests/libedata-cal/test-cal-cache-search.c10
-rw-r--r--tests/libedata-cal/test-cal-cache-utils.c5
-rw-r--r--tests/libedata-cal/test-cal-cache-utils.h1
4 files changed, 26 insertions, 2 deletions
diff --git a/tests/libedata-cal/components/event-0.ics b/tests/libedata-cal/components/event-0.ics
new file mode 100644
index 000000000..0934961e3
--- /dev/null
+++ b/tests/libedata-cal/components/event-0.ics
@@ -0,0 +1,12 @@
+BEGIN:VEVENT
+UID:event-0
+DTSTAMP:20170130T000000Z
+CREATED:20170216T155507Z
+LAST-MODIFIED:20170216T155543Z
+SEQUENCE:1
+DTSTART:20170209T013000Z
+SUMMARY:Zero length
+DESCRIPTION:No DTEND/DUE properties
+CLASS:PUBLIC
+TRANSP:OPACHE
+END:VEVENT
diff --git a/tests/libedata-cal/test-cal-cache-search.c b/tests/libedata-cal/test-cal-cache-search.c
index a008915bc..8c046bc45 100644
--- a/tests/libedata-cal/test-cal-cache-search.c
+++ b/tests/libedata-cal/test-cal-cache-search.c
@@ -275,6 +275,13 @@ test_search_occur_in_time_range (TCUFixture *fixture,
test_search (fixture, "(occur-in-time-range? (make-time \"20170221T180000Z\") (make-time \"20170221T190000Z\") \"America/New_York\")", "event-6");
test_search (fixture, "(occur-in-time-range? (make-time \"20170221T200000Z\") (make-time \"20170221T210000Z\") \"Europe/Berlin\")", "!event-6");
test_search (fixture, "(occur-in-time-range? (make-time \"20170221T180000Z\") (make-time \"20170221T190000Z\") \"Europe/Berlin\")", "event-6");
+
+ /* event-0 */
+ test_search (fixture, "(occur-in-time-range? (make-time \"20170209T000000Z\") (make-time \"20170209T012900Z\"))", "!event-0");
+ test_search (fixture, "(occur-in-time-range? (make-time \"20170209T000000Z\") (make-time \"20170209T013000Z\"))", "!event-0");
+ test_search (fixture, "(occur-in-time-range? (make-time \"20170209T010000Z\") (make-time \"20170209T020000Z\"))", "event-0");
+ test_search (fixture, "(occur-in-time-range? (make-time \"20170209T013000Z\") (make-time \"20170209T020000Z\"))", "event-0");
+ test_search (fixture, "(occur-in-time-range? (make-time \"20170209T013100Z\") (make-time \"20170209T020000Z\"))", "!event-0");
}
static void
@@ -474,6 +481,7 @@ main (gint argc,
gchar **argv)
{
TCUClosure closure_events = { TCU_LOAD_COMPONENT_SET_EVENTS };
+ TCUClosure closure_events0 = { TCU_LOAD_COMPONENT_SET_EVENTS_WITH_0 };
TCUClosure closure_tasks = { TCU_LOAD_COMPONENT_SET_TASKS };
#if !GLIB_CHECK_VERSION (2, 35, 1)
@@ -490,7 +498,7 @@ main (gint argc,
g_test_add ("/ECalCache/Search/Uid", TCUFixture, &closure_events,
tcu_fixture_setup, test_search_uid, tcu_fixture_teardown);
- g_test_add ("/ECalCache/Search/OccurInTimeRange", TCUFixture, &closure_events,
+ g_test_add ("/ECalCache/Search/OccurInTimeRange", TCUFixture, &closure_events0,
tcu_fixture_setup, test_search_occur_in_time_range, tcu_fixture_teardown);
g_test_add ("/ECalCache/Search/DueInTimeRange", TCUFixture, &closure_tasks,
tcu_fixture_setup, test_search_due_in_time_range, tcu_fixture_teardown);
diff --git a/tests/libedata-cal/test-cal-cache-utils.c b/tests/libedata-cal/test-cal-cache-utils.c
index 767e8894c..33fd12949 100644
--- a/tests/libedata-cal/test-cal-cache-utils.c
+++ b/tests/libedata-cal/test-cal-cache-utils.c
@@ -93,7 +93,7 @@ tcu_fixture_setup (TCUFixture *fixture,
g_free (filename);
if (closure) {
- if (closure->load_set == TCU_LOAD_COMPONENT_SET_EVENTS) {
+ if (closure->load_set == TCU_LOAD_COMPONENT_SET_EVENTS || closure->load_set == TCU_LOAD_COMPONENT_SET_EVENTS_WITH_0) {
tcu_add_component_from_test_case (fixture, "event-1", NULL);
tcu_add_component_from_test_case (fixture, "event-2", NULL);
tcu_add_component_from_test_case (fixture, "event-3", NULL);
@@ -104,6 +104,9 @@ tcu_fixture_setup (TCUFixture *fixture,
tcu_add_component_from_test_case (fixture, "event-7", NULL);
tcu_add_component_from_test_case (fixture, "event-8", NULL);
tcu_add_component_from_test_case (fixture, "event-9", NULL);
+
+ if (closure->load_set == TCU_LOAD_COMPONENT_SET_EVENTS_WITH_0)
+ tcu_add_component_from_test_case (fixture, "event-0", NULL);
} else if (closure->load_set == TCU_LOAD_COMPONENT_SET_TASKS) {
tcu_add_component_from_test_case (fixture, "task-1", NULL);
tcu_add_component_from_test_case (fixture, "task-2", NULL);
diff --git a/tests/libedata-cal/test-cal-cache-utils.h b/tests/libedata-cal/test-cal-cache-utils.h
index 7d62148e2..42dfa1866 100644
--- a/tests/libedata-cal/test-cal-cache-utils.h
+++ b/tests/libedata-cal/test-cal-cache-utils.h
@@ -28,6 +28,7 @@ void tcu_read_args (gint argc,
typedef enum {
TCU_LOAD_COMPONENT_SET_NONE,
TCU_LOAD_COMPONENT_SET_EVENTS,
+ TCU_LOAD_COMPONENT_SET_EVENTS_WITH_0,
TCU_LOAD_COMPONENT_SET_TASKS
} TCULoadComponentSet;