Commit Graph
60 Commits
Author SHA1 Message Date
Georges Basile Stavracas Neto 6234566874 core/range: Compute and use timestamps for comparison
Using GDateTime utilities is costly and shows up high in profiling.
That's because GDateTime has to run timezone offset checks for every
comparison. We can amortize this cost by converting these datetimes
to unix timestamps upfront, and using them for comparisons.

A complication is date-only ranges, for which unix timestamps wouldn't
work. For this, add a new kind of timestamp that only accounts for the
dates.

Add a new test case for date-only comparison.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/770>
2026-06-13 23:22:01 +02:00
Jan-Michael Brummer ef5935f1fa event-popover: Add support for Teams links
Add a separate function to extract the description and the URL from a
Teams-formatted event. Add a test for this as well.

Closes: https://gitlab.gnome.org/GNOME/gnome-calendar/-/work_items/1312
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/753>
2026-05-26 19:55:25 -03:00
Georges Basile Stavracas Neto c18218d1f6 core/event-list: Use uids to compare events
We can have multiple GcalEvent* instances for the same underlying
icalcomponent. Compare the uids instead of the raw pointers.

Closes https://gitlab.gnome.org/GNOME/gnome-calendar/-/work_items/1585

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/766>
2026-05-20 15:42:15 -04:00
Georges Basile Stavracas Neto 6da43e9353 Introduce GcalEventList
This is a GListModel implementation that is specific to
GcalEvents. Events are stored in a GSequence in order of
date.

Add a couple of tests exercising additions and removals.

WIP: add more tests
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/742>
2026-05-03 16:57:49 +00:00
mindonwarp b90b99f1bd core: Use GListModel for attendees instead of GSList
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/686>
2026-01-29 23:26:42 +00:00
mindonwarp 884855ee0b core: Add a wrapper object for event organizer
Add a wrapper for the ECalComponentOrganizer. An instance of this type
is kept as part of the GcalEvent structure.

The GcalEventOrganizer is just a "proxy" to the ECalComponentAttendee
and its purpose is to unclutter the GcalEvent interface and provide a
bindable base for a UI widget.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/671>
2026-01-21 19:37:52 +00:00
mindonwarp 4f6e705e8b core: Add a wrapper object for attendees
Wrap ECalComponentAttendee structure in calendar's own structure to
prevent propagating the dependency on libecal types to the ui layer.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/671>
2026-01-21 19:37:51 +00:00
Jordan Petridis 4e0902c867 Revert "tests: Disable a pair of tests"
This reverts commit 5a0aef6def.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/667>
2025-12-06 00:55:43 +02:00
Jordan Petridis 4d2cd89c49 test/test-server: Include gcal-utils header
This is a followup to 008b914f9e
in order to use gcal_create_soup_session.

The test was disabled and the breakage sneak through.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/668>
2025-11-24 09:01:23 +02:00
Georges Basile Stavracas Neto 13dc2ff3be tests/daylight-saving: Fix string leaks
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/664>
2025-11-19 17:52:53 -03:00
Georges Basile Stavracas Neto 2d8d50591e tests/utils: Declare ICalTimes with g_autoptr
The corresponding ICalComponent functions are transfer full.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/664>
2025-11-19 17:27:31 -03:00
Georges Basile Stavracas Neto 3225ffc88e tests/utils: Unref ICalComponent properly
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/664>
2025-11-19 17:19:05 -03:00
Georges Basile Stavracas Neto b064a23dbc tests/event: Fix string leak
Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/664>
2025-11-19 17:14:37 -03:00
Federico Mena Quintero a0a817ee8a Add scaffolding for a new test-internals binary
* There is a gcal_tests_add_internal() function...

* called from tests/test-internals.c...

* ... which doesn't add any tests yet, but we'll have some soon.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/550>
2025-08-27 19:59:57 -03:00
Georges Basile Stavracas Neto 0db8e5fb4c tests: Initialize autoptr variable 2025-03-19 12:21:39 -03:00
Georges Basile Stavracas Neto f96a1fb8ce tests: Fix typo 2025-03-19 12:17:39 -03:00
Titouan Real 42f891ff42 gui/event-editor: Add time zone selection
Creates a chooser managing a GDateTime. The chooser allows the user
to change the date, the time and the timezone independently.

This replaces the precedent GcalTimeChooserRow widget, because it is
easier to manage the different interactions with the user in a single
widget.

Co-authored-by: Georges Basile Stavracas Neto
<georges.stavracas@gmail.com>
2025-01-31 19:37:26 -03:00
Georges Basile Stavracas Neto 7ad83d1d92 test/utils: Cosmetics 2024-11-20 13:23:03 -03:00
Felipe Anibal 9ecb68bfc0 tests: add test for the gcal_date_time_from_icaltime function
Create file to test util functions and create a test for the
gcal_date_time_from_icaltime function. The test checks if the time
zones are correctly interpreted in the conversion of an ICalTime to a
GDateTime.
2024-11-19 18:10:02 +00:00
Jean-François Fortin Tam 008b914f9e utils/source-discoverer: Set the User-Agent
This avoids some web servers or WAFs doing weird stuff with our requests
which would lead to situations where our web calendar source discovery
would face server errors, redirects, incorrect contents, etc.

Fixes #651

Fixes https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/290
2024-08-07 12:32:00 -04:00
Felipe Anibal f3c3ff55af tests: add event_date_check_tz
Add test to check the timezone of events.

See https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/171
2024-07-12 11:39:14 -03:00
Georges Basile Stavracas Neto 5a0aef6def tests: Disable a pair of tests
They're failing CI, I don't know why, and I'm afraid it's not really
related to GNOME Calendar itself. So just disable them for now.
2024-07-09 19:04:46 +00:00
Georges Basile Stavracas Neto b1a8720384 build: Properly sort tests alphabetically 2024-07-09 19:04:46 +00:00
Daniel Garcia Moreno 3793001bb8 test: Add event_date_create_tzid
This new test check that the tz data in the component is set correctly
on creation when it's UTC midnight.

See https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/172
2023-11-09 20:59:59 +00:00
Daniel Garcia Moreno 68c921bf60 test: Add event_date_edit_tzid
This new test check that the tz data in the component is set correctly
after editing an event date end.

See https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/170
2023-11-09 20:59:59 +00:00
Daniel Garcia Moreno 20aa929966 event: Set dt_end to next day when DTEND is not defined
from RFC5545 (p. 54) https://datatracker.ietf.org/doc/html/rfc5545#page-54
For cases where a "VEVENT" calendar component specifies a "DTSTART"
property with a DATE value type but no "DTEND" nor "DURATION" property,
the event's duration is taken to be one day.

Fix https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/327
2023-11-09 14:37:09 +00:00
Daniel Garcia Moreno 6afb5cf3a5 view: Fix daylight saving issue in week view
This patch fixes an issue when creating new events in week view the week
after the daylight saving change.

The problem was in the calc of the selected date, that's done couting
the 30 minutes slots and adding that minutes to the week_start datetime.
When there's a daylight saving change, the real date to select should be
adjusted. This patch adds a new util function to make it easy to add
minutes ignoring the tz so we can make this calc directly with
gcal_date_time_add_floating_minutes.

This also includes a new test file with some checks for the new util
function and spring / autumn changes.

This new function could be used in other places to fix specific issues
that could be caused by the same logic error, calculate a selection or
event position based on GDateTime operations.

Fix https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/482
2023-11-09 13:17:20 +00:00
Titouan Real 2cb0414bb8 build: Update deprecated meson functions 2023-06-07 15:51:37 +02:00
Titouan Real 64f9aaca4b build: Replace join_paths by / operator 2023-06-07 15:51:03 +02:00
Georges Basile Stavracas Neto 0322bcf54c utils/source-discoverer: Test URI before discovery
This makes sure that we have a valid host set. This check is
copies from Soup's private SOUP_URI_IS_VALID() macro.

Add a test for this behavior.

Closes https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/794
2023-03-05 11:24:49 -03:00
Georges Basile Stavracas Neto 075b91d279 tests: Set bug base 2023-03-05 11:24:49 -03:00
Milan Crha 0bd11799dc Port to libsoup3 2022-06-22 08:51:30 -03:00
Sebastian Keller 44e2420645 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
2021-04-21 13:59:26 +00:00
Georges Basile Stavracas Neto 9a636f33e5 tests: Disable unauthorized test again
Needs more love.

Closes https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/700
2021-03-22 15:54:41 -03:00
Georges Basile Stavracas Neto d38c1f2f41 tests: Enable unauthorized discovery test
This one is actually implemented, what's not implemented is the WebDAV one.
2021-03-12 11:03:26 -03:00
Georges Basile Stavracas Neto dbd81f401c event: Add API to clone events
This will be useful for updating events without having
to keep track of the event states.

Add the new API, and also a unit test.
2020-06-15 13:07:48 -03:00
Georges Basile Stavracas Neto d18441204f tests: Trivial cleanup 2020-06-15 13:07:37 -03:00
Clarissa Borges f1d20126dc event: Add more range test cases
More examples of possible dates for events were added to the test cases.
Superset, subset, intersection and no overlap cases are covered.
2020-04-14 17:56:12 -03:00
Georges Basile Stavracas Neto 3efbc2436c range-tree: Use GcalRange 2020-04-14 19:08:05 +00:00
Georges Basile Stavracas Neto dbfebc85fa Introduce GcalRange
GcalRange is a new structure that represents a time range. It is
always inclusive at the start, and exclusive at the end.
2020-04-14 19:08:05 +00:00
Georges Basile Stavracas Neto 92f331cd9f range-tree: Add API to remove data
It'll be useful to remove entries without knowing their
range.
2020-04-01 21:06:50 -03:00
Georges Basile Stavracas Neto ae2a6b9d21 range-tree: Switch to use GDateTime
Using raw integers forces us to select a pre-defined
start and end ranges for the timeline. Since we want
to reuse this data structure on GcalTimeline, make it
a bit more useful.
2020-04-01 21:06:50 -03:00
Michael Catanzaro 50b6d00784 manager: add GcalContext property
This improves access to the GcalContext inside GcalManager.

Also, remove test-manager since it only tests that gcal_manager_new()
returns non-NULL.
2019-09-19 16:04:04 -05:00
Georges Basile Stavracas Neto 75d24803ed tests: Temporarily disable discoverer test 2019-07-16 21:30:31 -03:00
Georges Basile Stavracas Neto 371fdbc881 Introduce new source discoverer
The new source discoverer is a complete overhaul of
the current code. It is async-only, correctly threaded,
and easier to maintain.

A major new feature of this web source discoverer is
that it now pings the server to see if the URL feeds
us back with an iCalendar file.

Furthermore, it continues to use E-D-S WebDAV discovery
functions as a fallback mechanism.

Fixes #380
2019-07-13 16:04:30 -03:00
Georges Basile Stavracas Neto 2aa9bc1f61 tests: Add calendar server and tests
This will be used to write a propert test suite
for the new calendar discoverer code.
2019-07-13 16:04:30 -03:00
Georges Basile Stavracas Neto 54690e285a build: Improve test generation 2019-07-13 16:04:30 -03:00
Georges Basile Stavracas Neto 7811b90730 tests: Fix test suite
Introduce a new GcalStubCalendar class that essentially
removes the ECalClient initialization from GcalCalendar,
and use it as part of a new private library consumed by
the tests.
2019-05-04 12:05:39 -03:00
Georges Basile Stavracas Neto 1a5ff545a2 project: Move a few classes to core/ 2019-05-04 12:05:39 -03:00
Georges Basile Stavracas Neto 68943eec57 utils: Add GDateTime utils
This will greatly help with the transition to GDateTime.
In the future, we can propose these APIs to GLib itself.
2019-04-26 12:59:29 -03:00