range: Handle zero-length ranges when calculating overlap
Zero length ranges, such as for events without a DTEND could be considered to overlap a range if they were at exactly the end of the range. The end of a range however is the first date that is supposed to not overlap, so a zero-length range on exactly this point should not be considered overlapping. This fixes cases where all-day events from the next month could show up on the same day of the current month if they did not have a DTEND. This also adds tests for all possible cases of such zero-length events overlapping. Fixes https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/701
This commit is contained in:
committed by
Georges Basile Stavracas Neto
parent
ce969c35b7
commit
44e2420645
@@ -159,6 +159,38 @@ static struct {
|
||||
GCAL_RANGE_NO_OVERLAP,
|
||||
GCAL_RANGE_AFTER,
|
||||
},
|
||||
|
||||
/* Zero length */
|
||||
{
|
||||
{ "2020-03-10T00:00:00", "2020-03-15T00:00:00" },
|
||||
{ "2020-03-15T00:00:00", "2020-03-15T00:00:00" },
|
||||
GCAL_RANGE_NO_OVERLAP,
|
||||
GCAL_RANGE_BEFORE,
|
||||
},
|
||||
{
|
||||
{ "2020-03-10T00:00:00", "2020-03-15T00:00:00" },
|
||||
{ "2020-03-10T00:00:00", "2020-03-10T00:00:00" },
|
||||
GCAL_RANGE_SUPERSET,
|
||||
GCAL_RANGE_AFTER,
|
||||
},
|
||||
{
|
||||
{ "2020-03-15T00:00:00", "2020-03-15T00:00:00" },
|
||||
{ "2020-03-10T00:00:00", "2020-03-15T00:00:00" },
|
||||
GCAL_RANGE_NO_OVERLAP,
|
||||
GCAL_RANGE_AFTER,
|
||||
},
|
||||
{
|
||||
{ "2020-03-10T00:00:00", "2020-03-10T00:00:00" },
|
||||
{ "2020-03-10T00:00:00", "2020-03-15T00:00:00" },
|
||||
GCAL_RANGE_SUBSET,
|
||||
GCAL_RANGE_BEFORE,
|
||||
},
|
||||
{
|
||||
{ "2020-03-10T00:00:00", "2020-03-10T00:00:00" },
|
||||
{ "2020-03-10T00:00:00", "2020-03-10T00:00:00" },
|
||||
GCAL_RANGE_EQUAL,
|
||||
GCAL_RANGE_MATCH,
|
||||
},
|
||||
};
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user