1f35c72b9SNicolas Bonnefon #include <QMutex> 2f35c72b9SNicolas Bonnefon #include <QWaitCondition> 3f35c72b9SNicolas Bonnefon #include <QtTest/QtTest> 4f35c72b9SNicolas Bonnefon 50b28d87cSNicolas Bonnefon class LogData; 60b28d87cSNicolas Bonnefon class LogFilteredData; 70b28d87cSNicolas Bonnefon 8f35c72b9SNicolas Bonnefon class TestLogFilteredData: public QObject 9f35c72b9SNicolas Bonnefon { 10f35c72b9SNicolas Bonnefon Q_OBJECT 11f35c72b9SNicolas Bonnefon 120b28d87cSNicolas Bonnefon public: 130b28d87cSNicolas Bonnefon TestLogFilteredData(); 140b28d87cSNicolas Bonnefon 15f35c72b9SNicolas Bonnefon private slots: 16f35c72b9SNicolas Bonnefon void initTestCase(); 17f35c72b9SNicolas Bonnefon 18f35c72b9SNicolas Bonnefon void simpleSearch(); 19f35c72b9SNicolas Bonnefon void multipleSearch(); 2064c49544SNicolas Bonnefon void marks(); 21*a1e4ce92SNicolas Bonnefon void lineLength(); 22ba40a297SNicolas Bonnefon void updateSearch(); 23f35c72b9SNicolas Bonnefon 24f35c72b9SNicolas Bonnefon public slots: 25f35c72b9SNicolas Bonnefon void loadingFinished(); 26f35c72b9SNicolas Bonnefon void searchProgressed( int completion, int nbMatches ); 27f35c72b9SNicolas Bonnefon 28f35c72b9SNicolas Bonnefon private: 29f35c72b9SNicolas Bonnefon bool generateDataFiles(); 300b28d87cSNicolas Bonnefon 310b28d87cSNicolas Bonnefon void simpleSearchTest(); 320b28d87cSNicolas Bonnefon void multipleSearchTest(); 330b28d87cSNicolas Bonnefon void updateSearchTest(); 3464c49544SNicolas Bonnefon void marksTest(); 35*a1e4ce92SNicolas Bonnefon void lineLengthTest(); 360b28d87cSNicolas Bonnefon 370b28d87cSNicolas Bonnefon std::pair<int,int> waitSearchProgressed(); 380b28d87cSNicolas Bonnefon void waitLoadingFinished(); 390b28d87cSNicolas Bonnefon void signalSearchProgressedRead(); 400b28d87cSNicolas Bonnefon void signalLoadingFinishedRead(); 410b28d87cSNicolas Bonnefon 420b28d87cSNicolas Bonnefon LogData* logData_; 430b28d87cSNicolas Bonnefon LogFilteredData* filteredData_; 440b28d87cSNicolas Bonnefon 450b28d87cSNicolas Bonnefon // Synchronisation variables (protected by the two mutexes) 460b28d87cSNicolas Bonnefon bool loadingFinished_received_; 470b28d87cSNicolas Bonnefon bool loadingFinished_read_; 480b28d87cSNicolas Bonnefon bool searchProgressed_received_; 490b28d87cSNicolas Bonnefon bool searchProgressed_read_; 500b28d87cSNicolas Bonnefon 510b28d87cSNicolas Bonnefon int searchLastMatches_; 520b28d87cSNicolas Bonnefon int searchLastProgress_; 530b28d87cSNicolas Bonnefon 540b28d87cSNicolas Bonnefon QMutex loadingFinishedMutex_; 550b28d87cSNicolas Bonnefon QMutex searchProgressedMutex_; 560b28d87cSNicolas Bonnefon 570b28d87cSNicolas Bonnefon QWaitCondition loadingFinishedCondition_; 580b28d87cSNicolas Bonnefon QWaitCondition searchProgressedCondition_; 59f35c72b9SNicolas Bonnefon }; 60