Commit 2aec8409 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port to QRandomGenerator

parent 758268e1
Pipeline #25415 failed with stage
in 41 minutes and 1 second
......@@ -30,7 +30,7 @@
#include <kmbox/mbox.h>
#include <kmime/kmime_message.h>
#include <KRandom>
#include <QRandomGenerator>
#include <QTemporaryDir>
#include <QTest>
......@@ -183,7 +183,7 @@ void ItemCreateTest::testMBox()
collection2.setParentCollection(mStore->topLevelCollection());
Item item1;
item1.setId(KRandom::random());
item1.setId(QRandomGenerator::global()->generate());
item1.setMimeType(KMime::Message::mimeType());
item1.setPayload<KMime::Message::Ptr>(msgPtr1);
......@@ -207,7 +207,7 @@ void ItemCreateTest::testMBox()
QCOMPARE((int)mbox2.entries().count(), 1);
Item item2;
item2.setId(KRandom::random());
item2.setId(QRandomGenerator::global()->generate());
item2.setMimeType(KMime::Message::mimeType());
item2.setPayload<KMime::Message::Ptr>(msgPtr2);
......@@ -382,7 +382,7 @@ void ItemCreateTest::testMaildir()
collection2.setParentCollection(mStore->topLevelCollection());
Item item1;
item1.setId(KRandom::random());
item1.setId(QRandomGenerator::global()->generate());
item1.setMimeType(KMime::Message::mimeType());
item1.setPayload<KMime::Message::Ptr>(msgPtr1);
......@@ -408,7 +408,7 @@ void ItemCreateTest::testMaildir()
QCOMPARE((int)entrySet2.count(), 1);
Item item2;
item2.setId(KRandom::random());
item2.setId(QRandomGenerator::global()->generate());
item2.setMimeType(KMime::Message::mimeType());
item2.setPayload<KMime::Message::Ptr>(msgPtr2);
......
......@@ -32,7 +32,7 @@
#include <kmbox/mbox.h>
#include <kmime/kmime_message.h>
#include <KRandom>
#include <QRandomGenerator>
#include <QTemporaryDir>
#include <QSignalSpy>
......@@ -159,7 +159,7 @@ void ItemDeleteTest::testMaildir()
Item item1;
item1.setMimeType(KMime::Message::mimeType());
item1.setId(KRandom::random());
item1.setId(QRandomGenerator::global()->generate());
item1.setRemoteId(*entrySet1.cbegin());
item1.setParentCollection(collection1);
......@@ -226,7 +226,7 @@ void ItemDeleteTest::testMBox()
Item item4;
item4.setMimeType(KMime::Message::mimeType());
item4.setId(KRandom::random());
item4.setId(QRandomGenerator::global()->generate());
item4.setRemoteId(QString::number(entryList1.value(3).messageOffset()));
item4.setParentCollection(collection1);
......@@ -291,7 +291,7 @@ void ItemDeleteTest::testMBox()
// again, file stays untouched, message still accessible through MBox, but item gone
Item item2;
item2.setMimeType(KMime::Message::mimeType());
item2.setId(KRandom::random());
item2.setId(QRandomGenerator::global()->generate());
item2.setRemoteId(QString::number(entryList1.value(1).messageOffset()));
item2.setParentCollection(collection1);
......@@ -408,7 +408,7 @@ void ItemDeleteTest::testCachePreservation()
Item item1;
item1.setMimeType(KMime::Message::mimeType());
item1.setId(KRandom::random());
item1.setId(QRandomGenerator::global()->generate());
item1.setRemoteId(*entrySet1.cbegin());
item1.setParentCollection(collection1);
......@@ -458,7 +458,7 @@ void ItemDeleteTest::testCachePreservation()
Item item2;
item2.setMimeType(KMime::Message::mimeType());
item2.setId(KRandom::random());
item2.setId(QRandomGenerator::global()->generate());
item2.setRemoteId(QString::number(entryList2.value(1).messageOffset()));
item2.setParentCollection(collection2);
......
......@@ -39,6 +39,7 @@
#include <QTemporaryDir>
#include <QTest>
#include <QRandomGenerator>
#include <QFileInfo>
#include <QDir>
#include <QCryptographicHash>
......@@ -166,7 +167,7 @@ void ItemModifyTest::testExpectedFail()
qint64 remoteId2;
do {
remoteId2 = KRandom::random();
remoteId2 = QRandomGenerator::global()->generate();
} while (entrySet2.contains(remoteId2));
Item item2;
......
......@@ -34,6 +34,7 @@
#include <KRandom>
#include <QTemporaryDir>
#include <QRandomGenerator>
#include <QTest>
#include <QFileInfo>
......@@ -161,7 +162,7 @@ void ItemMoveTest::testExpectedFail()
// test failure of moving from maildir to non-existent collection
Item item1;
item1.setId(KRandom::random());
item1.setId(QRandomGenerator::global()->generate());
item1.setRemoteId(*entrySet1.cbegin());
item1.setParentCollection(collection1);
......@@ -178,7 +179,7 @@ void ItemMoveTest::testExpectedFail()
collection2.setParentCollection(mStore->topLevelCollection());
Item item2;
item2.setId(KRandom::random());
item2.setId(QRandomGenerator::global()->generate());
item2.setRemoteId(QStringLiteral("0"));
item2.setParentCollection(collection2);
......@@ -226,7 +227,7 @@ void ItemMoveTest::testExpectedFail()
// test failure of moving a non-existent mbox entry
quint64 remoteId2;
do {
remoteId2 = KRandom::random();
remoteId2 = QRandomGenerator::global()->generate();
} while (entrySet2.contains(remoteId2));
item2.setRemoteId(QString::number(remoteId2));
......@@ -304,7 +305,7 @@ void ItemMoveTest::testMaildirItem()
collection3.setParentCollection(mStore->topLevelCollection());
Item item1;
item1.setId(KRandom::random());
item1.setId(QRandomGenerator::global()->generate());
item1.setRemoteId(*entrySet1.cbegin());
item1.setParentCollection(collection1);
......@@ -498,7 +499,7 @@ void ItemMoveTest::testMBoxItem()
collection3.setParentCollection(mStore->topLevelCollection());
Item item1;
item1.setId(KRandom::random());
item1.setId(QRandomGenerator::global()->generate());
item1.setRemoteId(QString::number(entryList1.first().messageOffset()));
item1.setParentCollection(collection1);
......
......@@ -34,6 +34,7 @@
#include "storecompactjob.h"
#include <KRandom>
#include <QRandomGenerator>
#include <QTest>
......@@ -290,7 +291,7 @@ void AbstractLocalStoreTest::testCreateCollection()
mStore->mLastProcessedJob = nullptr;
// test template check method
mStore->mErrorCode = KRandom::random() + 1;
mStore->mErrorCode = QRandomGenerator::global()->generate() + 1;
mStore->mErrorText = KRandom::randomString(10);
job = mStore->createCollection(collection, targetParent);
......@@ -357,7 +358,7 @@ void AbstractLocalStoreTest::testDeleteCollection()
mStore->mLastProcessedJob = nullptr;
// test template check method
mStore->mErrorCode = KRandom::random() + 1;
mStore->mErrorCode = QRandomGenerator::global()->generate() + 1;
mStore->mErrorText = KRandom::randomString(10);
job = mStore->deleteCollection(collection);
......@@ -411,7 +412,7 @@ void AbstractLocalStoreTest::testFetchCollection()
mStore->mLastProcessedJob = nullptr;
// test template check method
mStore->mErrorCode = KRandom::random() + 1;
mStore->mErrorCode = QRandomGenerator::global()->generate() + 1;
mStore->mErrorText = KRandom::randomString(10);
job = mStore->fetchCollections(collection);
......@@ -492,7 +493,7 @@ void AbstractLocalStoreTest::testModifyCollection()
mStore->mLastProcessedJob = nullptr;
// test template check method
mStore->mErrorCode = KRandom::random() + 1;
mStore->mErrorCode = QRandomGenerator::global()->generate() + 1;
mStore->mErrorText = KRandom::randomString(10);
job = mStore->modifyCollection(collection);
......@@ -571,7 +572,7 @@ void AbstractLocalStoreTest::testMoveCollection()
mStore->mLastProcessedJob = nullptr;
// test template check method
mStore->mErrorCode = KRandom::random() + 1;
mStore->mErrorCode = QRandomGenerator::global()->generate() + 1;
mStore->mErrorText = KRandom::randomString(10);
job = mStore->moveCollection(collection, targetParent);
......@@ -623,7 +624,7 @@ void AbstractLocalStoreTest::testFetchItems()
mStore->mLastProcessedJob = nullptr;
// test template check method
mStore->mErrorCode = KRandom::random() + 1;
mStore->mErrorCode = QRandomGenerator::global()->generate() + 1;
mStore->mErrorText = KRandom::randomString(10);
job = mStore->fetchItems(collection);
......@@ -677,7 +678,7 @@ void AbstractLocalStoreTest::testFetchItem()
mStore->mLastProcessedJob = nullptr;
// test template check method
mStore->mErrorCode = KRandom::random() + 1;
mStore->mErrorCode = QRandomGenerator::global()->generate() + 1;
mStore->mErrorText = KRandom::randomString(10);
job = mStore->fetchItem(item);
......@@ -731,7 +732,7 @@ void AbstractLocalStoreTest::testCreateItem()
mStore->mLastProcessedJob = nullptr;
// test template check method
mStore->mErrorCode = KRandom::random() + 1;
mStore->mErrorCode = QRandomGenerator::global()->generate() + 1;
mStore->mErrorText = KRandom::randomString(10);
job = mStore->createItem(Item(), collection);
......@@ -785,7 +786,7 @@ void AbstractLocalStoreTest::testDeleteItem()
mStore->mLastProcessedJob = nullptr;
// test template check method
mStore->mErrorCode = KRandom::random() + 1;
mStore->mErrorCode = QRandomGenerator::global()->generate() + 1;
mStore->mErrorText = KRandom::randomString(10);
job = mStore->deleteItem(item);
......@@ -839,7 +840,7 @@ void AbstractLocalStoreTest::testModifyItem()
mStore->mLastProcessedJob = nullptr;
// test template check method
mStore->mErrorCode = KRandom::random() + 1;
mStore->mErrorCode = QRandomGenerator::global()->generate() + 1;
mStore->mErrorText = KRandom::randomString(10);
job = mStore->modifyItem(item);
......@@ -918,7 +919,7 @@ void AbstractLocalStoreTest::testMoveItem()
mStore->mLastProcessedJob = nullptr;
// test template check method
mStore->mErrorCode = KRandom::random() + 1;
mStore->mErrorCode = QRandomGenerator::global()->generate() + 1;
mStore->mErrorText = KRandom::randomString(10);
job = mStore->moveItem(item, targetParent);
......@@ -958,7 +959,7 @@ void AbstractLocalStoreTest::testCompactStore()
mStore->mLastProcessedJob = nullptr;
// test template check method
mStore->mErrorCode = KRandom::random() + 1;
mStore->mErrorCode = QRandomGenerator::global()->generate() + 1;
mStore->mErrorText = KRandom::randomString(10);
job = mStore->compactStore();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment