qt: Clarify comment and strings in tofuinfo test

* lang/qt/tests/t-tofuinfo.cpp (testTofuSignCount)
(testTofuKeyList): Ensure distinct messages. Clarify comment.
This commit is contained in:
Andre Heinecke 2016-09-05 16:54:50 +02:00
parent 965b842fad
commit ab3fbdbd05

View File

@ -230,6 +230,12 @@ private Q_SLOTS:
Key key = keys[0]; Key key = keys[0];
Q_ASSERT(!key.isNull()); Q_ASSERT(!key.isNull());
/* As we sign & verify quickly here we need different
* messages to avoid having them treated as the same
* message if they were created within the same second.
* Alternatively we could use the same message and wait
* a second between each call. But this would slow down
* the testsuite. */
signAndVerify(QStringLiteral("Hello"), key, 1); signAndVerify(QStringLiteral("Hello"), key, 1);
key.update(); key.update();
signAndVerify(QStringLiteral("Hello2"), key, 2); signAndVerify(QStringLiteral("Hello2"), key, 2);
@ -258,12 +264,10 @@ private Q_SLOTS:
auto keyCopy = key; auto keyCopy = key;
keyCopy.update(); keyCopy.update();
auto sigCnt = keyCopy.userID(0).tofuInfo().signCount(); auto sigCnt = keyCopy.userID(0).tofuInfo().signCount();
signAndVerify(QStringLiteral("Hello"), keyCopy, signAndVerify(QStringLiteral("Hello5"), keyCopy,
sigCnt + 1); sigCnt + 1);
keyCopy.update(); keyCopy.update();
/* For some reason if you remove the " World" part of signAndVerify(QStringLiteral("Hello6"), keyCopy,
* the next message the test fails. */
signAndVerify(QStringLiteral("Hello World"), keyCopy,
sigCnt + 2); sigCnt + 2);
/* Now another one but with tofu */ /* Now another one but with tofu */