Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 8eefa22d authored by Laurent Montel's avatar Laurent Montel 😁

Add unittest for Addressee::parseEmailAddress to compare with new version in kcontact

parent ede66996
......@@ -453,3 +453,26 @@ void AddresseeTest::customFieldsTest()
c.removeCustom( QLatin1String( "FirstApp" ), QLatin1String( "FirstKey" ) );
QCOMPARE( c.customs().count(), 2 );
}
void AddresseeTest::parseEmailAddress_data()
{
QTest::addColumn<QString>("inputEmail");
QTest::addColumn<QString>("email");
QTest::addColumn<QString>("name");
QTest::newRow("simpleemail") << QString(QLatin1String("foo@kde.org")) << QString(QLatin1String("foo@kde.org")) << QString();
QTest::newRow("email") << QString(QLatin1String("foo <foo@kde.org>")) << QString(QLatin1String("foo@kde.org")) << QString(QLatin1String("foo"));
}
void AddresseeTest::parseEmailAddress()
{
QFETCH(QString, inputEmail);
QFETCH(QString, email);
QFETCH(QString, name);
QString parsedName;
QString parsedEmail;
KABC::Addressee::parseEmailAddress(inputEmail, parsedName, parsedEmail);
QCOMPARE(parsedEmail, email);
QCOMPARE(parsedName, name);
}
......@@ -37,6 +37,9 @@ class AddresseeTest : public QObject
void fullEmailTest();
void nameFromStringTest();
void customFieldsTest();
void parseEmailAddress_data();
void parseEmailAddress();
};
#endif
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