Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KPkPass
Commits
06052046
Commit
06052046
authored
Jun 28, 2021
by
Volker Krause
Browse files
Make unit test independent of the local timezone
Should fix the FreeBSD CI.
parent
5923e6d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
autotests/fieldtest.cpp
View file @
06052046
...
...
@@ -14,6 +14,13 @@
#include <cmath>
void
initLocale
()
{
qputenv
(
"TZ"
,
"UTC"
);
}
Q_CONSTRUCTOR_FUNCTION
(
initLocale
)
namespace
KPkPass
{
class
FieldTest
:
public
QObject
...
...
@@ -34,7 +41,7 @@ private Q_SLOTS:
QJsonDocument
::
fromJson
(
R"({"key":"valid-date","label":"Datum","dateStyle":"PKDateStyleShort","value":"2021-06-27T14:30:00+02:00"})"
).
object
();
KPkPass
::
Field
f
(
obj
,
pass
.
get
());
QCOMPARE
(
f
.
value
().
type
(),
QVariant
::
DateTime
);
QCOMPARE
(
f
.
value
(),
QDateTime
({
2021
,
6
,
27
},
{
14
,
30
}));
QCOMPARE
(
f
.
value
(),
QDateTime
({
2021
,
6
,
27
},
{
14
,
30
}
,
Qt
::
OffsetFromUTC
,
7200
));
QCOMPARE
(
f
.
valueDisplayString
(),
QLatin1String
(
"27/06/2021 14:30"
));
obj
=
QJsonDocument
::
fromJson
(
R"({"key":"valid-locations","label":"Ort","value":"Freibad Killesberg\n"})"
).
object
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment