From 7be55ffa061c026e35e2d6a0effe1161ddb0d41f Mon Sep 17 00:00:00 2001 From: tpearson Date: Sat, 31 Jul 2010 19:53:50 +0000 Subject: Trinity Qt initial conversion git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1157655 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- libemailfunctions/tests/testemail.cpp | 72 ++++++++++++++++---------------- libemailfunctions/tests/testidmapper.cpp | 4 +- 2 files changed, 38 insertions(+), 38 deletions(-) (limited to 'libemailfunctions/tests') 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 ", "David Faure", "faure@kde.org", true ); @@ -203,8 +203,8 @@ int main(int argc, char *argv[]) //checkGetNameAndEmail( "\"a@b\" ", "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 ", "matt@fruitsalad.org" ); checkGetEmailAddress( "\"Matt Douhan \" ", "matt@fruitsalad.org" ); checkGetEmailAddress( "\"Matt \" ", "matt@fruitsalad.org" ); - checkGetEmailAddress( "Matt Douhan (jongel) ", "matt@fruitsalad.org" ); checkGetEmailAddress( "\"Douhan, Matt\" ", "matt@fruitsalad.org" ); checkGetEmailAddress( "\"Matt Douhan (m@tt)\" ", "matt@fruitsalad.org" ); - checkGetEmailAddress( "\"Matt Douhan\" (matt ", QString() ); + checkGetEmailAddress( "\"Matt Douhan\" (matt ", TQString() ); checkGetEmailAddress( "Matt Douhan ", "matt@[123.123.123.123]" ); // check the splitEmailAddrList method - checkSplitEmailAddrList( "kloecker@kde.org (Kloecker, Ingo)", QStringList() << "kloecker@kde.org (Kloecker, Ingo)" ); - checkSplitEmailAddrList( "Matt Douhan , Foo Bar ", QStringList() << "Matt Douhan " << "Foo Bar " ); - checkSplitEmailAddrList( "\"Matt, Douhan\" , Foo Bar ", QStringList() << "\"Matt, Douhan\" " << "Foo Bar " ); + checkSplitEmailAddrList( "kloecker@kde.org (Kloecker, Ingo)", TQStringList() << "kloecker@kde.org (Kloecker, Ingo)" ); + checkSplitEmailAddrList( "Matt Douhan , Foo Bar ", TQStringList() << "Matt Douhan " << "Foo Bar " ); + checkSplitEmailAddrList( "\"Matt, Douhan\" , Foo Bar ", TQStringList() << "\"Matt, Douhan\" " << "Foo Bar " ); // 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?= ", "\"Surname, Name\" " ); - checkNormalizeAddressesAndDecodeIDNs( "=?iso-8859-1?B?5Hf8b2xmLPZBbmRyZWFz?= ", QString::fromUtf8("\"äwüolf,öAndreas\" ") ); + checkNormalizeAddressesAndDecodeIDNs( "=?iso-8859-1?B?5Hf8b2xmLPZBbmRyZWFz?= ", TQString::fromUtf8("\"äwüolf,öAndreas\" ") ); // check the "quote if necessary" method checkQuoteIfNecessary( "Matt Douhan", "Matt Douhan"); diff --git a/libemailfunctions/tests/testidmapper.cpp b/libemailfunctions/tests/testidmapper.cpp index 245895ec9..591ebce03 100644 --- a/libemailfunctions/tests/testidmapper.cpp +++ b/libemailfunctions/tests/testidmapper.cpp @@ -19,13 +19,13 @@ Boston, MA 02110-1301, USA. */ -#include +#include #include "idmapper.h" int main( int argc, char **argv ) { - QApplication app( argc, argv ); + TQApplication app( argc, argv ); KPIM::IdMapper mapper( "test.uidmap" ) ; -- cgit v1.2.1