+#ifdef wxHAS_INOTIFY
+// ----------------------------------------------------------------------------
+// TestEventAttribute
+// ----------------------------------------------------------------------------
+void FileSystemWatcherTestCase::TestEventAttribute()
+{
+ wxLogDebug("TestEventAttribute()");
+
+ class EventTester : public EventHandler
+ {
+ public:
+ virtual void GenerateEvent()
+ {
+ CPPUNIT_ASSERT(eg.TouchFile());
+ }
+
+ virtual wxFileSystemWatcherEvent ExpectedEvent()
+ {
+ wxFileSystemWatcherEvent event(wxFSW_EVENT_ATTRIB);
+ event.SetPath(eg.m_file);
+ event.SetNewPath(eg.m_file);
+ return event;
+ }
+ };
+
+ // we need to create a file to touch
+ EventGenerator::Get().CreateFile();
+
+ EventTester tester;
+ tester.Run();
+}
+
+// ----------------------------------------------------------------------------
+// TestSingleWatchtypeEvent: Watch only wxFSW_EVENT_ACCESS
+// ----------------------------------------------------------------------------
+void FileSystemWatcherTestCase::TestSingleWatchtypeEvent()
+{
+ wxLogDebug("TestSingleWatchtypeEvent()");
+
+ class EventTester : public EventHandler
+ {
+ public:
+ // We could pass wxFSW_EVENT_CREATE or MODIFY instead, but not RENAME or
+ // DELETE as the event path fields would be wrong in CheckResult()
+ EventTester() : EventHandler(wxFSW_EVENT_ACCESS) {}
+
+ virtual void GenerateEvent()
+ {
+ // As wxFSW_EVENT_ACCESS is passed to the ctor only ReadFile() will
+ // generate an event. Without it they all will, and the test fails
+ CPPUNIT_ASSERT(eg.CreateFile());
+ CPPUNIT_ASSERT(eg.ModifyFile());
+ CPPUNIT_ASSERT(eg.ReadFile());
+ }
+
+ virtual wxFileSystemWatcherEvent ExpectedEvent()
+ {
+ wxFileSystemWatcherEvent event(wxFSW_EVENT_ACCESS);
+ event.SetPath(eg.m_file);
+ event.SetNewPath(eg.m_file);
+ return event;
+ }
+ };
+
+ EventTester tester;
+ tester.Run();
+}
+#endif // wxHAS_INOTIFY
+