mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 16:24:45 -07:00
do not save a const reference to the user data in the info dialog (#6974)
Some checks are pending
Build Desktop / Configure (push) Waiting to run
Build Desktop / Debian 13 (push) Blocked by required conditions
Build Desktop / Debian 12 (push) Blocked by required conditions
Build Desktop / Fedora 44 (push) Blocked by required conditions
Build Desktop / Fedora 43 (push) Blocked by required conditions
Build Desktop / Servatrice_Debian 12 (push) Blocked by required conditions
Build Desktop / Ubuntu 26.04 (push) Blocked by required conditions
Build Desktop / Ubuntu 24.04 (push) Blocked by required conditions
Build Desktop / Arch (push) Blocked by required conditions
Build Desktop / macOS 14 (push) Blocked by required conditions
Build Desktop / macOS 15 (push) Blocked by required conditions
Build Desktop / macOS 13 Intel (push) Blocked by required conditions
Build Desktop / macOS 15 Debug (push) Blocked by required conditions
Build Desktop / Windows 10 (push) Blocked by required conditions
Build Docker Image / amd64 & arm64 (push) Waiting to run
Some checks are pending
Build Desktop / Configure (push) Waiting to run
Build Desktop / Debian 13 (push) Blocked by required conditions
Build Desktop / Debian 12 (push) Blocked by required conditions
Build Desktop / Fedora 44 (push) Blocked by required conditions
Build Desktop / Fedora 43 (push) Blocked by required conditions
Build Desktop / Servatrice_Debian 12 (push) Blocked by required conditions
Build Desktop / Ubuntu 26.04 (push) Blocked by required conditions
Build Desktop / Ubuntu 24.04 (push) Blocked by required conditions
Build Desktop / Arch (push) Blocked by required conditions
Build Desktop / macOS 14 (push) Blocked by required conditions
Build Desktop / macOS 15 (push) Blocked by required conditions
Build Desktop / macOS 13 Intel (push) Blocked by required conditions
Build Desktop / macOS 15 Debug (push) Blocked by required conditions
Build Desktop / Windows 10 (push) Blocked by required conditions
Build Docker Image / amd64 & arm64 (push) Waiting to run
* do not save a const reference to the user data in the info dialog * cmake format
This commit is contained in:
parent
6d0a423dcf
commit
6be9cec6e2
5 changed files with 29 additions and 34 deletions
|
|
@ -1,6 +1,5 @@
|
|||
#include "../cockatrice/src/interface/widgets/server/user/user_info_box.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include <libcockatrice/utility/days_years_between.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
|
@ -8,31 +7,31 @@ using dayyear = QPair<int, int>;
|
|||
|
||||
TEST(AgeFormatting, Zero)
|
||||
{
|
||||
auto got = UserInfoBox::getDaysAndYearsBetween(QDate(2000, 1, 1), QDate(2000, 1, 1));
|
||||
auto got = getDaysAndYearsBetween(QDate(2000, 1, 1), QDate(2000, 1, 1));
|
||||
ASSERT_EQ(got, dayyear(0, 0)) << "these are the same day";
|
||||
}
|
||||
|
||||
TEST(AgeFormatting, LeapDay)
|
||||
{
|
||||
auto got = UserInfoBox::getDaysAndYearsBetween(QDate(2000, 2, 28), QDate(2000, 3, 1));
|
||||
auto got = getDaysAndYearsBetween(QDate(2000, 2, 28), QDate(2000, 3, 1));
|
||||
ASSERT_EQ(got, dayyear(2, 0)) << "there is a leap day in between these days";
|
||||
}
|
||||
|
||||
TEST(AgeFormatting, LeapYear)
|
||||
{
|
||||
auto got = UserInfoBox::getDaysAndYearsBetween(QDate(2000, 1, 1), QDate(2001, 1, 1));
|
||||
auto got = getDaysAndYearsBetween(QDate(2000, 1, 1), QDate(2001, 1, 1));
|
||||
ASSERT_EQ(got, dayyear(0, 1)) << "there is a leap day in between these dates, but that's fine";
|
||||
}
|
||||
|
||||
TEST(AgeFormatting, LeapDayWithYear)
|
||||
{
|
||||
auto got = UserInfoBox::getDaysAndYearsBetween(QDate(2000, 2, 28), QDate(2001, 3, 1));
|
||||
auto got = getDaysAndYearsBetween(QDate(2000, 2, 28), QDate(2001, 3, 1));
|
||||
ASSERT_EQ(got, dayyear(1, 1)) << "there is a leap day in between these days but not in the last year";
|
||||
}
|
||||
|
||||
TEST(AgeFormatting, LeapDayThisYear)
|
||||
{
|
||||
auto got = UserInfoBox::getDaysAndYearsBetween(QDate(2003, 2, 28), QDate(2004, 3, 1));
|
||||
auto got = getDaysAndYearsBetween(QDate(2003, 2, 28), QDate(2004, 3, 1));
|
||||
ASSERT_EQ(got, dayyear(2, 1)) << "there is a leap day in between these days this year";
|
||||
}
|
||||
} // namespace
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue