summaryrefslogtreecommitdiffstats
path: root/libemailfunctions/tests/testemail.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:53:50 +0000
commit7be55ffa061c026e35e2d6a0effe1161ddb0d41f (patch)
tree8474f9b444b2756228600050f07a7ff25de532b2 /libemailfunctions/tests/testemail.cpp
parentf587f20a6d09f1729dd0a8c1cd8ee0110aec7451 (diff)
downloadtdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.tar.gz
tdepim-7be55ffa061c026e35e2d6a0effe1161ddb0d41f.zip
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'libemailfunctions/tests/testemail.cpp')
-rw-r--r--libemailfunctions/tests/testemail.cpp72
1 files changed, 36 insertions, 36 deletions
diff --git a/libemailfunctions/tests/testemail.cpp b/libemailfunctions/tests/testemail.cpp
index ce2111db0..30908d83e 100644
--- a/libemailfunctions/tests/testemail.cpp
+++ b/libemailfunctions/tests/testemail.cpp
@@ -29,7 +29,7 @@
using namespace KPIM;
-static bool check(const QString& txt, const QString& a, const QString& b)
+static bool check(const TQString& txt, const TQString& a, const TQString& b)
{
if (a == b) {
kdDebug() << txt << " : checking '" << a << "' against expected value '" << b << "'... " << "ok" << endl;
@@ -41,7 +41,7 @@ static bool check(const QString& txt, const QString& a, const QString& b)
return true;
}
-static bool check(const QString& txt, const QStringList& a, const QStringList& b)
+static bool check(const TQString& txt, const TQStringList& a, const TQStringList& b)
{
if ( a.join("\n") == b.join("\n") ) {
kdDebug() << txt << " : checking list [ " << a.join( ", " ) << " ] against expected value [ " << b.join( ", " ) << " ]... " << "ok" << endl;
@@ -53,18 +53,18 @@ static bool check(const QString& txt, const QStringList& a, const QStringList& b
return true;
}
-static bool checkGetNameAndEmail(const QString& input, const QString& expName, const QString& expEmail, bool expRetVal)
+static bool checkGetNameAndEmail(const TQString& input, const TQString& expName, const TQString& expEmail, bool expRetVal)
{
- QString name, email;
+ TQString name, email;
bool retVal = KPIM::getNameAndMail(input, name, email);
- check( "getNameAndMail " + input + " retVal", retVal?QString::fromLatin1( "true" ):QString::fromLatin1( "false" ), expRetVal?QString::fromLatin1( "true" ):QString::fromLatin1( "false" ) );
+ check( "getNameAndMail " + input + " retVal", retVal?TQString::fromLatin1( "true" ):TQString::fromLatin1( "false" ), expRetVal?TQString::fromLatin1( "true" ):TQString::fromLatin1( "false" ) );
check( "getNameAndMail " + input + " name", name, expName );
check( "getNameAndMail " + input + " email", email, expEmail );
return true;
}
// convert this to a switch instead but hey, nothing speedy in here is needed but still.. it would be nice
-static QString emailTestParseResultToString( EmailParseResult errorCode )
+static TQString emailTestParseResultToString( EmailParseResult errorCode )
{
if( errorCode == TooManyAts ) {
return "TooManyAts";
@@ -98,7 +98,7 @@ static QString emailTestParseResultToString( EmailParseResult errorCode )
return "unknown error code";
}
-static QString simpleEmailTestParseResultToString( bool validEmail )
+static TQString simpleEmailTestParseResultToString( bool validEmail )
{
if ( validEmail ) {
return "true";
@@ -106,54 +106,54 @@ static QString simpleEmailTestParseResultToString( bool validEmail )
return "false";
}
-static bool checkIsValidEmailAddress( const QString& input, const QString& expErrorCode )
+static bool checkIsValidEmailAddress( const TQString& input, const TQString& expErrorCode )
{
EmailParseResult errorCode = KPIM::isValidEmailAddress( input );
- QString errorC = emailTestParseResultToString( errorCode );
+ TQString errorC = emailTestParseResultToString( errorCode );
check( "isValidEmailAddress " + input + " errorCode ", errorC , expErrorCode );
return true;
}
-static bool checkIsValidSimpleEmailAddress( const QString& input, const QString& expResult )
+static bool checkIsValidSimpleEmailAddress( const TQString& input, const TQString& expResult )
{
bool validEmail = KPIM::isValidSimpleEmailAddress( input );
- QString result = simpleEmailTestParseResultToString( validEmail );
+ TQString result = simpleEmailTestParseResultToString( validEmail );
check( "isValidSimpleEmailAddress " + input + " result ", result, expResult );
return true;
}
-static bool checkGetEmailAddress( const QString& input, const QString& expResult )
+static bool checkGetEmailAddress( const TQString& input, const TQString& expResult )
{
- QString emailAddress = KPIM::getEmailAddress( input );
- QString result = emailAddress;
+ TQString emailAddress = KPIM::getEmailAddress( input );
+ TQString result = emailAddress;
check( "getEmailAddress " + input + " result ", result, expResult );
return true;
}
-static bool checkSplitEmailAddrList( const QString& input, const QStringList& expResult )
+static bool checkSplitEmailAddrList( const TQString& input, const TQStringList& expResult )
{
- QStringList emailAddresses = KPIM::splitEmailAddrList( input );
+ TQStringList emailAddresses = KPIM::splitEmailAddrList( input );
check( "splitEmailAddrList( \"" + input + "\" ) result ", emailAddresses, expResult );
return true;
}
-static bool checkNormalizeAddressesAndEncodeIDNs( const QString& input, const QString& expResult )
+static bool checkNormalizeAddressesAndEncodeIDNs( const TQString& input, const TQString& expResult )
{
- QString result = KPIM::normalizeAddressesAndEncodeIDNs( input );
+ TQString result = KPIM::normalizeAddressesAndEncodeIDNs( input );
check( "normalizeAddressesAndEncodeIDNs( \"" + input + "\" ) result ", result, expResult );
return true;
}
-static bool checkNormalizeAddressesAndDecodeIDNs( const QString& input, const QString& expResult )
+static bool checkNormalizeAddressesAndDecodeIDNs( const TQString& input, const TQString& expResult )
{
- QString result = KPIM::normalizeAddressesAndDecodeIDNs( input );
+ TQString result = KPIM::normalizeAddressesAndDecodeIDNs( input );
check( "normalizeAddressesAndDecodeIDNs( \"" + input + "\" ) result ", result, expResult );
return true;
}
-static bool checkQuoteIfNecessary( const QString& input, const QString& expResult )
+static bool checkQuoteIfNecessary( const TQString& input, const TQString& expResult )
{
- QString result = quoteNameIfNecessary( input );
+ TQString result = quoteNameIfNecessary( input );
check( "quoteNameIfNecessary " + input + " result ", result, expResult );
return true;
}
@@ -166,10 +166,10 @@ int main(int argc, char *argv[])
KApplication app( false, false );
// Empty input
- checkGetNameAndEmail( QString::null, QString::null, QString::null, false );
+ checkGetNameAndEmail( TQString::null, TQString::null, TQString::null, false );
// Email only
- checkGetNameAndEmail( "faure@kde.org", QString::null, "faure@kde.org", false );
+ checkGetNameAndEmail( "faure@kde.org", TQString::null, "faure@kde.org", false );
// Normal case
checkGetNameAndEmail( "David Faure <faure@kde.org>", "David Faure", "faure@kde.org", true );
@@ -203,8 +203,8 @@ int main(int argc, char *argv[])
//checkGetNameAndEmail( "\"a@b\" <faure@kde.org>", "a@b", "faure@kde.org", true );
// While typing, when there's no '@' yet
- checkGetNameAndEmail( "foo", "foo", QString::null, false );
- checkGetNameAndEmail( "foo <", "foo", QString::null, false );
+ checkGetNameAndEmail( "foo", "foo", TQString::null, false );
+ checkGetNameAndEmail( "foo <", "foo", TQString::null, false );
checkGetNameAndEmail( "foo <b", "foo", "b", true );
// If multiple emails are there, only return the first one
@@ -226,7 +226,7 @@ int main(int argc, char *argv[])
checkIsValidEmailAddress( "mattfruitsalad.org", "TooFewAts" );
// An empty string
- checkIsValidEmailAddress( QString::null , "AddressEmpty" );
+ checkIsValidEmailAddress( TQString::null , "AddressEmpty" );
// email address starting with a @
checkIsValidEmailAddress( "@mattfruitsalad.org", "MissingLocalPart" );
@@ -385,9 +385,9 @@ int main(int argc, char *argv[])
// checks for "pure" email addresses in the form of xxx@yyy.tld
checkIsValidSimpleEmailAddress( "matt@fruitsalad.org", "true" );
- checkIsValidSimpleEmailAddress( QString::fromUtf8("test@täst.invalid"), "true" );
+ checkIsValidSimpleEmailAddress( TQString::fromUtf8("test@täst.invalid"), "true" );
// non-ASCII char as first char of IDN
- checkIsValidSimpleEmailAddress( QString::fromUtf8("i_want@øl.invalid"), "true" );
+ checkIsValidSimpleEmailAddress( TQString::fromUtf8("i_want@øl.invalid"), "true" );
checkIsValidSimpleEmailAddress( "matt@[123.123.123.123]", "true" );
checkIsValidSimpleEmailAddress( "matt@[3.3.3.3]", "true" );
checkIsValidSimpleEmailAddress( "matt@[4.4.4.4]", "true" );
@@ -433,7 +433,7 @@ int main(int argc, char *argv[])
checkIsValidSimpleEmailAddress( "matt@123.123.123.123]", "false" );
checkIsValidSimpleEmailAddress( "\"matt@fruitsalad.org", "false" );
checkIsValidSimpleEmailAddress( "matt\"@fruitsalad.org", "false" );
- checkIsValidSimpleEmailAddress( QString::null, "false" );
+ checkIsValidSimpleEmailAddress( TQString::null, "false" );
// and here some insane but still valid cases
checkIsValidSimpleEmailAddress( "\"m@tt\"@fruitsalad.org", "true" );
@@ -445,17 +445,17 @@ int main(int argc, char *argv[])
checkGetEmailAddress( "Matt Douhan <matt@fruitsalad.org>", "matt@fruitsalad.org" );
checkGetEmailAddress( "\"Matt Douhan <blah blah>\" <matt@fruitsalad.org>", "matt@fruitsalad.org" );
checkGetEmailAddress( "\"Matt <blah blah>\" <matt@fruitsalad.org>", "matt@fruitsalad.org" );
- checkGetEmailAddress( "Matt Douhan (jongel) <matt@fruitsalad.org", QString() );
+ checkGetEmailAddress( "Matt Douhan (jongel) <matt@fruitsalad.org", TQString() );
checkGetEmailAddress( "Matt Douhan (m@tt) <matt@fruitsalad.org>", "matt@fruitsalad.org" );
checkGetEmailAddress( "\"Douhan, Matt\" <matt@fruitsalad.org>", "matt@fruitsalad.org" );
checkGetEmailAddress( "\"Matt Douhan (m@tt)\" <matt@fruitsalad.org>", "matt@fruitsalad.org" );
- checkGetEmailAddress( "\"Matt Douhan\" (matt <matt@fruitsalad.org>", QString() );
+ checkGetEmailAddress( "\"Matt Douhan\" (matt <matt@fruitsalad.org>", TQString() );
checkGetEmailAddress( "Matt Douhan <matt@[123.123.123.123]>", "matt@[123.123.123.123]" );
// check the splitEmailAddrList method
- checkSplitEmailAddrList( "kloecker@kde.org (Kloecker, Ingo)", QStringList() << "kloecker@kde.org (Kloecker, Ingo)" );
- checkSplitEmailAddrList( "Matt Douhan <matt@fruitsalad.org>, Foo Bar <foo@bar.com>", QStringList() << "Matt Douhan <matt@fruitsalad.org>" << "Foo Bar <foo@bar.com>" );
- checkSplitEmailAddrList( "\"Matt, Douhan\" <matt@fruitsalad.org>, Foo Bar <foo@bar.com>", QStringList() << "\"Matt, Douhan\" <matt@fruitsalad.org>" << "Foo Bar <foo@bar.com>" );
+ checkSplitEmailAddrList( "kloecker@kde.org (Kloecker, Ingo)", TQStringList() << "kloecker@kde.org (Kloecker, Ingo)" );
+ checkSplitEmailAddrList( "Matt Douhan <matt@fruitsalad.org>, Foo Bar <foo@bar.com>", TQStringList() << "Matt Douhan <matt@fruitsalad.org>" << "Foo Bar <foo@bar.com>" );
+ checkSplitEmailAddrList( "\"Matt, Douhan\" <matt@fruitsalad.org>, Foo Bar <foo@bar.com>", TQStringList() << "\"Matt, Douhan\" <matt@fruitsalad.org>" << "Foo Bar <foo@bar.com>" );
// check checkNormalizeAddressesAndEncodeIDNs
checkNormalizeAddressesAndEncodeIDNs( "matt@fruitsalad.org", "matt@fruitsalad.org" );
@@ -467,7 +467,7 @@ int main(int argc, char *argv[])
// check checkNormalizeAddressesAndDecodeIDNs
checkNormalizeAddressesAndDecodeIDNs( "=?us-ascii?Q?Surname=2C=20Name?= <nobody@example.org>", "\"Surname, Name\" <nobody@example.org>" );
- checkNormalizeAddressesAndDecodeIDNs( "=?iso-8859-1?B?5Hf8b2xmLPZBbmRyZWFz?= <nobody@example.org>", QString::fromUtf8("\"äwüolf,öAndreas\" <nobody@example.org>") );
+ checkNormalizeAddressesAndDecodeIDNs( "=?iso-8859-1?B?5Hf8b2xmLPZBbmRyZWFz?= <nobody@example.org>", TQString::fromUtf8("\"äwüolf,öAndreas\" <nobody@example.org>") );
// check the "quote if necessary" method
checkQuoteIfNecessary( "Matt Douhan", "Matt Douhan");