summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2015-06-03 13:38:04 +0200
committerMontel Laurent <[email protected]>2015-06-03 13:38:04 +0200
commit8eefa22d73e6259767b68abdfbe5db96ea749fba (patch)
tree081592b7685288e7117fb4df706a196f68deb72a
parentede66996edb51e8742da554d58892503f3e61ae6 (diff)
Add unittest for Addressee::parseEmailAddress to compare with new version in kcontact
-rw-r--r--kabc/tests/addresseetest.cpp23
-rw-r--r--kabc/tests/addresseetest.h3
2 files changed, 26 insertions, 0 deletions
diff --git a/kabc/tests/addresseetest.cpp b/kabc/tests/addresseetest.cpp
index 4c06e28..df0065f 100644
--- a/kabc/tests/addresseetest.cpp
+++ b/kabc/tests/addresseetest.cpp
@@ -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("[email protected]")) << QString(QLatin1String("[email protected]")) << QString();
+ QTest::newRow("email") << QString(QLatin1String("foo <[email protected]>")) << QString(QLatin1String("[email protected]")) << 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);
+}
+
diff --git a/kabc/tests/addresseetest.h b/kabc/tests/addresseetest.h
index 16ed19c..480b948 100644
--- a/kabc/tests/addresseetest.h
+++ b/kabc/tests/addresseetest.h
@@ -37,6 +37,9 @@ class AddresseeTest : public QObject
void fullEmailTest();
void nameFromStringTest();
void customFieldsTest();
+ void parseEmailAddress_data();
+ void parseEmailAddress();
+
};
#endif