From 48c498890fa7161e8894338ea3046e1a9741b78f Mon Sep 17 00:00:00 2001 From: Felix Geyer Date: Wed, 18 Aug 2010 11:05:46 +0200 Subject: [PATCH] Use QCOMPARE instead of QVERIFY where possible. --- tests/TestGroup.cpp | 12 ++++++------ tests/TestGroupModel.cpp | 12 ++++++------ tests/TestParser.cpp | 40 ++++++++++++++++++++-------------------- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/tests/TestGroup.cpp b/tests/TestGroup.cpp index 349538f83..57538ed59 100644 --- a/tests/TestGroup.cpp +++ b/tests/TestGroup.cpp @@ -58,11 +58,11 @@ void TestGroup::testParenting() QVERIFY(g3->database() == db); QVERIFY(g4->database() == db); - QVERIFY(tmpRoot->children().size() == 0); - QVERIFY(g1->children().size() == 2); - QVERIFY(g2->children().size() == 0); - QVERIFY(g3->children().size() == 1); - QVERIFY(g4->children().size() == 0); + QCOMPARE(tmpRoot->children().size(), 0); + QCOMPARE(g1->children().size(), 2); + QCOMPARE(g2->children().size(), 0); + QCOMPARE(g3->children().size(), 1); + QCOMPARE(g4->children().size(), 0); QVERIFY(g1->children().at(0) == g2); QVERIFY(g1->children().at(1) == g3); @@ -75,7 +75,7 @@ void TestGroup::testParenting() g1->setName("test"); g3->setIcon(Uuid::random()); g1->setIcon(2); - QVERIFY(spy.count() == 6); + QCOMPARE(spy.count(), 6); } void TestGroup::testSignals() diff --git a/tests/TestGroupModel.cpp b/tests/TestGroupModel.cpp index d4c5deab4..7ea324344 100644 --- a/tests/TestGroupModel.cpp +++ b/tests/TestGroupModel.cpp @@ -70,12 +70,12 @@ void TestGroupModel::test() QModelIndex index121 = model->index(0, 0, index12); QModelIndex index2 = model->index(1, 0, indexRoot); - QVERIFY(model->data(indexRoot) == "groupRoot"); - QVERIFY(model->data(index1) == "group1"); - QVERIFY(model->data(index11) == "group11"); - QVERIFY(model->data(index12) == "group12"); - QVERIFY(model->data(index121) == "group121"); - QVERIFY(model->data(index2) == "group2"); + QCOMPARE(model->data(indexRoot).toString(), QString("groupRoot")); + QCOMPARE(model->data(index1).toString(), QString("group1")); + QCOMPARE(model->data(index11).toString(), QString("group11")); + QCOMPARE(model->data(index12).toString(), QString("group12")); + QCOMPARE(model->data(index121).toString(), QString("group121")); + QCOMPARE(model->data(index2).toString(), QString("group2")); QSignalSpy spy1(model, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&))); group11->setName("test"); diff --git a/tests/TestParser.cpp b/tests/TestParser.cpp index 3bb2dcbd1..9190d765e 100644 --- a/tests/TestParser.cpp +++ b/tests/TestParser.cpp @@ -54,12 +54,12 @@ void TestParser::initTestCase() void TestParser::testMetadata() { - QCOMPARE(m_db->metadata()->generator(), QLatin1String("KeePass")); - QCOMPARE(m_db->metadata()->name(), QLatin1String("ANAME")); + QCOMPARE(m_db->metadata()->generator(), QString("KeePass")); + QCOMPARE(m_db->metadata()->name(), QString("ANAME")); QCOMPARE(m_db->metadata()->nameChanged(), genDT(2010, 8, 8, 17, 24, 53)); - QCOMPARE(m_db->metadata()->description(), QLatin1String("ADESC")); + QCOMPARE(m_db->metadata()->description(), QString("ADESC")); QCOMPARE(m_db->metadata()->descriptionChanged(), genDT(2010, 8, 8, 17, 27, 12)); - QCOMPARE(m_db->metadata()->defaultUserName(), QLatin1String("DEFUSERNAME")); + QCOMPARE(m_db->metadata()->defaultUserName(), QString("DEFUSERNAME")); QCOMPARE(m_db->metadata()->defaultUserNameChanged(), genDT(2010, 8, 8, 17, 27, 45)); QCOMPARE(m_db->metadata()->maintenanceHistoryDays(), 127); QCOMPARE(m_db->metadata()->protectTitle(), false); @@ -70,34 +70,34 @@ void TestParser::testMetadata() QCOMPARE(m_db->metadata()->autoEnableVisualHiding(), true); QCOMPARE(m_db->metadata()->recycleBinEnabled(), true); QVERIFY(m_db->metadata()->recycleBin() != 0); - QCOMPARE(m_db->metadata()->recycleBin()->name(), QLatin1String("Recycle Bin")); + QCOMPARE(m_db->metadata()->recycleBin()->name(), QString("Recycle Bin")); QCOMPARE(m_db->metadata()->recycleBinChanged(), genDT(2010, 8, 8, 17, 24, 17)); QVERIFY(m_db->metadata()->entryTemplatesGroup() == 0); QCOMPARE(m_db->metadata()->entryTemplatesGroupChanged(), genDT(2010, 8, 8, 17, 24, 19)); QVERIFY(m_db->metadata()->lastSelectedGroup() != 0); - QCOMPARE(m_db->metadata()->lastSelectedGroup()->name(), QLatin1String("NewDatabase")); + QCOMPARE(m_db->metadata()->lastSelectedGroup()->name(), QString("NewDatabase")); QVERIFY(m_db->metadata()->lastTopVisibleGroup() == m_db->metadata()->lastSelectedGroup()); } void TestParser::testGroups() { QVERIFY(m_db->rootGroup() != 0); - QVERIFY(m_db->rootGroup()->name() == QLatin1String("NewDatabase")); - QVERIFY(m_db->rootGroup()->uuid().toBase64() == QLatin1String("zKuE27EWr0mlU75b2SRkTQ==")); - QVERIFY(m_db->rootGroup()->isExpanded() == true); + QCOMPARE(m_db->rootGroup()->name(), QString("NewDatabase")); + QCOMPARE(m_db->rootGroup()->uuid().toBase64(), QString("zKuE27EWr0mlU75b2SRkTQ==")); + QVERIFY(m_db->rootGroup()->isExpanded()); TimeInfo ti = m_db->rootGroup()->timeInfo(); - QVERIFY(ti.lastModificationTime() == genDT(2010, 8, 8, 17, 24, 27)); - QVERIFY(ti.creationTime() == genDT(2010, 8, 7, 17, 24, 27)); - QVERIFY(ti.lastAccessTime() == genDT(2010, 8, 9, 9, 9, 44)); - QVERIFY(ti.expiryTime() == genDT(2010, 8, 8, 17, 24, 17)); - QVERIFY(ti.expires() == false); - QVERIFY(ti.usageCount() == 2); - QVERIFY(ti.locationChanged() == genDT(2010, 8, 8, 17, 24, 27)); + QCOMPARE(ti.lastModificationTime(), genDT(2010, 8, 8, 17, 24, 27)); + QCOMPARE(ti.creationTime(), genDT(2010, 8, 7, 17, 24, 27)); + QCOMPARE(ti.lastAccessTime(), genDT(2010, 8, 9, 9, 9, 44)); + QCOMPARE(ti.expiryTime(), genDT(2010, 8, 8, 17, 24, 17)); + QVERIFY(!ti.expires()); + QCOMPARE(ti.usageCount(), 2); + QCOMPARE(ti.locationChanged(), genDT(2010, 8, 8, 17, 24, 27)); - QVERIFY(m_db->rootGroup()->children().size() == 3); - QVERIFY(m_db->rootGroup()->children().at(0)->uuid().toBase64() == "abLbFtNUfEi5TmbaxiW6yg=="); - QVERIFY(m_db->rootGroup()->children().at(1)->uuid().toBase64() == "u1lTRAICOkWv5QSl2xyU8w=="); - QVERIFY(m_db->rootGroup()->children().at(2)->uuid().toBase64() == "7PAwxNhPaE2klutz45i2xg=="); + QCOMPARE(m_db->rootGroup()->children().size(), 3); + QCOMPARE(m_db->rootGroup()->children().at(0)->uuid().toBase64(), QString("abLbFtNUfEi5TmbaxiW6yg==")); + QCOMPARE(m_db->rootGroup()->children().at(1)->uuid().toBase64(), QString("u1lTRAICOkWv5QSl2xyU8w==")); + QCOMPARE(m_db->rootGroup()->children().at(2)->uuid().toBase64(), QString("7PAwxNhPaE2klutz45i2xg==")); QVERIFY(m_db->metadata()->recycleBin() == m_db->rootGroup()->children().at(2)); }