TDE core libraries
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

kdirwatchunittest.h 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. This file is or will be part of KDE desktop environment
  3. Copyright 1998 Sven Radej <sven@lisa.exp.univie.ac.at>
  4. It is licensed under GPL version 2.
  5. If it is part of KDE libraries than this file is licensed under
  6. LGPL version 2.
  7. */
  8. #ifndef _KDIRWATCHTEST_H_
  9. #define _KDIRWATCHTEST_H_
  10. #include <stdlib.h>
  11. #include <stdio.h>
  12. #include <tqobject.h>
  13. #include "kdirwatch.h"
  14. #include "tdeapplication.h"
  15. #include <tdeunittest/tester.h>
  16. #include <tdeunittest/module.h>
  17. class KDirWatchTest : public KUnitTest::Tester
  18. {
  19. Q_OBJECT
  20. public:
  21. enum { sigDirty, sigCreated, sigDeleted };
  22. KDirWatchTest()
  23. {
  24. m_signals[sigDirty] = m_signals[sigCreated] = m_signals[sigDeleted] = 0;
  25. m_workingDir = "/tmp/kdirwatchtest";
  26. }
  27. virtual void allTests();
  28. private slots:
  29. void slotDirty (const TQString& s) { m_signals[sigDirty]++; m_lastSignal = s; }
  30. void slotCreated (const TQString& s) { m_signals[sigCreated]++; m_lastSignal = s; }
  31. void slotDeleted (const TQString& s) { m_signals[sigDeleted]++; m_lastSignal = s; }
  32. private:
  33. unsigned m_signals[3];
  34. /* verify nothing happens */
  35. void VERIFY_NOTHING();
  36. /* verify that dirty got emitted */
  37. void VERIFY_DIRTY (const TQString&);
  38. /* verify that created got emitted */
  39. void VERIFY_CREATED (const TQString&);
  40. /* verify that deleted got emitted */
  41. void VERIFY_DELETED (const TQString&);
  42. void touch_file (const TQString& file);
  43. void remove_file (const TQString& file);
  44. void rename_file (const TQString& from, const TQString& to);
  45. TQString m_lastSignal;
  46. TQString m_workingDir;
  47. KDirWatch* d;
  48. };
  49. #endif