Merge pull request #1770 from pasdam/feature/useQuuid

Replaced Uuid with QUuid
This commit is contained in:
Jonathan White
2018-07-08 20:32:54 -04:00
committed by GitHub
53 changed files with 438 additions and 645 deletions

View File

@@ -38,7 +38,7 @@ void TestDeletedObjects::createAndDelete(Database* db, int delObjectsSize)
Group* g = new Group();
g->setParent(root);
Uuid gUuid = Uuid::random();
QUuid gUuid = QUuid::createUuid();
g->setUuid(gUuid);
delete g;
QCOMPARE(db->deletedObjects().size(), ++delObjectsSize);
@@ -47,19 +47,19 @@ void TestDeletedObjects::createAndDelete(Database* db, int delObjectsSize)
Group* g1 = new Group();
g1->setParent(root);
Uuid g1Uuid = Uuid::random();
QUuid g1Uuid = QUuid::createUuid();
g1->setUuid(g1Uuid);
Entry* e1 = new Entry();
e1->setGroup(g1);
Uuid e1Uuid = Uuid::random();
QUuid e1Uuid = QUuid::createUuid();
e1->setUuid(e1Uuid);
Group* g2 = new Group();
g2->setParent(g1);
Uuid g2Uuid = Uuid::random();
QUuid g2Uuid = QUuid::createUuid();
g2->setUuid(g2Uuid);
Entry* e2 = new Entry();
e2->setGroup(g2);
Uuid e2Uuid = Uuid::random();
QUuid e2Uuid = QUuid::createUuid();
e2->setUuid(e2Uuid);
delete g1;
@@ -74,7 +74,7 @@ void TestDeletedObjects::createAndDelete(Database* db, int delObjectsSize)
Entry* e3 = new Entry();
e3->setGroup(root);
Uuid e3Uuid = Uuid::random();
QUuid e3Uuid = QUuid::createUuid();
e3->setUuid(e3Uuid);
delete e3;
@@ -132,11 +132,11 @@ void TestDeletedObjects::testDatabaseChange()
Group* g1 = new Group();
g1->setParent(root);
Uuid g1Uuid = Uuid::random();
QUuid g1Uuid = QUuid::createUuid();
g1->setUuid(g1Uuid);
Entry* e1 = new Entry();
e1->setGroup(g1);
Uuid e1Uuid = Uuid::random();
QUuid e1Uuid = QUuid::createUuid();
e1->setUuid(e1Uuid);
g1->setParent(root2);

View File

@@ -82,7 +82,7 @@ void TestEntry::testCopyDataFrom()
void TestEntry::testClone()
{
QScopedPointer<Entry> entryOrg(new Entry());
entryOrg->setUuid(Uuid::random());
entryOrg->setUuid(QUuid::createUuid());
entryOrg->setTitle("Original Title");
entryOrg->beginUpdate();
entryOrg->setTitle("New Title");
@@ -205,7 +205,7 @@ void TestEntry::testResolveRecursivePlaceholders()
auto* entry1 = new Entry();
entry1->setGroup(root);
entry1->setUuid(Uuid::random());
entry1->setUuid(QUuid::createUuid());
entry1->setTitle("{USERNAME}");
entry1->setUsername("{PASSWORD}");
entry1->setPassword("{URL}");
@@ -215,10 +215,10 @@ void TestEntry::testResolveRecursivePlaceholders()
auto* entry2 = new Entry();
entry2->setGroup(root);
entry2->setUuid(Uuid::random());
entry2->setUuid(QUuid::createUuid());
entry2->setTitle("Entry2Title");
entry2->setUsername("{S:CustomUserNameAttribute}");
entry2->setPassword(QString("{REF:P@I:%1}").arg(entry1->uuid().toHex()));
entry2->setPassword(QString("{REF:P@I:%1}").arg(QString(entry1->uuid().toRfc4122().toHex())));
entry2->setUrl("http://{S:IpAddress}:{S:Port}/{S:Uri}");
entry2->attributes()->set("CustomUserNameAttribute", "CustomUserNameValue");
entry2->attributes()->set("IpAddress", "127.0.0.1");
@@ -227,11 +227,11 @@ void TestEntry::testResolveRecursivePlaceholders()
auto* entry3 = new Entry();
entry3->setGroup(root);
entry3->setUuid(Uuid::random());
entry3->setTitle(QString("{REF:T@I:%1}").arg(entry2->uuid().toHex()));
entry3->setUsername(QString("{REF:U@I:%1}").arg(entry2->uuid().toHex()));
entry3->setPassword(QString("{REF:P@I:%1}").arg(entry2->uuid().toHex()));
entry3->setUrl(QString("{REF:A@I:%1}").arg(entry2->uuid().toHex()));
entry3->setUuid(QUuid::createUuid());
entry3->setTitle(QString("{REF:T@I:%1}").arg(QString(entry2->uuid().toRfc4122().toHex())));
entry3->setUsername(QString("{REF:U@I:%1}").arg(QString(entry2->uuid().toRfc4122().toHex())));
entry3->setPassword(QString("{REF:P@I:%1}").arg(QString(entry2->uuid().toRfc4122().toHex())));
entry3->setUrl(QString("{REF:A@I:%1}").arg(QString(entry2->uuid().toRfc4122().toHex())));
QCOMPARE(entry3->resolveMultiplePlaceholders(entry3->title()), QString("Entry2Title"));
QCOMPARE(entry3->resolveMultiplePlaceholders(entry3->username()), QString("CustomUserNameValue"));
@@ -240,11 +240,11 @@ void TestEntry::testResolveRecursivePlaceholders()
auto* entry4 = new Entry();
entry4->setGroup(root);
entry4->setUuid(Uuid::random());
entry4->setTitle(QString("{REF:T@I:%1}").arg(entry3->uuid().toHex()));
entry4->setUsername(QString("{REF:U@I:%1}").arg(entry3->uuid().toHex()));
entry4->setPassword(QString("{REF:P@I:%1}").arg(entry3->uuid().toHex()));
entry4->setUrl(QString("{REF:A@I:%1}").arg(entry3->uuid().toHex()));
entry4->setUuid(QUuid::createUuid());
entry4->setTitle(QString("{REF:T@I:%1}").arg(QString(entry3->uuid().toRfc4122().toHex())));
entry4->setUsername(QString("{REF:U@I:%1}").arg(QString(entry3->uuid().toRfc4122().toHex())));
entry4->setPassword(QString("{REF:P@I:%1}").arg(QString(entry3->uuid().toRfc4122().toHex())));
entry4->setUrl(QString("{REF:A@I:%1}").arg(QString(entry3->uuid().toRfc4122().toHex())));
QCOMPARE(entry4->resolveMultiplePlaceholders(entry4->title()), QString("Entry2Title"));
QCOMPARE(entry4->resolveMultiplePlaceholders(entry4->username()), QString("CustomUserNameValue"));
@@ -253,7 +253,7 @@ void TestEntry::testResolveRecursivePlaceholders()
auto* entry5 = new Entry();
entry5->setGroup(root);
entry5->setUuid(Uuid::random());
entry5->setUuid(QUuid::createUuid());
entry5->attributes()->set("Scheme", "http");
entry5->attributes()->set("Host", "host.org");
entry5->attributes()->set("Port", "2017");
@@ -271,8 +271,8 @@ void TestEntry::testResolveRecursivePlaceholders()
auto* entry6 = new Entry();
entry6->setGroup(root);
entry6->setUuid(Uuid::random());
entry6->setTitle(QString("{REF:T@I:%1}").arg(entry3->uuid().toHex()));
entry6->setUuid(QUuid::createUuid());
entry6->setTitle(QString("{REF:T@I:%1}").arg(QString(entry3->uuid().toRfc4122().toHex())));
entry6->setUsername(QString("{TITLE}"));
entry6->setPassword(QString("{PASSWORD}"));
@@ -282,8 +282,8 @@ void TestEntry::testResolveRecursivePlaceholders()
auto* entry7 = new Entry();
entry7->setGroup(root);
entry7->setUuid(Uuid::random());
entry7->setTitle(QString("{REF:T@I:%1} and something else").arg(entry3->uuid().toHex()));
entry7->setUuid(QUuid::createUuid());
entry7->setTitle(QString("{REF:T@I:%1} and something else").arg(QString(entry3->uuid().toRfc4122().toHex())));
entry7->setUsername(QString("{TITLE}"));
entry7->setPassword(QString("PASSWORD"));
@@ -299,7 +299,7 @@ void TestEntry::testResolveReferencePlaceholders()
auto* entry1 = new Entry();
entry1->setGroup(root);
entry1->setUuid(Uuid::random());
entry1->setUuid(QUuid::createUuid());
entry1->setTitle("Title1");
entry1->setUsername("Username1");
entry1->setPassword("Password1");
@@ -311,7 +311,7 @@ void TestEntry::testResolveReferencePlaceholders()
group->setParent(root);
auto* entry2 = new Entry();
entry2->setGroup(group);
entry2->setUuid(Uuid::random());
entry2->setUuid(QUuid::createUuid());
entry2->setTitle("Title2");
entry2->setUsername("Username2");
entry2->setPassword("Password2");
@@ -321,7 +321,7 @@ void TestEntry::testResolveReferencePlaceholders()
auto* entry3 = new Entry();
entry3->setGroup(group);
entry3->setUuid(Uuid::random());
entry3->setUuid(QUuid::createUuid());
entry3->setTitle("{S:AttributeTitle}");
entry3->setUsername("{S:AttributeUsername}");
entry3->setPassword("{S:AttributePassword}");
@@ -335,9 +335,9 @@ void TestEntry::testResolveReferencePlaceholders()
auto* tstEntry = new Entry();
tstEntry->setGroup(root);
tstEntry->setUuid(Uuid::random());
tstEntry->setUuid(QUuid::createUuid());
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@I:%1}").arg(entry1->uuid().toHex())),
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@I:%1}").arg(QString(entry1->uuid().toRfc4122().toHex()))),
entry1->title());
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@T:%1}").arg(entry1->title())), entry1->title());
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@U:%1}").arg(entry1->username())), entry1->title());
@@ -348,7 +348,7 @@ void TestEntry::testResolveReferencePlaceholders()
QString("{REF:T@O:%1}").arg(entry1->attributes()->value("CustomAttribute1"))),
entry1->title());
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@I:%1}").arg(entry1->uuid().toHex())),
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@I:%1}").arg(QString(entry1->uuid().toRfc4122().toHex()))),
entry1->title());
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@T:%1}").arg(entry1->title())), entry1->title());
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:U@U:%1}").arg(entry1->username())),
@@ -358,7 +358,7 @@ void TestEntry::testResolveReferencePlaceholders()
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:A@A:%1}").arg(entry1->url())), entry1->url());
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:N@N:%1}").arg(entry1->notes())), entry1->notes());
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@I:%1}").arg(entry2->uuid().toHex())),
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@I:%1}").arg(QString(entry2->uuid().toRfc4122().toHex()))),
entry2->title());
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@T:%1}").arg(entry2->title())), entry2->title());
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@U:%1}").arg(entry2->username())), entry2->title());
@@ -377,38 +377,23 @@ void TestEntry::testResolveReferencePlaceholders()
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:A@A:%1}").arg(entry2->url())), entry2->url());
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:N@N:%1}").arg(entry2->notes())), entry2->notes());
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@I:%1}").arg(entry3->uuid().toHex())),
entry3->attributes()->value("AttributeTitle"));
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:U@I:%1}").arg(entry3->uuid().toHex())),
entry3->attributes()->value("AttributeUsername"));
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:P@I:%1}").arg(entry3->uuid().toHex())),
entry3->attributes()->value("AttributePassword"));
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:A@I:%1}").arg(entry3->uuid().toHex())),
entry3->attributes()->value("AttributeUrl"));
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:N@I:%1}").arg(entry3->uuid().toHex())),
entry3->attributes()->value("AttributeNotes"));
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@I:%1}").arg(QString(entry3->uuid().toRfc4122().toHex()))), entry3->attributes()->value("AttributeTitle"));
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:U@I:%1}").arg(QString(entry3->uuid().toRfc4122().toHex()))), entry3->attributes()->value("AttributeUsername"));
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:P@I:%1}").arg(QString(entry3->uuid().toRfc4122().toHex()))), entry3->attributes()->value("AttributePassword"));
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:A@I:%1}").arg(QString(entry3->uuid().toRfc4122().toHex()))), entry3->attributes()->value("AttributeUrl"));
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:N@I:%1}").arg(QString(entry3->uuid().toRfc4122().toHex()))), entry3->attributes()->value("AttributeNotes"));
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@I:%1}").arg(entry3->uuid().toHex().toUpper())),
entry3->attributes()->value("AttributeTitle"));
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:U@I:%1}").arg(entry3->uuid().toHex().toUpper())),
entry3->attributes()->value("AttributeUsername"));
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:P@I:%1}").arg(entry3->uuid().toHex().toUpper())),
entry3->attributes()->value("AttributePassword"));
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:A@I:%1}").arg(entry3->uuid().toHex().toUpper())),
entry3->attributes()->value("AttributeUrl"));
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:N@I:%1}").arg(entry3->uuid().toHex().toUpper())),
entry3->attributes()->value("AttributeNotes"));
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:T@I:%1}").arg(QString(entry3->uuid().toRfc4122().toHex().toUpper()))), entry3->attributes()->value("AttributeTitle"));
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:U@I:%1}").arg(QString(entry3->uuid().toRfc4122().toHex().toUpper()))), entry3->attributes()->value("AttributeUsername"));
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:P@I:%1}").arg(QString(entry3->uuid().toRfc4122().toHex().toUpper()))), entry3->attributes()->value("AttributePassword"));
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:A@I:%1}").arg(QString(entry3->uuid().toRfc4122().toHex().toUpper()))), entry3->attributes()->value("AttributeUrl"));
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:N@I:%1}").arg(QString(entry3->uuid().toRfc4122().toHex().toUpper()))), entry3->attributes()->value("AttributeNotes"));
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:t@i:%1}").arg(entry3->uuid().toHex().toLower())),
entry3->attributes()->value("AttributeTitle"));
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:u@i:%1}").arg(entry3->uuid().toHex().toLower())),
entry3->attributes()->value("AttributeUsername"));
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:p@i:%1}").arg(entry3->uuid().toHex().toLower())),
entry3->attributes()->value("AttributePassword"));
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:a@i:%1}").arg(entry3->uuid().toHex().toLower())),
entry3->attributes()->value("AttributeUrl"));
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:n@i:%1}").arg(entry3->uuid().toHex().toLower())),
entry3->attributes()->value("AttributeNotes"));
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:t@i:%1}").arg(QString(entry3->uuid().toRfc4122().toHex().toLower()))), entry3->attributes()->value("AttributeTitle"));
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:u@i:%1}").arg(QString(entry3->uuid().toRfc4122().toHex().toLower()))), entry3->attributes()->value("AttributeUsername"));
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:p@i:%1}").arg(QString(entry3->uuid().toRfc4122().toHex().toLower()))), entry3->attributes()->value("AttributePassword"));
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:a@i:%1}").arg(QString(entry3->uuid().toRfc4122().toHex().toLower()))), entry3->attributes()->value("AttributeUrl"));
QCOMPARE(tstEntry->resolveMultiplePlaceholders(QString("{REF:n@i:%1}").arg(QString(entry3->uuid().toRfc4122().toHex().toLower()))), entry3->attributes()->value("AttributeNotes"));
}
void TestEntry::testResolveNonIdPlaceholdersToUuid()
@@ -419,27 +404,27 @@ void TestEntry::testResolveNonIdPlaceholdersToUuid()
auto* referencedEntryTitle = new Entry();
referencedEntryTitle->setGroup(root);
referencedEntryTitle->setTitle("myTitle");
referencedEntryTitle->setUuid(Uuid::random());
referencedEntryTitle->setUuid(QUuid::createUuid());
auto* referencedEntryUsername = new Entry();
referencedEntryUsername->setGroup(root);
referencedEntryUsername->setUsername("myUser");
referencedEntryUsername->setUuid(Uuid::random());
referencedEntryUsername->setUuid(QUuid::createUuid());
auto* referencedEntryPassword = new Entry();
referencedEntryPassword->setGroup(root);
referencedEntryPassword->setPassword("myPassword");
referencedEntryPassword->setUuid(Uuid::random());
referencedEntryPassword->setUuid(QUuid::createUuid());
auto* referencedEntryUrl = new Entry();
referencedEntryUrl->setGroup(root);
referencedEntryUrl->setUrl("myUrl");
referencedEntryUrl->setUuid(Uuid::random());
referencedEntryUrl->setUuid(QUuid::createUuid());
auto* referencedEntryNotes = new Entry();
referencedEntryNotes->setGroup(root);
referencedEntryNotes->setNotes("myNotes");
referencedEntryNotes->setUuid(Uuid::random());
referencedEntryNotes->setUuid(QUuid::createUuid());
const QList<QChar> placeholders{'T', 'U', 'P', 'A', 'N'};
for (const QChar& searchIn : placeholders) {
@@ -475,8 +460,9 @@ void TestEntry::testResolveNonIdPlaceholdersToUuid()
newEntry->setGroup(root);
newEntry->setNotes(newEntryNotesRaw);
const QString newEntryNotesResolved = newEntry->resolveMultiplePlaceholders(newEntry->notes());
QCOMPARE(newEntryNotesResolved, QString(referencedEntry->uuid().toHex()));
const QString newEntryNotesResolved =
newEntry->resolveMultiplePlaceholders(newEntry->notes());
QCOMPARE(newEntryNotesResolved, QString(referencedEntry->uuid().toRfc4122().toHex()));
}
}
@@ -487,7 +473,7 @@ void TestEntry::testResolveClonedEntry()
auto* original = new Entry();
original->setGroup(root);
original->setUuid(Uuid::random());
original->setUuid(QUuid::createUuid());
original->setTitle("Title");
original->setUsername("SomeUsername");
original->setPassword("SomePassword");

View File

@@ -217,15 +217,14 @@ void TestEntryModel::testCustomIconModel()
QCOMPARE(model->rowCount(), 0);
QHash<Uuid, QPixmap> icons;
QList<Uuid> iconsOrder;
QHash<QUuid, QPixmap> icons;
QList<QUuid> iconsOrder;
Uuid iconUuid(QByteArray(16, '2'));
QUuid iconUuid = QUuid::fromRfc4122(QByteArray(16, '2'));
icons.insert(iconUuid, QPixmap());
iconsOrder << iconUuid;
Uuid iconUuid2(QByteArray(16, '1'));
QImage icon2;
QUuid iconUuid2 = QUuid::fromRfc4122(QByteArray(16, '1'));
icons.insert(iconUuid2, QPixmap());
iconsOrder << iconUuid2;

View File

@@ -19,22 +19,13 @@
#define KEEPASSXC_TESTGLOBAL_H
#include "core/Group.h"
#include "core/Uuid.h"
#include <QDateTime>
#include <QTest>
namespace QTest
{
template <> inline char* toString(const Uuid& uuid)
{
QByteArray ba = "Uuid(";
ba += uuid.toHex().toLatin1().constData();
ba += ")";
return qstrdup(ba.constData());
}
template <> inline char* toString(const Group::TriState& triState)
{
QString value;

View File

@@ -93,7 +93,7 @@ void TestGroup::testParenting()
g4->setName("test");
g3->setName("test");
g1->setName("test");
g3->setIcon(Uuid::random());
g3->setIcon(QUuid::createUuid());
g1->setIcon(2);
QCOMPARE(spy.count(), 6);
delete db;
@@ -293,12 +293,12 @@ void TestGroup::testCopyCustomIcon()
{
QScopedPointer<Database> dbSource(new Database());
Uuid groupIconUuid = Uuid::random();
QUuid groupIconUuid = QUuid::createUuid();
QImage groupIcon(16, 16, QImage::Format_RGB32);
groupIcon.setPixel(0, 0, qRgb(255, 0, 0));
dbSource->metadata()->addCustomIcon(groupIconUuid, groupIcon);
Uuid entryIconUuid = Uuid::random();
QUuid entryIconUuid = QUuid::createUuid();
QImage entryIcon(16, 16, QImage::Format_RGB32);
entryIcon.setPixel(0, 0, qRgb(255, 0, 0));
dbSource->metadata()->addCustomIcon(entryIconUuid, entryIcon);
@@ -412,25 +412,25 @@ void TestGroup::testCopyCustomIcons()
QScopedPointer<Group> group1(new Group());
group1->setParent(dbSource->rootGroup());
Uuid group1Icon = Uuid::random();
QUuid group1Icon = QUuid::createUuid();
dbSource->metadata()->addCustomIcon(group1Icon, iconImage1);
group1->setIcon(group1Icon);
QScopedPointer<Group> group2(new Group());
group2->setParent(group1.data());
Uuid group2Icon = Uuid::random();
QUuid group2Icon = QUuid::createUuid();
dbSource->metadata()->addCustomIcon(group2Icon, iconImage1);
group2->setIcon(group2Icon);
QScopedPointer<Entry> entry1(new Entry());
entry1->setGroup(group2.data());
Uuid entry1IconOld = Uuid::random();
QUuid entry1IconOld = QUuid::createUuid();
dbSource->metadata()->addCustomIcon(entry1IconOld, iconImage1);
entry1->setIcon(entry1IconOld);
// add history item
entry1->beginUpdate();
Uuid entry1IconNew = Uuid::random();
QUuid entry1IconNew = QUuid::createUuid();
dbSource->metadata()->addCustomIcon(entry1IconNew, iconImage1);
entry1->setIcon(entry1IconNew);
entry1->endUpdate();
@@ -459,7 +459,7 @@ void TestGroup::testFindEntry()
Entry* entry1 = new Entry();
entry1->setTitle(QString("entry1"));
entry1->setGroup(db->rootGroup());
entry1->setUuid(Uuid::random());
entry1->setUuid(QUuid::createUuid());
Group* group1 = new Group();
group1->setName("group1");
@@ -468,13 +468,13 @@ void TestGroup::testFindEntry()
entry2->setTitle(QString("entry2"));
entry2->setGroup(group1);
entry2->setUuid(Uuid::random());
entry2->setUuid(QUuid::createUuid());
group1->setParent(db->rootGroup());
Entry* entry;
entry = db->rootGroup()->findEntry(entry1->uuid().toHex());
entry = db->rootGroup()->findEntry(entry1->uuid().toRfc4122().toHex());
QVERIFY(entry != nullptr);
QCOMPARE(entry->title(), QString("entry1"));
@@ -491,7 +491,7 @@ void TestGroup::testFindEntry()
entry = db->rootGroup()->findEntry(QString("//entry1"));
QVERIFY(entry == nullptr);
entry = db->rootGroup()->findEntry(entry2->uuid().toHex());
entry = db->rootGroup()->findEntry(entry2->uuid().toRfc4122().toHex());
QVERIFY(entry != nullptr);
QCOMPARE(entry->title(), QString("entry2"));
@@ -602,7 +602,7 @@ void TestGroup::testPrint()
Entry* entry1 = new Entry();
entry1->setTitle(QString("entry1"));
entry1->setGroup(db->rootGroup());
entry1->setUuid(Uuid::random());
entry1->setUuid(QUuid::createUuid());
output = db->rootGroup()->print();
QCOMPARE(output, QString("entry1\n"));
@@ -614,7 +614,7 @@ void TestGroup::testPrint()
entry2->setTitle(QString("entry2"));
entry2->setGroup(group1);
entry2->setUuid(Uuid::random());
entry2->setUuid(QUuid::createUuid());
group1->setParent(db->rootGroup());

View File

@@ -71,7 +71,7 @@ void TestKdbx2::testFormat200()
QScopedPointer<Database> db(reader.readDatabase(filename, key));
QCOMPARE(reader.version(), KeePass2::FILE_VERSION_2 & KeePass2::FILE_VERSION_CRITICAL_MASK);
QVERIFY(!reader.hasError());
QVERIFY2(!reader.hasError(), reader.errorString().toStdString().c_str());
verifyKdbx2Db(db.data());
}
@@ -82,6 +82,8 @@ void TestKdbx2::testFormat200Upgrade()
key.addKey(PasswordKey("a"));
KeePass2Reader reader;
QScopedPointer<Database> db(reader.readDatabase(filename, key));
QVERIFY2(!reader.hasError(), reader.errorString().toStdString().c_str());
QVERIFY(!db.isNull());
QCOMPARE(reader.version(), KeePass2::FILE_VERSION_2 & KeePass2::FILE_VERSION_CRITICAL_MASK);
QCOMPARE(db->kdf()->uuid(), KeePass2::KDF_AES_KDBX3);

View File

@@ -109,7 +109,7 @@ void TestKdbx4::writeKdbx(QIODevice* device, Database* db, bool& hasError, QStri
QCOMPARE(writer.version(), KeePass2::FILE_VERSION_4);
}
Q_DECLARE_METATYPE(Uuid);
Q_DECLARE_METATYPE(QUuid)
void TestKdbx4::testFormat400()
{
QString filename = QString(KEEPASSX_TEST_DATA_DIR).append("/Format400.kdbx");
@@ -136,8 +136,8 @@ void TestKdbx4::testFormat400()
void TestKdbx4::testFormat400Upgrade()
{
QFETCH(Uuid, kdfUuid);
QFETCH(Uuid, cipherUuid);
QFETCH(QUuid, kdfUuid);
QFETCH(QUuid, cipherUuid);
QFETCH(bool, addCustomData);
QFETCH(quint32, expectedVersion);
@@ -191,8 +191,8 @@ void TestKdbx4::testFormat400Upgrade()
// clang-format off
void TestKdbx4::testFormat400Upgrade_data()
{
QTest::addColumn<Uuid>("kdfUuid");
QTest::addColumn<Uuid>("cipherUuid");
QTest::addColumn<QUuid>("kdfUuid");
QTest::addColumn<QUuid>("cipherUuid");
QTest::addColumn<bool>("addCustomData");
QTest::addColumn<quint32>("expectedVersion");
@@ -265,20 +265,20 @@ void TestKdbx4::testUpgradeMasterKeyIntegrity()
} else if (upgradeAction == "group-customdata") {
auto group = new Group();
group->setParent(db->rootGroup());
group->setUuid(Uuid::random());
group->setUuid(QUuid::createUuid());
group->customData()->set("abc", "def");
} else if (upgradeAction == "rootentry-customdata") {
auto entry = new Entry();
entry->setGroup(db->rootGroup());
entry->setUuid(Uuid::random());
entry->setUuid(QUuid::createUuid());
entry->customData()->set("abc", "def");
} else if (upgradeAction == "entry-customdata") {
auto group = new Group();
group->setParent(db->rootGroup());
group->setUuid(Uuid::random());
group->setUuid(QUuid::createUuid());
auto entry = new Entry();
entry->setGroup(group);
entry->setUuid(Uuid::random());
entry->setUuid(QUuid::createUuid());
entry->customData()->set("abc", "def");
} else {
QFAIL(qPrintable(QString("Unknown action: %s").arg(upgradeAction)));
@@ -362,14 +362,14 @@ void TestKdbx4::testCustomData()
// test copied custom group data
auto* group = new Group();
group->setParent(root);
group->setUuid(Uuid::random());
group->setUuid(QUuid::createUuid());
group->customData()->copyDataFrom(root->customData());
QCOMPARE(*group->customData(), *root->customData());
// test copied custom entry data
auto* entry = new Entry();
entry->setGroup(group);
entry->setUuid(Uuid::random());
entry->setUuid(QUuid::createUuid());
entry->customData()->copyDataFrom(group->customData());
QCOMPARE(*entry->customData(), *root->customData());

View File

@@ -47,18 +47,18 @@ void TestKeePass2Format::initTestCase()
m_kdbxSourceDb->setKey(key);
m_kdbxSourceDb->metadata()->setName("TESTDB");
Group* group = m_kdbxSourceDb->rootGroup();
group->setUuid(Uuid::random());
group->setUuid(QUuid::createUuid());
group->setNotes("I'm a note!");
auto entry = new Entry();
entry->setPassword(QString::fromUtf8("\xc3\xa4\xa3\xb6\xc3\xbc\xe9\x9b\xbb\xe7\xb4\x85"));
entry->setUuid(Uuid::random());
entry->setUuid(QUuid::createUuid());
entry->attributes()->set("test", "protectedTest", true);
QVERIFY(entry->attributes()->isProtected("test"));
entry->attachments()->set("myattach.txt", QByteArray("this is an attachment"));
entry->attachments()->set("aaa.txt", QByteArray("also an attachment"));
entry->setGroup(group);
auto groupNew = new Group();
groupNew->setUuid(Uuid::random());
groupNew->setUuid(QUuid::createUuid());
groupNew->setName("TESTGROUP");
groupNew->setNotes("I'm a sub group note!");
groupNew->setParent(group);
@@ -108,7 +108,7 @@ void TestKeePass2Format::testXmlMetadata()
void TestKeePass2Format::testXmlCustomIcons()
{
QCOMPARE(m_xmlDb->metadata()->customIcons().size(), 1);
Uuid uuid = Uuid::fromBase64("++vyI+daLk6omox4a6kQGA==");
QUuid uuid = QUuid::fromRfc4122(QByteArray::fromBase64("++vyI+daLk6omox4a6kQGA=="));
QVERIFY(m_xmlDb->metadata()->customIcons().contains(uuid));
QImage icon = m_xmlDb->metadata()->customIcon(uuid);
QCOMPARE(icon.width(), 16);
@@ -128,11 +128,11 @@ void TestKeePass2Format::testXmlGroupRoot()
{
const Group* group = m_xmlDb->rootGroup();
QVERIFY(group);
QCOMPARE(group->uuid().toBase64(), QString("lmU+9n0aeESKZvcEze+bRg=="));
QCOMPARE(group->uuid(), QUuid::fromRfc4122(QByteArray::fromBase64("lmU+9n0aeESKZvcEze+bRg==")));
QCOMPARE(group->name(), QString("NewDatabase"));
QCOMPARE(group->notes(), QString(""));
QCOMPARE(group->iconNumber(), 49);
QCOMPARE(group->iconUuid(), Uuid());
QCOMPARE(group->iconUuid(), QUuid());
QVERIFY(group->isExpanded());
TimeInfo ti = group->timeInfo();
QCOMPARE(ti.lastModificationTime(), Test::datetime(2010, 8, 8, 17, 24, 27));
@@ -145,7 +145,7 @@ void TestKeePass2Format::testXmlGroupRoot()
QCOMPARE(group->defaultAutoTypeSequence(), QString(""));
QCOMPARE(group->autoTypeEnabled(), Group::Inherit);
QCOMPARE(group->searchingEnabled(), Group::Inherit);
QCOMPARE(group->lastTopVisibleEntry()->uuid().toBase64(), QString("+wSUOv6qf0OzW8/ZHAs2sA=="));
QCOMPARE(group->lastTopVisibleEntry()->uuid(), QUuid::fromRfc4122(QByteArray::fromBase64("+wSUOv6qf0OzW8/ZHAs2sA==")));
QCOMPARE(group->children().size(), 3);
QVERIFY(m_xmlDb->metadata()->recycleBin() == m_xmlDb->rootGroup()->children().at(2));
@@ -156,11 +156,11 @@ void TestKeePass2Format::testXmlGroup1()
{
const Group* group = m_xmlDb->rootGroup()->children().at(0);
QCOMPARE(group->uuid().toBase64(), QString("AaUYVdXsI02h4T1RiAlgtg=="));
QCOMPARE(group->uuid(), QUuid::fromRfc4122(QByteArray::fromBase64("AaUYVdXsI02h4T1RiAlgtg==")));
QCOMPARE(group->name(), QString("General"));
QCOMPARE(group->notes(), QString("Group Notez"));
QCOMPARE(group->iconNumber(), 48);
QCOMPARE(group->iconUuid(), Uuid());
QCOMPARE(group->iconUuid(), QUuid());
QCOMPARE(group->isExpanded(), true);
QCOMPARE(group->defaultAutoTypeSequence(), QString("{Password}{ENTER}"));
QCOMPARE(group->autoTypeEnabled(), Group::Enable);
@@ -172,19 +172,19 @@ void TestKeePass2Format::testXmlGroup2()
{
const Group* group = m_xmlDb->rootGroup()->children().at(1);
QCOMPARE(group->uuid().toBase64(), QString("1h4NtL5DK0yVyvaEnN//4A=="));
QCOMPARE(group->uuid(), QUuid::fromRfc4122(QByteArray::fromBase64("1h4NtL5DK0yVyvaEnN//4A==")));
QCOMPARE(group->name(), QString("Windows"));
QCOMPARE(group->isExpanded(), false);
QCOMPARE(group->children().size(), 1);
const Group* child = group->children().first();
QCOMPARE(child->uuid().toBase64(), QString("HoYE/BjLfUSW257pCHJ/eA=="));
QCOMPARE(child->uuid(), QUuid::fromRfc4122(QByteArray::fromBase64("HoYE/BjLfUSW257pCHJ/eA==")));
QCOMPARE(child->name(), QString("Subsub"));
QCOMPARE(child->entries().size(), 1);
const Entry* entry = child->entries().first();
QCOMPARE(entry->uuid().toBase64(), QString("GZpdQvGXOU2kaKRL/IVAGg=="));
QCOMPARE(entry->uuid(), QUuid::fromRfc4122(QByteArray::fromBase64("GZpdQvGXOU2kaKRL/IVAGg==")));
QCOMPARE(entry->title(), QString("Subsub Entry"));
}
@@ -192,10 +192,10 @@ void TestKeePass2Format::testXmlEntry1()
{
const Entry* entry = m_xmlDb->rootGroup()->entries().at(0);
QCOMPARE(entry->uuid().toBase64(), QString("+wSUOv6qf0OzW8/ZHAs2sA=="));
QCOMPARE(entry->uuid(), QUuid::fromRfc4122(QByteArray::fromBase64("+wSUOv6qf0OzW8/ZHAs2sA==")));
QCOMPARE(entry->historyItems().size(), 2);
QCOMPARE(entry->iconNumber(), 0);
QCOMPARE(entry->iconUuid(), Uuid());
QCOMPARE(entry->iconUuid(), QUuid());
QVERIFY(!entry->foregroundColor().isValid());
QVERIFY(!entry->backgroundColor().isValid());
QCOMPARE(entry->overrideUrl(), QString(""));
@@ -254,9 +254,9 @@ void TestKeePass2Format::testXmlEntry2()
{
const Entry* entry = m_xmlDb->rootGroup()->entries().at(1);
QCOMPARE(entry->uuid().toBase64(), QString("4jbADG37hkiLh2O0qUdaOQ=="));
QCOMPARE(entry->uuid(), QUuid::fromRfc4122(QByteArray::fromBase64("4jbADG37hkiLh2O0qUdaOQ==")));
QCOMPARE(entry->iconNumber(), 0);
QCOMPARE(entry->iconUuid().toBase64(), QString("++vyI+daLk6omox4a6kQGA=="));
QCOMPARE(entry->iconUuid(), QUuid::fromRfc4122(QByteArray::fromBase64("++vyI+daLk6omox4a6kQGA==")));
// TODO: test entry->icon()
QCOMPARE(entry->foregroundColor(), QColor(255, 0, 0));
QCOMPARE(entry->backgroundColor(), QColor(255, 255, 0));
@@ -330,11 +330,11 @@ void TestKeePass2Format::testXmlDeletedObjects()
DeletedObject delObj;
delObj = objList.takeFirst();
QCOMPARE(delObj.uuid.toBase64(), QString("5K/bzWCSmkCv5OZxYl4N/w=="));
QCOMPARE(delObj.uuid, QUuid::fromRfc4122(QByteArray::fromBase64("5K/bzWCSmkCv5OZxYl4N/w==")));
QCOMPARE(delObj.deletionTime, Test::datetime(2010, 8, 25, 16, 14, 12));
delObj = objList.takeFirst();
QCOMPARE(delObj.uuid.toBase64(), QString("80h8uSNWgkKhKCp1TgXF7g=="));
QCOMPARE(delObj.uuid, QUuid::fromRfc4122(QByteArray::fromBase64("80h8uSNWgkKhKCp1TgXF7g==")));
QCOMPARE(delObj.deletionTime, Test::datetime(2010, 8, 25, 16, 14, 14));
QVERIFY(objList.isEmpty());
@@ -424,7 +424,7 @@ void TestKeePass2Format::testXmlInvalidXmlChars()
QString().append(QChar(0x31)).append(QChar(0xD801)).append(QChar(0xDC37)).append(QChar(0x32));
auto entry = new Entry();
entry->setUuid(Uuid::random());
entry->setUuid(QUuid::createUuid());
entry->setGroup(dbWrite->rootGroup());
entry->attributes()->set("PlainInvalid", strPlainInvalid);
entry->attributes()->set("PlainValid", strPlainValid);
@@ -577,12 +577,12 @@ void TestKeePass2Format::testDuplicateAttachments()
auto entry1 = new Entry();
entry1->setGroup(db->rootGroup());
entry1->setUuid(Uuid("aaaaaaaaaaaaaaaa"));
entry1->setUuid(QUuid::fromRfc4122("aaaaaaaaaaaaaaaa"));
entry1->attachments()->set("a", attachment1);
auto entry2 = new Entry();
entry2->setGroup(db->rootGroup());
entry2->setUuid(Uuid("bbbbbbbbbbbbbbbb"));
entry2->setUuid(QUuid::fromRfc4122("bbbbbbbbbbbbbbbb"));
entry2->attachments()->set("b1", attachment1);
entry2->beginUpdate();
entry2->attachments()->set("b2", attachment1);
@@ -596,7 +596,7 @@ void TestKeePass2Format::testDuplicateAttachments()
auto entry3 = new Entry();
entry3->setGroup(db->rootGroup());
entry3->setUuid(Uuid("cccccccccccccccc"));
entry3->setUuid(QUuid::fromRfc4122("cccccccccccccccc"));
entry3->attachments()->set("c1", attachment2);
entry3->attachments()->set("c2", attachment2);
entry3->attachments()->set("c3", attachment3);

View File

@@ -216,8 +216,7 @@ void TestMerge::testResolveConflictKeepBoth()
QVERIFY2(olderEntry->attributes()->hasKey("merged"), "older entry is marked with an attribute \"merged\"");
QCOMPARE(olderEntry->historyItems().isEmpty(), false);
QVERIFY2(olderEntry->uuid().toHex() != updatedEntry->uuid().toHex(),
"KeepBoth should not reuse the UUIDs when cloning.");
QVERIFY2(olderEntry->uuid() != updatedEntry->uuid(), "KeepBoth should not reuse the UUIDs when cloning.");
delete dbSource;
delete dbDestination;
@@ -308,7 +307,7 @@ void TestMerge::testCreateNewGroups()
QTest::qSleep(1);
Group* group3 = new Group();
group3->setName("group3");
group3->setUuid(Uuid::random());
group3->setUuid(QUuid::createUuid());
group3->setParent(dbSource->rootGroup());
dbDestination->merge(dbSource);
@@ -331,7 +330,7 @@ void TestMerge::testMoveEntryIntoNewGroup()
QTest::qSleep(1);
Group* group3 = new Group();
group3->setName("group3");
group3->setUuid(Uuid::random());
group3->setUuid(QUuid::createUuid());
group3->setParent(dbSource->rootGroup());
Entry* entry1 = dbSource->rootGroup()->findEntry("entry1");
@@ -367,13 +366,13 @@ void TestMerge::testUpdateEntryDifferentLocation()
Group* group3 = new Group();
group3->setName("group3");
group3->setUuid(Uuid::random());
group3->setUuid(QUuid::createUuid());
group3->setParent(dbDestination->rootGroup());
Entry* entry1 = dbDestination->rootGroup()->findEntry("entry1");
QVERIFY(entry1 != nullptr);
entry1->setGroup(group3);
Uuid uuidBeforeSyncing = entry1->uuid();
QUuid uuidBeforeSyncing = entry1->uuid();
// Change the entry in the source db.
QTest::qSleep(1);
@@ -413,7 +412,7 @@ void TestMerge::testUpdateGroup()
Group* group2 = dbSource->rootGroup()->findChildByName("group2");
group2->setName("group2 renamed");
group2->setNotes("updated notes");
Uuid customIconId = Uuid::random();
QUuid customIconId = QUuid::createUuid();
QImage customIcon;
dbSource->metadata()->addCustomIcon(customIconId, customIcon);
group2->setIcon(customIconId);
@@ -422,7 +421,7 @@ void TestMerge::testUpdateGroup()
QVERIFY(entry1 != nullptr);
entry1->setGroup(group2);
entry1->setTitle("entry1 renamed");
Uuid uuidBeforeSyncing = entry1->uuid();
QUuid uuidBeforeSyncing = entry1->uuid();
dbDestination->merge(dbSource);
@@ -446,7 +445,7 @@ void TestMerge::testUpdateGroupLocation()
{
Database* dbDestination = createTestDatabase();
Group* group3 = new Group();
Uuid group3Uuid = Uuid::random();
QUuid group3Uuid = QUuid::createUuid();
group3->setUuid(group3Uuid);
group3->setName("group3");
group3->setParent(dbDestination->rootGroup()->findChildByName("group1"));
@@ -509,7 +508,7 @@ void TestMerge::testMergeCustomIcons()
Database* dbDestination = new Database();
Database* dbSource = createTestDatabase();
Uuid customIconId = Uuid::random();
QUuid customIconId = QUuid::createUuid();
QImage customIcon;
dbSource->metadata()->addCustomIcon(customIconId, customIcon);
@@ -566,11 +565,11 @@ Database* TestMerge::createTestDatabase()
Group* group1 = new Group();
group1->setName("group1");
group1->setUuid(Uuid::random());
group1->setUuid(QUuid::createUuid());
Group* group2 = new Group();
group2->setName("group2");
group2->setUuid(Uuid::random());
group2->setUuid(QUuid::createUuid());
Entry* entry1 = new Entry();
Entry* entry2 = new Entry();
@@ -578,14 +577,14 @@ Database* TestMerge::createTestDatabase()
// Give Entry 1 a history
entry1->beginUpdate();
entry1->setGroup(group1);
entry1->setUuid(Uuid::random());
entry1->setUuid(QUuid::createUuid());
entry1->setTitle("entry1");
entry1->endUpdate();
// Give Entry 2 a history
entry2->beginUpdate();
entry2->setGroup(group1);
entry2->setUuid(Uuid::random());
entry2->setUuid(QUuid::createUuid());
entry2->setTitle("entry2");
entry2->endUpdate();

View File

@@ -115,7 +115,7 @@ void TestModified::testGroupSets()
QSignalSpy spyModified(db.data(), SIGNAL(modifiedImmediate()));
root->setUuid(Uuid::random());
root->setUuid(QUuid::createUuid());
QCOMPARE(spyModified.count(), ++spyCount);
root->setUuid(root->uuid());
QCOMPARE(spyModified.count(), spyCount);
@@ -135,12 +135,13 @@ void TestModified::testGroupSets()
root->setIcon(root->iconNumber());
QCOMPARE(spyModified.count(), spyCount);
root->setIcon(Uuid::random());
root->setIcon(QUuid::createUuid());
QCOMPARE(spyModified.count(), ++spyCount);
root->setIcon(root->iconUuid());
QCOMPARE(spyModified.count(), spyCount);
group->setUuid(Uuid::random());
group->setUuid(QUuid::createUuid());
QCOMPARE(spyModified.count(), ++spyCount);
group->setUuid(group->uuid());
QCOMPARE(spyModified.count(), spyCount);
@@ -160,7 +161,7 @@ void TestModified::testGroupSets()
group->setIcon(group->iconNumber());
QCOMPARE(spyModified.count(), spyCount);
group->setIcon(Uuid::random());
group->setIcon(QUuid::createUuid());
QCOMPARE(spyModified.count(), ++spyCount);
group->setIcon(group->iconUuid());
QCOMPARE(spyModified.count(), spyCount);
@@ -179,7 +180,7 @@ void TestModified::testEntrySets()
QSignalSpy spyModified(db.data(), SIGNAL(modifiedImmediate()));
entry->setUuid(Uuid::random());
entry->setUuid(QUuid::createUuid());
QCOMPARE(spyModified.count(), ++spyCount);
entry->setUuid(entry->uuid());
QCOMPARE(spyModified.count(), spyCount);
@@ -214,7 +215,7 @@ void TestModified::testEntrySets()
entry->setIcon(entry->iconNumber());
QCOMPARE(spyModified.count(), spyCount);
entry->setIcon(Uuid::random());
entry->setIcon(QUuid::createUuid());
QCOMPARE(spyModified.count(), ++spyCount);
entry->setIcon(entry->iconUuid());
QCOMPARE(spyModified.count(), spyCount);
@@ -283,7 +284,7 @@ void TestModified::testHistoryItems()
{
QScopedPointer<Entry> entry(new Entry());
QDateTime created = entry->timeInfo().creationTime();
entry->setUuid(Uuid::random());
entry->setUuid(QUuid::createUuid());
entry->setTitle("a");
entry->setTags("a");
QScopedPointer<EntryAttributes> attributes(new EntryAttributes());

View File

@@ -73,7 +73,7 @@ void TestGuiPixmaps::testEntryIcons()
QCOMPARE(pixmapCached1.cacheKey(), pixmap.cacheKey());
QCOMPARE(pixmapCached2.cacheKey(), pixmap.cacheKey());
Uuid iconUuid = Uuid::random();
QUuid iconUuid = QUuid::createUuid();
icon = QImage(2, 1, QImage::Format_RGB32);
icon.setPixel(0, 0, qRgb(0, 0, 0));
icon.setPixel(1, 0, qRgb(0, 0, 50));
@@ -116,7 +116,7 @@ void TestGuiPixmaps::testGroupIcons()
QCOMPARE(pixmapCached1.cacheKey(), pixmap.cacheKey());
QCOMPARE(pixmapCached2.cacheKey(), pixmap.cacheKey());
Uuid iconUuid = Uuid::random();
QUuid iconUuid = QUuid::createUuid();
icon = QImage(2, 1, QImage::Format_RGB32);
icon.setPixel(0, 0, qRgb(0, 0, 0));
icon.setPixel(1, 0, qRgb(0, 0, 50));