summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/oscar/liboscar/tests/ssigrouptest.cpp
blob: a1a9e754b4be37e36ce8e08ed8e826484b9a3984 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//Licensed under the GNU General Public License

#include "ssigrouptest.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 );
	QTimer::singleShot( 10000, this, SLOT(runAddGroupTest() ) );
	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;
}

void LoginTest::runAddGroupTest()
{
	qDebug( "running ssi group add test" );
	QString group = QString::fromLatin1( "dummygroup" );
	myClient->addGroup( group );
	QTimer::singleShot( 5000, this, SLOT( runDelGroupTest() ) );
}

void LoginTest::runDelGroupTest()
{
	qDebug( "running ssi group del test" );
	QString group = QString::fromLatin1( "dummygroup" );
	myClient->removeGroup( group );
}


#include "ssigrouptest.moc"