summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVijay Krishnavanshi <[email protected]>2017-08-08 16:18:52 +0530
committerPali Roh├ír <[email protected]>2017-12-22 09:10:31 +0100
commit7a48c8e09a292c55c4bf7b3728b7b8c07a314525 (patch)
treee97691670e35d8bc031ecf80dc657aa8007a1133
parent00e1312f9ccdf1187f7959154cae32035f2d8cbc (diff)
Added test data to libkopete contact autotests
-rw-r--r--tests/libkopete/kopetecontacttest.cpp38
1 files changed, 23 insertions, 15 deletions
diff --git a/tests/libkopete/kopetecontacttest.cpp b/tests/libkopete/kopetecontacttest.cpp
index c503fd8..f214b8e 100644
--- a/tests/libkopete/kopetecontacttest.cpp
+++ b/tests/libkopete/kopetecontacttest.cpp
@@ -130,24 +130,27 @@ void ContactTest::testContactCreation_data()
{
QTest::addColumn<Kopete::Contact::NameType>("TypeInEnum");
QTest::addColumn<QString>("TypeInString");
+ QTest::addColumn<QString>("contactId");
+ QTest::addColumn<QString>("icon");
- QTest::newRow("nickName") << Kopete::Contact::NickName << QStringLiteral("nickName");
- QTest::newRow("formattedName") << Kopete::Contact::FormattedName << QStringLiteral("formattedName");
- QTest::newRow("contactId") << Kopete::Contact::ContactId << QStringLiteral("contactId");
- QTest::newRow("customName") << Kopete::Contact::CustomName << QStringLiteral("customName");
+ QTest::newRow("nickName") << Kopete::Contact::NickName << QStringLiteral("nickName") << QStringLiteral("ContactId") << QStringLiteral("Icon");
+ QTest::newRow("formattedName") << Kopete::Contact::FormattedName << QStringLiteral("formattedName") << QStringLiteral("ContactId") << QStringLiteral("Icon");
+ QTest::newRow("contactId") << Kopete::Contact::ContactId << QStringLiteral("contactId") << QStringLiteral("ContactId") << QStringLiteral("Icon");
+ QTest::newRow("customName") << Kopete::Contact::CustomName << QStringLiteral("customName") << QStringLiteral("ContactId") << QStringLiteral("Icon");
}
void ContactTest::testContactCreation()
{
+ // test conversion of nametype to string and string to name
+ QFETCH(Kopete::Contact::NameType, TypeInEnum);
+ QFETCH(QString, TypeInString);
+ QFETCH(QString, contactId);
+ QFETCH(QString, icon);
+
Kopete::MetaContact *parentMetaContact = new Kopete::MetaContact();
DummyProtocol *dummyProtocol = new DummyProtocol();
DummyAccount *dummyAccount = new DummyAccount(dummyProtocol);
- const QString contactId = QStringLiteral("ContactId");
- const QString icon = QStringLiteral("Icon");
DummyContact *testContact = new DummyContact(dummyAccount, contactId, parentMetaContact, icon);
- // test conversion of nametype to string and string to name
- QFETCH(Kopete::Contact::NameType, TypeInEnum);
- QFETCH(QString, TypeInString);
QCOMPARE(testContact->nameTypeToString(TypeInEnum), TypeInString);
QCOMPARE(testContact->nameTypeFromString(TypeInString), TypeInEnum);
}
@@ -158,22 +161,27 @@ void ContactTest::testContactStatus_data()
QTest::addColumn<QString>("Message");
QTest::addColumn<int>("SpyCount");
- QTest::newRow("EmptyMessage") << QString("") << QString("") << 0;
- QTest::newRow("FullMessage") << QStringLiteral("Hello fromm the server") << QStringLiteral("This is a test") << 1;
+ QTest::newRow("EmptyMessage") << QString() << QString() << 0;
+ QTest::newRow("FullMessage 1") << QString() << QStringLiteral("This is a test") << 1;
+ QTest::newRow("FullMessage 1") << QStringLiteral("Hello fromm the server") << QStringLiteral("This is a test") << 1;
+ QTest::newRow("FullMessage 2") << QStringLiteral("Hello fromm the server *//*me") << QStringLiteral("This is a test") << 1;
+ QTest::newRow("FullMessage 3") << QStringLiteral("Hello fromm the server \\me") << QStringLiteral("This is a test") << 1;
+ QTest::newRow("FullMessage 4") << QStringLiteral("Hello fromm the server") << QString() << 1;
}
void ContactTest::testContactStatus()
{
+ // test Status Message
+ QFETCH(QString, Title);
+ QFETCH(QString, Message);
+ QFETCH(int, SpyCount);
+
Kopete::MetaContact *parentMetaContact = new Kopete::MetaContact();
DummyProtocol *dummyProtocol = new DummyProtocol();
DummyAccount *dummyAccount = new DummyAccount(dummyProtocol);
const QString contactId = QStringLiteral("ContactId");
const QString icon = QStringLiteral("Icon");
DummyContact *testContact = new DummyContact(dummyAccount, contactId, parentMetaContact, icon);
- // test Status Message
- QFETCH(QString, Title);
- QFETCH(QString, Message);
- QFETCH(int, SpyCount);
Kopete::StatusMessage testStatus = Kopete::StatusMessage(Title, Message);
QSignalSpy spy(testContact, &Kopete::Contact::statusMessageChanged);
testContact->setStatusMessage(testStatus);