]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/file/dir.cpp
Ensure that detached menus don't keep focus grab in wxGTK.
[wxWidgets.git] / tests / file / dir.cpp
index c5151d243e6d937f4c6ae8631ad3a3e3fb568927..2cabeb27ae9c0748b6a2af806085b174889261ae 100644 (file)
@@ -82,15 +82,19 @@ void DirTestCase::setUp()
     wxDir::Make(DIRTEST_FOLDER + SEP + "folder1" + SEP + "subfolder2", wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL);
     wxDir::Make(DIRTEST_FOLDER + SEP + "folder2", wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL);
     wxDir::Make(DIRTEST_FOLDER + SEP + "folder3" + SEP + "subfolder1", wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL);
     wxDir::Make(DIRTEST_FOLDER + SEP + "folder1" + SEP + "subfolder2", wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL);
     wxDir::Make(DIRTEST_FOLDER + SEP + "folder2", wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL);
     wxDir::Make(DIRTEST_FOLDER + SEP + "folder3" + SEP + "subfolder1", wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL);
-    
+
     CreateTempFile(DIRTEST_FOLDER + SEP + "folder1" + SEP + "subfolder2" + SEP + "dummy");
     CreateTempFile(DIRTEST_FOLDER + SEP + "dummy");
     CreateTempFile(DIRTEST_FOLDER + SEP + "folder1" + SEP + "subfolder2" + SEP + "dummy");
     CreateTempFile(DIRTEST_FOLDER + SEP + "dummy");
+    CreateTempFile(DIRTEST_FOLDER + SEP + "folder3" + SEP + "subfolder1" + SEP + "dummy.foo");
+    CreateTempFile(DIRTEST_FOLDER + SEP + "folder3" + SEP + "subfolder1" + SEP + "dummy.foo.bar");
 }
 
 void DirTestCase::tearDown()
 {
     wxRemove(DIRTEST_FOLDER + SEP + "folder1" + SEP + "subfolder2" + SEP + "dummy");
     wxRemove(DIRTEST_FOLDER + SEP + "dummy");
 }
 
 void DirTestCase::tearDown()
 {
     wxRemove(DIRTEST_FOLDER + SEP + "folder1" + SEP + "subfolder2" + SEP + "dummy");
     wxRemove(DIRTEST_FOLDER + SEP + "dummy");
+    wxRemove(DIRTEST_FOLDER + SEP + "folder3" + SEP + "subfolder1" + SEP + "dummy.foo");
+    wxRemove(DIRTEST_FOLDER + SEP + "folder3" + SEP + "subfolder1" + SEP + "dummy.foo.bar");
     wxDir::Remove(DIRTEST_FOLDER, wxPATH_RMDIR_RECURSIVE);
 }
 
     wxDir::Remove(DIRTEST_FOLDER, wxPATH_RMDIR_RECURSIVE);
 }
 
@@ -160,7 +164,10 @@ void DirTestCase::Traverse()
 {
     // enum all files
     wxArrayString files;
 {
     // enum all files
     wxArrayString files;
-    CPPUNIT_ASSERT_EQUAL(2, wxDir::GetAllFiles(DIRTEST_FOLDER, &files));
+    CPPUNIT_ASSERT_EQUAL(4, wxDir::GetAllFiles(DIRTEST_FOLDER, &files));
+
+    // enum all files according to the filter
+    CPPUNIT_ASSERT_EQUAL(1, wxDir::GetAllFiles(DIRTEST_FOLDER, &files, "*.foo"));
 
     // enum again with custom traverser
     wxDir dir(DIRTEST_FOLDER);
 
     // enum again with custom traverser
     wxDir dir(DIRTEST_FOLDER);
@@ -235,9 +242,13 @@ void DirTestCase::GetName()
 
     CPPUNIT_ASSERT( d.Open(".") );
     CPPUNIT_ASSERT( d.GetName().Last() != wxFILE_SEP_PATH );
 
     CPPUNIT_ASSERT( d.Open(".") );
     CPPUNIT_ASSERT( d.GetName().Last() != wxFILE_SEP_PATH );
+    CPPUNIT_ASSERT( d.GetNameWithSep().Last() == wxFILE_SEP_PATH );
+    CPPUNIT_ASSERT_EQUAL( d.GetName() + wxFILE_SEP_PATH,
+                          d.GetNameWithSep() );
 
 #ifdef __UNIX__
     CPPUNIT_ASSERT( d.Open("/") );
     CPPUNIT_ASSERT_EQUAL( "/", d.GetName() );
 
 #ifdef __UNIX__
     CPPUNIT_ASSERT( d.Open("/") );
     CPPUNIT_ASSERT_EQUAL( "/", d.GetName() );
+    CPPUNIT_ASSERT_EQUAL( "/", d.GetNameWithSep() );
 #endif
 }
 #endif
 }