diff options
Diffstat (limited to 'kopete/kopete/chatwindow/tests/chatwindowstylerendering_test.cpp')
-rw-r--r-- | kopete/kopete/chatwindow/tests/chatwindowstylerendering_test.cpp | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/kopete/kopete/chatwindow/tests/chatwindowstylerendering_test.cpp b/kopete/kopete/chatwindow/tests/chatwindowstylerendering_test.cpp index af0f6b81..9fe66c06 100644 --- a/kopete/kopete/chatwindow/tests/chatwindowstylerendering_test.cpp +++ b/kopete/kopete/chatwindow/tests/chatwindowstylerendering_test.cpp @@ -21,10 +21,10 @@ #include <stdlib.h> // Qt includes -#include <qdir.h> -#include <qfile.h> -#include <qdatetime.h> -#include <qtextstream.h> +#include <tqdir.h> +#include <tqfile.h> +#include <tqdatetime.h> +#include <tqtextstream.h> // KDE includes #include <kapplication.h> @@ -53,7 +53,7 @@ KUNITTEST_MODULE_REGISTER_TESTER( ChatWindowStyleRendering_Test ); class FakeContact : public Kopete::Contact { public: - FakeContact (Kopete::Account *account, const QString &id, Kopete::MetaContact *mc ) : Kopete::Contact( account, id, mc ) {} + FakeContact (Kopete::Account *account, const TQString &id, Kopete::MetaContact *mc ) : Kopete::Contact( account, id, mc ) {} virtual Kopete::ChatSession *manager(Kopete::Contact::CanCreateFlags /*c*/) { return 0L; } virtual void slotUserInfo() {}; }; @@ -61,22 +61,22 @@ public: class FakeProtocol : public Kopete::Protocol { public: -FakeProtocol( KInstance *instance, QObject *parent, const char *name ) : Kopete::Protocol(instance, parent, name) +FakeProtocol( KInstance *instance, TQObject *parent, const char *name ) : Kopete::Protocol(instance, parent, name) { } -Account* createNewAccount( const QString &/*accountId*/ ) +Account* createNewAccount( const TQString &/*accountId*/ ) { return 0L; } -AddContactPage* createAddContactWidget( QWidget */*parent*/, Kopete::Account */*account*/) +AddContactPage* createAddContactWidget( TQWidget */*parent*/, Kopete::Account */*account*/) { return 0L; } -KopeteEditAccountWidget* createEditAccountWidget( Kopete::Account */*account*/, QWidget */*parent */) +KopeteEditAccountWidget* createEditAccountWidget( Kopete::Account */*account*/, TQWidget */*parent */) { return 0L; } @@ -86,7 +86,7 @@ KopeteEditAccountWidget* createEditAccountWidget( Kopete::Account */*account*/, class FakeAccount : public Kopete::Account { public: -FakeAccount(Kopete::Protocol *parent, const QString &accountID, const char *name) : Kopete::Account(parent, accountID, name) +FakeAccount(Kopete::Protocol *parent, const TQString &accountID, const char *name) : Kopete::Account(parent, accountID, name) { } @@ -96,7 +96,7 @@ FakeAccount(Kopete::Protocol *parent, const QString &accountID, const char *name } -bool createContact( const QString &/*contactId*/, Kopete::MetaContact */*parentContact*/ ) +bool createContact( const TQString &/*contactId*/, Kopete::MetaContact */*parentContact*/ ) { return true; } @@ -111,7 +111,7 @@ void disconnect() // do nothing } -void setOnlineStatus( const Kopete::OnlineStatus& /*status*/ , const QString &/*reason*/) +void setOnlineStatus( const Kopete::OnlineStatus& /*status*/ , const TQString &/*reason*/) { // do nothing } @@ -122,8 +122,8 @@ class ChatWindowStyleRendering_Test::Private public: Private() { - protocol = new FakeProtocol( new KInstance(QCString("test-kopete-message")), 0L, "test-kopete-message"); - account = new FakeAccount(protocol, QString("testaccount"), 0); + protocol = new FakeProtocol( new KInstance(TQCString("test-kopete-message")), 0L, "test-kopete-message"); + account = new FakeAccount(protocol, TQString("testaccount"), 0); // Create fake meta/contacts myselfMetaContact = new Kopete::MetaContact(); @@ -144,7 +144,7 @@ public: fakeChatSession->setDisplayName("Test Session"); // Create testStyle - testStyle = new ChatWindowStyle(QString(SRCDIR)+QString("/TestStyle")); + testStyle = new ChatWindowStyle(TQString(SRCDIR)+TQString("/TestStyle")); } ~Private() { @@ -163,7 +163,7 @@ public: Kopete::ChatSession *fakeChatSession; ChatWindowStyle *testStyle; - QString resultHTML; + TQString resultHTML; }; @@ -181,7 +181,7 @@ ChatWindowStyleRendering_Test::~ChatWindowStyleRendering_Test() void ChatWindowStyleRendering_Test::allTests() { // 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 ); KApplication::disableAutoDcopRegistration(); //KCmdLineArgs::init(argc,argv,"testkopetemessage", 0, 0, 0, 0); @@ -197,7 +197,7 @@ void ChatWindowStyleRendering_Test::allTests() void ChatWindowStyleRendering_Test::testHeaderRendering() { - QString expectedHtml = QString( + TQString expectedHtml = TQString( "<div><span id=\"KopeteHeaderChatNameInternal\">Test Session</span></div>\n" "<div>Bob</div>\n" "<div>Audrey</div>\n" @@ -205,11 +205,11 @@ void ChatWindowStyleRendering_Test::testHeaderRendering() "<div>Outgoing/buddy_icon.png</div>\n" "<div>%1</div>\n" "<div>%2</div>" - ).arg(KGlobal::locale()->formatDateTime( QDateTime::currentDateTime(), true, true ) ) - .arg(QDateTime::currentDateTime().toString("hh:mm")); + ).arg(KGlobal::locale()->formatDateTime( TQDateTime::currentDateTime(), true, true ) ) + .arg(TQDateTime::currentDateTime().toString("hh:mm")); - QString headerHtml = d->testStyle->getHeaderHtml(); - QString resultHtml; + TQString headerHtml = d->testStyle->getHeaderHtml(); + TQString resultHtml; resultHtml = chatPart->formatStyleKeywords(headerHtml); @@ -220,7 +220,7 @@ void ChatWindowStyleRendering_Test::testHeaderRendering() void ChatWindowStyleRendering_Test::testMessageRendering() { - QString expectedIncomingHtml = QString( + TQString expectedIncomingHtml = TQString( "Incoming:\n" "<div>Incoming/buddy_icon.png</div>\n" "<div><a href=\"kopetemessage://audrey@localhost/?protocolId=Kopete::Protocol&accountId=testaccount\" class=\"KopeteDisplayName\">audrey@localhost</a></div>\n" @@ -230,9 +230,9 @@ void ChatWindowStyleRendering_Test::testMessageRendering() "<div>%1</div>\n" "<div>%2</div>\n" "<div id=\"insert\">" - ).arg( QDateTime::currentDateTime().toString( "hh:mm:ss" ), QDateTime::currentDateTime().toString( "hh:mm" ) ); + ).arg( TQDateTime::currentDateTime().toString( "hh:mm:ss" ), TQDateTime::currentDateTime().toString( "hh:mm" ) ); - QString expectedOutgoingHtml = QString( + TQString expectedOutgoingHtml = TQString( "Outgoing:\n" "<div>Outgoing/buddy_icon.png</div>\n" "<div><a href=\"kopetemessage://bob@localhost/?protocolId=Kopete::Protocol&accountId=testaccount\" class=\"KopeteDisplayName\">bob@localhost</a></div>\n" @@ -242,14 +242,14 @@ void ChatWindowStyleRendering_Test::testMessageRendering() "<div>%1</div>\n" "<div>%2</div>\n" "<div id=\"insert\">" - ).arg( QDateTime::currentDateTime().toString( "hh:mm:ss" ), QDateTime::currentDateTime().toString( "hh:mm" ) ); + ).arg( TQDateTime::currentDateTime().toString( "hh:mm:ss" ), TQDateTime::currentDateTime().toString( "hh:mm" ) ); - QString tempHtml; - QString resultHtml; + TQString tempHtml; + TQString resultHtml; - Kopete::Message msgIn(d->other, d->myself, QString::fromUtf8("Test"), Kopete::Message::Inbound ); - Kopete::Message msgOut(d->myself, d->other, QString::fromUtf8("Hello there"), Kopete::Message::Outbound); + Kopete::Message msgIn(d->other, d->myself, TQString::fromUtf8("Test"), Kopete::Message::Inbound ); + Kopete::Message msgOut(d->myself, d->other, TQString::fromUtf8("Hello there"), Kopete::Message::Outbound); tempHtml = d->testStyle->getIncomingHtml(); resultHtml = chatPart->formatStyleKeywords(tempHtml, msgIn); @@ -268,16 +268,16 @@ void ChatWindowStyleRendering_Test::testMessageRendering() void ChatWindowStyleRendering_Test::testStatusRendering() { - QString expectedStatusHtml = QString( + TQString expectedStatusHtml = TQString( "<div><span style=\"\"class=\"KopeteMessageBody\">A contact went offline.</span></div>\n" "<div>%1</div>\n" "<div>%2</div>" - ).arg( QDateTime::currentDateTime().toString( "hh:mm:ss" ), QDateTime::currentDateTime().toString( "hh:mm" ) ); + ).arg( TQDateTime::currentDateTime().toString( "hh:mm:ss" ), TQDateTime::currentDateTime().toString( "hh:mm" ) ); - QString statusHtml = d->testStyle->getStatusHtml(); - QString resultHtml; + TQString statusHtml = d->testStyle->getStatusHtml(); + TQString resultHtml; - Kopete::Message msgStatus(0,0, QString::fromUtf8("A contact went offline."), Kopete::Message::Internal); + Kopete::Message msgStatus(0,0, TQString::fromUtf8("A contact went offline."), Kopete::Message::Internal); resultHtml = chatPart->formatStyleKeywords(statusHtml, msgStatus); CHECK(resultHtml, expectedStatusHtml); @@ -285,17 +285,17 @@ void ChatWindowStyleRendering_Test::testStatusRendering() void ChatWindowStyleRendering_Test::testFullRendering() { - QString expectedFullHtml; - QString resultHtml; - - Kopete::Message msgIn1(d->myself, d->other, QString("Hello there !"), Kopete::Message::Inbound); - Kopete::Message msgIn2(d->myself, d->other, QString("How are you doing ?"), Kopete::Message::Inbound); - Kopete::Message msgOut1(d->other, d->myself, QString("Fine and you ?"), Kopete::Message::Outbound); - Kopete::Message msgStatus1(d->myself,d->other, QString("You are now marked as away."), Kopete::Message::Internal); - Kopete::Message msgStatus2(d->myself,d->other, QString("You are now marked as online."), Kopete::Message::Internal); - Kopete::Message msgIn3(d->myself, d->other, QString("Well, doing some tests."), Kopete::Message::Internal); - Kopete::Message msgOut2(d->other, d->myself, QString("All your bases are belong to us."), Kopete::Message::Outbound); - Kopete::Message msgOut3(d->other, d->myself, QString("You are on the way to destruction"), Kopete::Message::Outbound); + TQString expectedFullHtml; + TQString resultHtml; + + Kopete::Message msgIn1(d->myself, d->other, TQString("Hello there !"), Kopete::Message::Inbound); + Kopete::Message msgIn2(d->myself, d->other, TQString("How are you doing ?"), Kopete::Message::Inbound); + Kopete::Message msgOut1(d->other, d->myself, TQString("Fine and you ?"), Kopete::Message::Outbound); + Kopete::Message msgStatus1(d->myself,d->other, TQString("You are now marked as away."), Kopete::Message::Internal); + Kopete::Message msgStatus2(d->myself,d->other, TQString("You are now marked as online."), Kopete::Message::Internal); + Kopete::Message msgIn3(d->myself, d->other, TQString("Well, doing some tests."), Kopete::Message::Internal); + Kopete::Message msgOut2(d->other, d->myself, TQString("All your bases are belong to us."), Kopete::Message::Outbound); + Kopete::Message msgOut3(d->other, d->myself, TQString("You are on the way to destruction"), Kopete::Message::Outbound); // Change style on the fly in ChatMessagePart so this test would run chatPart->setStyle(d->testStyle); @@ -313,11 +313,11 @@ void ChatWindowStyleRendering_Test::testFullRendering() resultHtml = chatPart->htmlDocument().toHTML(); // Read the expected(sample) HTML from file. - QFile sampleHtml(QString(SRCDIR)+"sample.html"); + TQFile sampleHtml(TQString(SRCDIR)+"sample.html"); if(sampleHtml.open(IO_ReadOnly)) { - QTextStream stream(&sampleHtml); - stream.setEncoding(QTextStream::UnicodeUTF8); + TQTextStream stream(&sampleHtml); + stream.setEncoding(TQTextStream::UnicodeUTF8); expectedFullHtml = stream.read(); sampleHtml.close(); } |