diff options
author | Ruben Schmidmeister <101409-bash@users.noreply.gitlab.gnome.org> | 2023-01-12 23:16:46 +0000 |
---|---|---|
committer | Niels De Graef <nielsdegraef@gmail.com> | 2023-01-12 23:16:46 +0000 |
commit | 916f6e658957b9da356f390f5546c3175490929c (patch) | |
tree | e46ddcdca8cb2fba4c61b9245a68c4a6f118c5d2 /tests | |
parent | c4ac635f4461f725bc7a5f007e302de73cf24613 (diff) | |
download | gnome-contacts-916f6e658957b9da356f390f5546c3175490929c.tar.gz |
Show leap day birthdays on February 28th in non-leap years
Diffstat (limited to 'tests')
-rw-r--r-- | tests/core/test-birthday-chunk.vala | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/core/test-birthday-chunk.vala b/tests/core/test-birthday-chunk.vala index 826cb6d..d112379 100644 --- a/tests/core/test-birthday-chunk.vala +++ b/tests/core/test-birthday-chunk.vala @@ -19,6 +19,7 @@ void main (string[] args) { Test.init (ref args); Test.add_func ("/core/birthday-chunk/property_name_chunk", test_property_name); Test.add_func ("/core/birthday-chunk/is-empty", test_is_empty); + Test.add_func ("/core/birthday-chunk/leap-day-birthday", test_leap_day_birthday); Test.run (); } @@ -44,3 +45,19 @@ private void test_is_empty () { chunk.birthday = null; assert_true (chunk.is_empty); } + +void test_leap_day_birthday () { + var contact = new Contacts.Contact.empty (); + var chunk = (Contacts.BirthdayChunk) contact.create_chunk ("birthday", null); + assert_nonnull (chunk); + chunk.birthday = new DateTime.local (2020, 2, 29, 0, 0, 0); + + var leap_day = new DateTime.local (2024, 2, 29, 0, 0, 0); + assert_true (chunk.is_today (leap_day)); + + var feb_28_leap_year = new DateTime.local (2024, 2, 28, 0, 0, 0); + assert_false (chunk.is_today (feb_28_leap_year)); + + var feb_28_non_leap_year = new DateTime.local (2023, 2, 28, 0, 0, 0); + assert_true (chunk.is_today (feb_28_non_leap_year)); +}
\ No newline at end of file |