diff --git a/tests/fswatcher/fswatchertest.cpp b/tests/fswatcher/fswatchertest.cpp index 19aea462fb..eff0df1298 100644 --- a/tests/fswatcher/fswatchertest.cpp +++ b/tests/fswatcher/fswatchertest.cpp @@ -128,32 +128,32 @@ public: // static helpers static const wxFileName& GetWatchDir() { - static wxFileName dir; - - if (dir.DirExists()) - return dir; + if (ms_watchDir.DirExists()) + return ms_watchDir; wxString tmp = wxStandardPaths::Get().GetTempDir(); - dir.AssignDir(tmp); + ms_watchDir.AssignDir(tmp); // XXX look for more unique name? there is no function to generate // unique filename, the file always get created... - dir.AppendDir("fswatcher_test"); - REQUIRE(!dir.DirExists()); - REQUIRE(dir.Mkdir()); + ms_watchDir.AppendDir("fswatcher_test"); + REQUIRE(!ms_watchDir.DirExists()); + REQUIRE(ms_watchDir.Mkdir()); + REQUIRE(ms_watchDir.DirExists()); - return dir; + return ms_watchDir; } static void RemoveWatchDir() { - wxFileName dir = GetWatchDir(); - REQUIRE(dir.DirExists()); + REQUIRE(ms_watchDir.DirExists()); // just to be really sure we know what we remove - REQUIRE( dir.GetDirs().Last() == "fswatcher_test" ); + REQUIRE( ms_watchDir.GetDirs().Last() == "fswatcher_test" ); - CHECK( dir.Rmdir(wxPATH_RMDIR_RECURSIVE) ); + CHECK( ms_watchDir.Rmdir(wxPATH_RMDIR_RECURSIVE) ); + + ms_watchDir = wxFileName(); } static wxFileName RandomName(const wxFileName& base, int length = 10) @@ -178,9 +178,13 @@ public: protected: static EventGenerator* ms_instance; + +private: + static wxFileName ms_watchDir; }; EventGenerator* EventGenerator::ms_instance = 0; +wxFileName EventGenerator::ms_watchDir; // Abstract base class from which concrete event tests inherit. @@ -799,7 +803,6 @@ TEST_CASE_METHOD(FileSystemWatcherTestCase, // We don't use this function for events. Just run the tests wxFileName watchdir = EventGenerator::GetWatchDir(); - REQUIRE(watchdir.DirExists()); wxFileName treedir(watchdir); treedir.AppendDir("treetrunk");