diff options
Diffstat (limited to 'kopete/protocols/oscar/liboscar/tests/logintest.cpp')
-rw-r--r-- | kopete/protocols/oscar/liboscar/tests/logintest.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/kopete/protocols/oscar/liboscar/tests/logintest.cpp b/kopete/protocols/oscar/liboscar/tests/logintest.cpp new file mode 100644 index 00000000..6dbc9646 --- /dev/null +++ b/kopete/protocols/oscar/liboscar/tests/logintest.cpp @@ -0,0 +1,56 @@ +//Licensed under the GNU General Public License + +#include "logintest.h" + +LoginTest::LoginTest(int argc, char ** argv) : QApplication( argc, argv ) +{ + // set up client stream + myConnector = new KNetworkConnector( 0 ); + myConnector->setOptHostPort( "login.oscar.aol.com", 5190 ); + myTestObject = new ClientStream( myConnector, myConnector); + + // notify when the transport layer is connected + //connect( myTestObject, SIGNAL( connected() ), SLOT( slotConnected() ) ); + myClient = new Client(); + + myConnection = new Connection( myConnector, myTestObject, "AUTHORIZER" ); + myConnection->setClient( myClient ); + // do test once the event loop is running + QTimer::singleShot( 0, this, SLOT( slotDoTest() ) ); + connected = false; +} + +LoginTest::~LoginTest() +{ + delete myTestObject; + delete myConnector; + delete myClient; +} + +void LoginTest::slotDoTest() +{ + QString server = QString::fromLatin1("login.oscar.aol.com"); + // connect to server + qDebug( "connecting to server "); + + myClient->setIsIcq( true ); + myClient->start( server, 5190, "userid", "password" ); + myClient->connectToServer( myConnection, server, true ); + connected = true; +} + +void LoginTest::slotConnected() +{ + qDebug( "connection is up"); + connected = true; +} + +int main(int argc, char ** argv) +{ + LoginTest a( argc, argv ); + a.exec(); + if ( !a.isConnected() ) + return 0; +} + +#include "logintest.moc" |