From ce4a32fe52ef09d8f5ff1dd22c001110902b60a2 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kio/tests/kdirwatchunittest.h | 66 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 kio/tests/kdirwatchunittest.h (limited to 'kio/tests/kdirwatchunittest.h') diff --git a/kio/tests/kdirwatchunittest.h b/kio/tests/kdirwatchunittest.h new file mode 100644 index 000000000..417cdf24e --- /dev/null +++ b/kio/tests/kdirwatchunittest.h @@ -0,0 +1,66 @@ + /* + This file is or will be part of KDE desktop environment + + Copyright 1998 Sven Radej + + It is licensed under GPL version 2. + + If it is part of KDE libraries than this file is licensed under + LGPL version 2. + */ + +#ifndef _KDIRWATCHTEST_H_ +#define _KDIRWATCHTEST_H_ + +#include +#include +#include + +#include "kdirwatch.h" +#include "kapplication.h" + +#include +#include + +class KDirWatchTest : public KUnitTest::Tester +{ + Q_OBJECT + +public: + enum { sigDirty, sigCreated, sigDeleted }; + + KDirWatchTest() + { + m_signals[sigDirty] = m_signals[sigCreated] = m_signals[sigDeleted] = 0; + m_workingDir = "/tmp/kdirwatchtest"; + } + + virtual void allTests(); + +private slots: + void slotDirty (const QString& s) { m_signals[sigDirty]++; m_lastSignal = s; } + void slotCreated (const QString& s) { m_signals[sigCreated]++; m_lastSignal = s; } + void slotDeleted (const QString& s) { m_signals[sigDeleted]++; m_lastSignal = s; } + +private: + unsigned m_signals[3]; + + /* verify nothing happens */ + void VERIFY_NOTHING(); + /* verify that dirty got emitted */ + void VERIFY_DIRTY (const QString&); + /* verify that created got emitted */ + void VERIFY_CREATED (const QString&); + /* verify that deleted got emitted */ + void VERIFY_DELETED (const QString&); + + void touch_file (const QString& file); + void remove_file (const QString& file); + void rename_file (const QString& from, const QString& to); + + QString m_lastSignal; + QString m_workingDir; + KDirWatch* d; +}; + +#endif -- cgit v1.2.1