X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcontrib%2Flibqxt-2007-10-24%2Ftests%2FQxtFileLock%2Fsrc%2Flocktestclient.cpp;fp=src%2Fcontrib%2Flibqxt-2007-10-24%2Ftests%2FQxtFileLock%2Fsrc%2Flocktestclient.cpp;h=0000000000000000000000000000000000000000;hp=bc2f800f90a0681b1618efd137611ed259d46b04;hb=140d8a132103d2fa9baf55036e09b165624de167;hpb=97d674034551438238c568e8b42efb08e1ba7354 diff --git a/src/contrib/libqxt-2007-10-24/tests/QxtFileLock/src/locktestclient.cpp b/src/contrib/libqxt-2007-10-24/tests/QxtFileLock/src/locktestclient.cpp deleted file mode 100644 index bc2f800f..00000000 --- a/src/contrib/libqxt-2007-10-24/tests/QxtFileLock/src/locktestclient.cpp +++ /dev/null @@ -1,104 +0,0 @@ -#include "locktestclient.h" -#include -#include -#include -#include -#include - -LockTestClient::LockTestClient(QObject *parent) - : QObject(parent) -{ -} - - -LockTestClient::~LockTestClient() -{ -} - -void LockTestClient::startTests() -{ - QTcpSocket socket; - socket.connectToHost ( "localhost", 55555); - char control; - - #define GetNextCommand() if(socket.waitForReadyRead (-1) )\ - {\ - if(socket.bytesAvailable() > 1)\ - qDebug()<<"Something is wrong here";\ - socket.getChar(&control);\ - if(control == 'a')\ - {\ - socket.disconnectFromHost();\ - return;\ - }\ - if(control != 'n')\ - { \ - qDebug()<<"Wrong control command";\ - }\ - } - - if(socket.waitForConnected (-1)) - { - QFile file("lock.file"); - - if(!file.open(QIODevice::ReadWrite)) - { - qDebug()<<"Could not open lockfile"; - return; - } - - if(1) - { - GetNextCommand(); - //Trying to readlock the same region - QxtFileLock lock(&file,0x10,20,QxtFileLock::ReadLock); - if(lock.lock()) - socket.putChar('s'); //s for success f for fail - else - socket.putChar('f'); - socket.waitForBytesWritten(-1); - } - - if(1) - { - GetNextCommand(); - //Trying to lock the same region with different locks - QxtFileLock lock(&file,0x10,20,QxtFileLock::WriteLock); - - if(!lock.lock()) - socket.putChar('s'); //s for success f for fail - else - socket.putChar('f'); - socket.waitForBytesWritten(-1); - } - - if(1) - { - GetNextCommand(); - //Trying to writelock the same region - QxtFileLock lock(&file,0x10,20,QxtFileLock::WriteLock); - - if(!lock.lock()) - socket.putChar('s'); //s for success f for fail - else - socket.putChar('f'); - socket.waitForBytesWritten(-1); - } - - if(1) - { - GetNextCommand(); - //Trying to writelock different regions - QxtFileLock lock(&file,0x10+21,20,QxtFileLock::WriteLock); - - if(lock.lock()) - socket.putChar('s'); //s for success f for fail - else - socket.putChar('f'); - socket.waitForBytesWritten(-1); - } - - } -} - -