Make sure expiration time is interpreted as unsigned number

* lang/qt/tests/t-various.cpp (testSignKeyWithExpiration): Convert
expiration time to uint_least32_t.
--

This fixes the test on 32-bit systems where time_t (the return type of
expirationTime()) is a signed 32-bit integer type.

GnuPG-bug-id: 5522
This commit is contained in:
Ingo Klöcker 2021-07-08 11:54:06 +02:00
parent 12006a7829
commit 6a79e90ded

View File

@ -355,7 +355,7 @@ private Q_SLOTS:
target.update(); target.update();
const auto keySignature = target.userID(0).signature(target.userID(0).numSignatures() - 1); const auto keySignature = target.userID(0).signature(target.userID(0).numSignatures() - 1);
QVERIFY(!keySignature.neverExpires()); QVERIFY(!keySignature.neverExpires());
const auto expirationDate = QDateTime::fromSecsSinceEpoch(keySignature.expirationTime()).date(); const auto expirationDate = QDateTime::fromSecsSinceEpoch(uint_least32_t(keySignature.expirationTime())).date();
QCOMPARE(expirationDate, QDate(2106, 2, 6)); // expiration date is capped at 2106-02-06 QCOMPARE(expirationDate, QDate(2106, 2, 6)); // expiration date is capped at 2106-02-06
} }