diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
commit | 47c8a359c5276062c4bc17f0e82410f29081b502 (patch) | |
tree | 2d54a5f60a5b74067632f9ef6df58c2bc38155e6 /kopete/libkopete/tests/kopetemessage_test.cpp | |
parent | 6f82532777a35e0e60bbd2b290b2e93e646f349b (diff) | |
download | tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.tar.gz tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/libkopete/tests/kopetemessage_test.cpp')
-rw-r--r-- | kopete/libkopete/tests/kopetemessage_test.cpp | 110 |
1 files changed, 55 insertions, 55 deletions
diff --git a/kopete/libkopete/tests/kopetemessage_test.cpp b/kopete/libkopete/tests/kopetemessage_test.cpp index 1ca57123..3e4a85b3 100644 --- a/kopete/libkopete/tests/kopetemessage_test.cpp +++ b/kopete/libkopete/tests/kopetemessage_test.cpp @@ -19,8 +19,8 @@ #include <stdlib.h> -#include <qdir.h> -#include <qfile.h> +#include <tqdir.h> +#include <tqfile.h> #include <kapplication.h> #include <kstandarddirs.h> #include <kinstance.h> @@ -50,16 +50,16 @@ KUNITTEST_MODULE_REGISTER_TESTER( KopeteMessage_Test ); KopeteMessage_Test::KopeteMessage_Test() { // change user data dir to avoid messing with user's .kde dir - setenv( "KDEHOME", QFile::encodeName( QDir::homeDirPath() + "/.kopete-unittest" ), true ); + setenv( "KDEHOME", TQFile::encodeName( TQDir::homeDirPath() + "/.kopete-unittest" ), true ); // create fake objects needed to build a reasonable testeable message - m_protocol = new Kopete::Test::Mock::Protocol( new KInstance(QCString("test-kopete-message")), 0L, "test-kopete-message"); + m_protocol = new Kopete::Test::Mock::Protocol( new KInstance(TQCString("test-kopete-message")), 0L, "test-kopete-message"); m_account = new Kopete::Test::Mock::Account(m_protocol, "testaccount"); m_metaContactMyself = new Kopete::Test::Mock::MetaContact(); m_metaContactOther = new Kopete::Test::Mock::MetaContact(); - m_contactFrom = new Kopete::Test::Mock::Contact(m_account, QString::fromLatin1("test-myself"), m_metaContactMyself, QString::null); - m_contactTo = new Kopete::Test::Mock::Contact(m_account, QString::fromLatin1("test-dest"), m_metaContactOther, QString::null); - m_message = new Kopete::Message( m_contactFrom, m_contactTo, QString::null, Kopete::Message::Outbound, Kopete::Message::PlainText); + m_contactFrom = new Kopete::Test::Mock::Contact(m_account, TQString::fromLatin1("test-myself"), m_metaContactMyself, TQString::null); + m_contactTo = new Kopete::Test::Mock::Contact(m_account, TQString::fromLatin1("test-dest"), m_metaContactOther, TQString::null); + m_message = new Kopete::Message( m_contactFrom, m_contactTo, TQString::null, Kopete::Message::Outbound, Kopete::Message::PlainText); } void KopeteMessage_Test::allTests() @@ -120,7 +120,7 @@ void KopeteMessage_Test::testPrimitives() CHECK(Kopete::Message::RichText, msg.format()); } { - QString m = "foobar"; + TQString m = "foobar"; Kopete::Message msg( m_contactFrom, m_contactTo, m, Kopete::Message::Inbound, Kopete::Message::RichText); msg.setBody(m, Kopete::Message::PlainText); @@ -142,64 +142,64 @@ void KopeteMessage_Test::testPrimitives() *********************************************/ { - QString m = "foobar"; + TQString m = "foobar"; Kopete::Message msg( m_contactFrom, m_contactTo, m, Kopete::Message::Inbound, Kopete::Message::RichText); msg.setBody("NEW", Kopete::Message::PlainText); - CHECK(QString("NEW"), msg.plainBody()); + CHECK(TQString("NEW"), msg.plainBody()); msg.setBody("NEW_NEW", Kopete::Message::RichText); - CHECK(QString("NEW_NEW"), msg.plainBody()); + CHECK(TQString("NEW_NEW"), msg.plainBody()); } { - QString m = "foobar"; + TQString m = "foobar"; Kopete::Message msg( m_contactFrom, m_contactTo, m, Kopete::Message::Inbound, Kopete::Message::PlainText); msg.setBody("NEW", Kopete::Message::PlainText); - CHECK(QString("NEW"), msg.plainBody()); + CHECK(TQString("NEW"), msg.plainBody()); msg.setBody("NEW_NEW", Kopete::Message::RichText); - CHECK(QString("NEW_NEW"), msg.plainBody()); + CHECK(TQString("NEW_NEW"), msg.plainBody()); } { - QString m = "<html><head></head><body foo=\"bar\"> <b>HELLO WORLD</b> </body></html>"; + TQString m = "<html><head></head><body foo=\"bar\"> <b>HELLO WORLD</b> </body></html>"; Kopete::Message msg( m_contactFrom, m_contactTo, m, Kopete::Message::Inbound, Kopete::Message::PlainText); CHECK(m, msg.plainBody()); msg.setBody("<simple> SIMPLE", Kopete::Message::PlainText); - CHECK(msg.plainBody(), QString("<simple> SIMPLE") ); - CHECK(msg.escapedBody(), QString("<simple> SIMPLE") ); + CHECK(msg.plainBody(), TQString("<simple> SIMPLE") ); + CHECK(msg.escapedBody(), TQString("<simple> SIMPLE") ); msg.setBody("<simple>SIMPLE</simple>", Kopete::Message::RichText); - CHECK(msg.plainBody(), QString("SIMPLE") ); - CHECK(msg.escapedBody(), QString("<simple>SIMPLE</simple>") ); + CHECK(msg.plainBody(), TQString("SIMPLE") ); + CHECK(msg.escapedBody(), TQString("<simple>SIMPLE</simple>") ); - CHECK(Kopete::Message::unescape( QString( "<simple>SIMPLE</simple>" ) ), QString("SIMPLE") ); - CHECK(Kopete::Message::unescape( QString( "Foo <img src=\"foo.png\" />" ) ), QString("Foo ") ); - CHECK(Kopete::Message::unescape( QString( "Foo <img src=\"foo.png\" title=\"Bar\" />" ) ), QString("Foo Bar") ); + CHECK(Kopete::Message::unescape( TQString( "<simple>SIMPLE</simple>" ) ), TQString("SIMPLE") ); + CHECK(Kopete::Message::unescape( TQString( "Foo <img src=\"foo.png\" />" ) ), TQString("Foo ") ); + CHECK(Kopete::Message::unescape( TQString( "Foo <img src=\"foo.png\" title=\"Bar\" />" ) ), TQString("Foo Bar") ); msg.setBody(m, Kopete::Message::RichText); // FIXME: Should setBody() also strip extra white space? - //CHECK(msg.plainBody(), QString("HELLO WORLD")); - //CHECK(msg.escapedBody(), QString("<b>HELLO WORLD</b>")); + //CHECK(msg.plainBody(), TQString("HELLO WORLD")); + //CHECK(msg.escapedBody(), TQString("<b>HELLO WORLD</b>")); - CHECK(msg.escapedBody(), QString(" <b>HELLO WORLD</b> ")); - CHECK(msg.plainBody(), QString(" HELLO WORLD ")); - CHECK(msg.plainBody().stripWhiteSpace(), QString("HELLO WORLD")); - CHECK(msg.escapedBody().stripWhiteSpace(), QString(" <b>HELLO WORLD</b> ")); + CHECK(msg.escapedBody(), TQString(" <b>HELLO WORLD</b> ")); + CHECK(msg.plainBody(), TQString(" HELLO WORLD ")); + CHECK(msg.plainBody().stripWhiteSpace(), TQString("HELLO WORLD")); + CHECK(msg.escapedBody().stripWhiteSpace(), TQString(" <b>HELLO WORLD</b> ")); } { Kopete::Message msg( m_contactFrom, m_contactTo, "foo", Kopete::Message::Inbound, Kopete::Message::PlainText); msg.setBody("<p>foo", Kopete::Message::RichText); - CHECK(msg.escapedBody(), QString("foo")); + CHECK(msg.escapedBody(), TQString("foo")); msg.setBody("<p>foo</p>", Kopete::Message::RichText); - CHECK(msg.escapedBody(), QString("foo")); + CHECK(msg.escapedBody(), TQString("foo")); msg.setBody("\n<p>foo</p>\n<br/>", Kopete::Message::RichText); - CHECK(msg.escapedBody(), QString("foo<br/>")); + CHECK(msg.escapedBody(), TQString("foo<br/>")); } /********************************************** @@ -214,8 +214,8 @@ void KopeteMessage_Test::testPrimitives() CHECK(msg1.escapedBody(), msg2.escapedBody()); msg1.setBody("NEW", Kopete::Message::PlainText); - CHECK(msg1.plainBody(), QString("NEW")); - CHECK(msg2.plainBody(), QString("foo")); + CHECK(msg1.plainBody(), TQString("NEW")); + CHECK(msg2.plainBody(), TQString("foo")); } /********************************************** @@ -227,7 +227,7 @@ void KopeteMessage_Test::testPrimitives() { Kopete::Message msg2; - CHECK(msg2.plainBody(), QString::null); + CHECK(msg2.plainBody(), TQString::null); msg2 = msg1; @@ -235,13 +235,13 @@ void KopeteMessage_Test::testPrimitives() CHECK(msg1.escapedBody(), msg2.escapedBody()); msg1.setBody("NEW", Kopete::Message::PlainText); - CHECK(msg1.plainBody(), QString("NEW")); - CHECK(msg2.plainBody(), QString("foo")); + CHECK(msg1.plainBody(), TQString("NEW")); + CHECK(msg2.plainBody(), TQString("foo")); } - CHECK(msg1.plainBody(), QString("NEW")); + CHECK(msg1.plainBody(), TQString("NEW")); msg1 = msg1; - CHECK(msg1.plainBody(), QString("NEW")); + CHECK(msg1.plainBody(), TQString("NEW")); } } @@ -251,18 +251,18 @@ void KopeteMessage_Test::setup() void KopeteMessage_Test::testLinkParser() { - QString basePath = QString::fromLatin1( SRCDIR ) + QString::fromLatin1("/link-parser-testcases"); - QDir testCasesDir(basePath); + TQString basePath = TQString::fromLatin1( SRCDIR ) + TQString::fromLatin1("/link-parser-testcases"); + TQDir testCasesDir(basePath); - QStringList inputFileNames = testCasesDir.entryList("*.input"); - for ( QStringList::ConstIterator it = inputFileNames.begin(); it != inputFileNames.end(); ++it) + TQStringList inputFileNames = testCasesDir.entryList("*.input"); + for ( TQStringList::ConstIterator it = inputFileNames.begin(); it != inputFileNames.end(); ++it) { - QString fileName = *it; - QString outputFileName = fileName; + TQString fileName = *it; + TQString outputFileName = fileName; outputFileName.replace("input","output"); // open the input file - QFile inputFile(basePath + QString::fromLatin1("/") + fileName); - QFile expectedFile(basePath + QString::fromLatin1("/") + outputFileName); + TQFile inputFile(basePath + TQString::fromLatin1("/") + fileName); + TQFile expectedFile(basePath + TQString::fromLatin1("/") + outputFileName); // check if the expected output file exists // if it doesn't, skip the testcase if ( ! expectedFile.exists() ) @@ -272,10 +272,10 @@ void KopeteMessage_Test::testLinkParser() } if ( inputFile.open( IO_ReadOnly ) && expectedFile.open( IO_ReadOnly )) { - QTextStream inputStream(&inputFile); - QTextStream expectedStream(&expectedFile); - QString inputData; - QString expectedData; + TQTextStream inputStream(&inputFile); + TQTextStream expectedStream(&expectedFile); + TQString inputData; + TQString expectedData; inputData = inputStream.read(); expectedData = expectedStream.read(); @@ -288,21 +288,21 @@ void KopeteMessage_Test::testLinkParser() // set message format for parsing according to textcase filename convention Kopete::Message::MessageFormat format; - if ( fileName.section("-", 1, 1) == QString::fromLatin1("plaintext") ) + if ( fileName.section("-", 1, 1) == TQString::fromLatin1("plaintext") ) format = Kopete::Message::PlainText; else format = Kopete::Message::RichText; - QString result = Kopete::Message::parseLinks( inputData, format ); + TQString result = Kopete::Message::parseLinks( inputData, format ); // HACK to know the test case we applied, concatenate testcase name to both // input and expected string. WIll remove when I can add some sort of metadata // to a CHECK so debug its origin testcase - result = fileName + QString::fromLatin1(": ") + result; - expectedData = fileName + QString::fromLatin1(": ") + expectedData; + result = fileName + TQString::fromLatin1(": ") + result; + expectedData = fileName + TQString::fromLatin1(": ") + expectedData; // if the test case begins with broken, we expect it to fail, then use XFAIL // otherwise use CHECK - if ( fileName.section("-", 0, 0) == QString::fromLatin1("broken") ) + if ( fileName.section("-", 0, 0) == TQString::fromLatin1("broken") ) { //kdDebug() << "checking known-broken testcase: " << fileName << endl; XFAIL(result, expectedData); |