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
|
#include <QMutex>
#include <QWaitCondition>
#include <QtTest/QtTest>
class LogData;
class LogFilteredData;
class TestLogFilteredData: public QObject
{
Q_OBJECT
public:
TestLogFilteredData();
private slots:
void initTestCase();
void simpleSearch();
void multipleSearch();
void marks();
void lineLength();
void updateSearch();
public slots:
void loadingFinished();
void searchProgressed( int completion, int nbMatches );
private:
bool generateDataFiles();
void simpleSearchTest();
void multipleSearchTest();
void updateSearchTest();
void marksTest();
void lineLengthTest();
std::pair<int,int> waitSearchProgressed();
void waitLoadingFinished();
void signalSearchProgressedRead();
void signalLoadingFinishedRead();
LogData* logData_;
LogFilteredData* filteredData_;
// Synchronisation variables (protected by the two mutexes)
bool loadingFinished_received_;
bool loadingFinished_read_;
bool searchProgressed_received_;
bool searchProgressed_read_;
int searchLastMatches_;
int searchLastProgress_;
QMutex loadingFinishedMutex_;
QMutex searchProgressedMutex_;
QWaitCondition loadingFinishedCondition_;
QWaitCondition searchProgressedCondition_;
};
|