summaryrefslogtreecommitdiffstats
path: root/libcommuni/tests/auto/shared/tst_ircclientserver.cpp
diff options
context:
space:
mode:
authorMarkus Mittendrein <git@maxmitti.tk>2015-09-09 19:00:56 +0200
committerMarkus Mittendrein <git@maxmitti.tk>2015-09-09 19:02:23 +0200
commit8a6d4b06f2291c363f3dea17837ed20893852453 (patch)
treec091375499e35eaa1810586454e0834c06e6c9b2 /libcommuni/tests/auto/shared/tst_ircclientserver.cpp
parentf554a27046f203e56a07baaf214d90834942e3f5 (diff)
downloadmanager-8a6d4b06f2291c363f3dea17837ed20893852453.tar.gz
manager-8a6d4b06f2291c363f3dea17837ed20893852453.zip
Cleanup repo with some directories
Diffstat (limited to 'libcommuni/tests/auto/shared/tst_ircclientserver.cpp')
-rw-r--r--libcommuni/tests/auto/shared/tst_ircclientserver.cpp67
1 files changed, 0 insertions, 67 deletions
diff --git a/libcommuni/tests/auto/shared/tst_ircclientserver.cpp b/libcommuni/tests/auto/shared/tst_ircclientserver.cpp
deleted file mode 100644
index 2a76ead..0000000
--- a/libcommuni/tests/auto/shared/tst_ircclientserver.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2008-2014 The Communi Project
- *
- * This test is free, and not covered by the BSD license. There is no
- * restriction applied to their modification, redistribution, using and so on.
- * You can study them, modify them, use them in your own program - either
- * completely or partially.
- */
-
-#include "tst_ircclientserver.h"
-
-tst_IrcClientServer::tst_IrcClientServer()
-{
- server = new QTcpServer(this);
-}
-
-void tst_IrcClientServer::initTestCase()
-{
- QVERIFY(server->listen());
-}
-
-void tst_IrcClientServer::cleanupTestCase()
-{
- server->close();
-}
-
-void tst_IrcClientServer::init()
-{
- connection = new IrcConnection(this);
- connection->setUserName("user");
- connection->setNickName("nick");
- connection->setRealName("real");
- connection->setPassword("secret");
- connection->setHost("127.0.0.1");
- connection->setPort(server->serverPort());
-}
-
-void tst_IrcClientServer::cleanup()
-{
- delete connection;
-}
-
-bool tst_IrcClientServer::waitForOpened(int timeout)
-{
- if (!server->waitForNewConnection(timeout))
- return false;
- serverSocket = server->nextPendingConnection();
- clientSocket = connection->socket();
- return serverSocket && clientSocket && clientSocket->waitForConnected(1000);
-}
-
-bool tst_IrcClientServer::waitForWritten(const QByteArray& data, int timeout)
-{
- if (!data.isNull()) {
- if (data.count('\n') > 1) {
- bool success = true;
- foreach (const QByteArray& line, data.split('\n'))
- success &= waitForWritten(line + '\n', timeout);
- return success;
- }
- if (data.endsWith('\r') || data.endsWith('\n'))
- serverSocket->write(data);
- else
- serverSocket->write(data + "\r\n");
- }
- return serverSocket->waitForBytesWritten(timeout) && clientSocket->waitForReadyRead(timeout);
-}