mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Address macOS issue where right-clicking a username in the main chat (#4523)
* Address macOS issue where right-clicking a username in the main chat (or game chat) areas would pop up a seemingly empty user profile. This is because the resize event is overridden and doesn't actually attempt to resize based on the size hint of the dialog. Now that we're explicit with the call, this resize should be forced and have comparable results to popping up user profile from the user list. * use datetime for calculating account age (#4526) * use datetime for calculating account age make translating easier by using tr multiples automatically account for leap days Co-authored-by: ebbit1q <ebbit1q@gmail.com>
This commit is contained in:
parent
baaf22d0c4
commit
d61c604bf4
4 changed files with 89 additions and 30 deletions
44
tests/test_age_formatting.cpp
Normal file
44
tests/test_age_formatting.cpp
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#include "../cockatrice/src/userinfobox.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
using dayyear = QPair<int, int>;
|
||||
|
||||
TEST(AgeFormatting, Zero)
|
||||
{
|
||||
auto got = UserInfoBox::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));
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
ASSERT_EQ(got, dayyear(2, 1)) << "there is a leap day in between these days this year";
|
||||
}
|
||||
} // namespace
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue