summaryrefslogtreecommitdiffstats
path: root/tdeio/tests/kdirwatchunittest.h
diff options
context:
space:
mode:
authorDarrell Anderson <humanreadable@yahoo.com>2013-03-02 15:57:34 -0600
committerDarrell Anderson <humanreadable@yahoo.com>2013-03-02 15:57:34 -0600
commit7c0b0c9dc9fcbe9c198925bdc7ee18ac6be49f4f (patch)
treec76702a7f6310fbe9d437e347535422e836e94e9 /tdeio/tests/kdirwatchunittest.h
parenta2a38be7600e2a2c2b49c66902d912ca036a2c0f (diff)
parent27bbee9a5f9dcda53d8eb23863ee670ad1360e41 (diff)
downloadtdelibs-7c0b0c9dc9fcbe9c198925bdc7ee18ac6be49f4f.tar.gz
tdelibs-7c0b0c9dc9fcbe9c198925bdc7ee18ac6be49f4f.zip
Merge branch 'master' of http://scm.trinitydesktop.org/scm/git/tdelibs
Diffstat (limited to 'tdeio/tests/kdirwatchunittest.h')
-rw-r--r--tdeio/tests/kdirwatchunittest.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/tdeio/tests/kdirwatchunittest.h b/tdeio/tests/kdirwatchunittest.h
new file mode 100644
index 000000000..416aeecfe
--- /dev/null
+++ b/tdeio/tests/kdirwatchunittest.h
@@ -0,0 +1,66 @@
+ /*
+ This file is or will be part of KDE desktop environment
+
+ Copyright 1998 Sven Radej <sven@lisa.exp.univie.ac.at>
+
+ 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 <stdlib.h>
+#include <stdio.h>
+#include <tqobject.h>
+
+#include "kdirwatch.h"
+#include "tdeapplication.h"
+
+#include <tdeunittest/tester.h>
+#include <tdeunittest/module.h>
+
+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 TQString& s) { m_signals[sigDirty]++; m_lastSignal = s; }
+ void slotCreated (const TQString& s) { m_signals[sigCreated]++; m_lastSignal = s; }
+ void slotDeleted (const TQString& 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 TQString&);
+ /* verify that created got emitted */
+ void VERIFY_CREATED (const TQString&);
+ /* verify that deleted got emitted */
+ void VERIFY_DELETED (const TQString&);
+
+ void touch_file (const TQString& file);
+ void remove_file (const TQString& file);
+ void rename_file (const TQString& from, const TQString& to);
+
+ TQString m_lastSignal;
+ TQString m_workingDir;
+ KDirWatch* d;
+};
+
+#endif