]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/console/console.cpp
redefined TRUE and FALSE to be of type bool
[wxWidgets.git] / samples / console / console.cpp
index 518f525f3caff419b98e43b43811124fc1d6c2c3..edac5f6bf224661dc625cb00bb048562e08194cc 100644 (file)
@@ -91,7 +91,7 @@
     #undef TEST_ALL
     static const bool TEST_ALL = TRUE;
 #else
-    #define TEST_THREADS
+    #define TEST_FILENAME
 
     static const bool TEST_ALL = FALSE;
 #endif
@@ -184,11 +184,11 @@ static void TestCharset()
 
     for ( size_t n = 0; n < WXSIZEOF(charsets); n++ )
     {
-        wxFontEncoding enc = wxTheFontMapper->CharsetToEncoding(charsets[n]);
+        wxFontEncoding enc = wxFontMapper::Get()->CharsetToEncoding(charsets[n]);
         wxPrintf(_T("Charset: %s\tEncoding: %s (%s)\n"),
                  charsets[n],
-                 wxTheFontMapper->GetEncodingName(enc).c_str(),
-                 wxTheFontMapper->GetEncodingDescription(enc).c_str());
+                 wxFontMapper::Get()->GetEncodingName(enc).c_str(),
+                 wxFontMapper::Get()->GetEncodingDescription(enc).c_str());
     }
 }
 
@@ -768,8 +768,20 @@ static void DumpFileName(const wxFileName& fn)
     wxString vol, path, name, ext;
     wxFileName::SplitPath(full, &vol, &path, &name, &ext);
 
-    wxPrintf(_T("Filename '%s' -> vol '%s', path '%s', name '%s', ext '%s'\n"),
+    wxPrintf(_T("'%s'-> vol '%s', path '%s', name '%s', ext '%s'\n"),
              full.c_str(), vol.c_str(), path.c_str(), name.c_str(), ext.c_str());
+
+    wxFileName::SplitPath(full, &path, &name, &ext);
+    wxPrintf(_T("or\t\t-> path '%s', name '%s', ext '%s'\n"),
+             path.c_str(), name.c_str(), ext.c_str());
+
+    wxPrintf(_T("path is also:\t'%s'\n"), fn.GetPath().c_str());
+    wxPrintf(_T("with volume: \t'%s'\n"),
+             fn.GetPath(wxPATH_GET_VOLUME).c_str());
+    wxPrintf(_T("with separator:\t'%s'\n"),
+             fn.GetPath(wxPATH_GET_SEPARATOR).c_str());
+    wxPrintf(_T("with both:   \t'%s'\n"),
+             fn.GetPath(wxPATH_GET_SEPARATOR | wxPATH_GET_VOLUME).c_str());
 }
 
 static struct FileNameInfo
@@ -802,7 +814,7 @@ static struct FileNameInfo
     { _T("c:\\Windows\\command.com"), _T("c"), _T("\\Windows"), _T("command"), _T("com"), TRUE, wxPATH_DOS },
     { _T("\\\\server\\foo.bar"), _T("server"), _T("\\"), _T("foo"), _T("bar"), TRUE, wxPATH_DOS },
 
-    // wxFileName support for Mac file names is broken crurently
+    // wxFileName support for Mac file names is broken currently
 #if 0
     // Mac file names
     { _T("Volume:Dir:File"), _T("Volume"), _T("Dir"), _T("File"), _T(""), TRUE, wxPATH_MAC },
@@ -900,7 +912,12 @@ static void TestFileNameTemp()
     for ( size_t n = 0; n < WXSIZEOF(tmpprefixes); n++ )
     {
         wxString path = wxFileName::CreateTempFileName(tmpprefixes[n]);
-        if ( !path.empty() )
+        if ( path.empty() )
+        {
+            // "error" is not in upper case because it may be ok
+            printf("Prefix '%s'\t-> error\n", tmpprefixes[n]);
+        }
+        else
         {
             printf("Prefix '%s'\t-> temp file '%s'\n",
                    tmpprefixes[n], path.c_str());
@@ -3027,18 +3044,28 @@ static void TestStopWatch()
     puts("*** Testing wxStopWatch ***\n");
 
     wxStopWatch sw;
-    printf("Sleeping 3 seconds...");
+    sw.Pause();
+    printf("Initially paused, after 2 seconds time is...");
+    fflush(stdout);
+    wxSleep(2);
+    printf("\t%ldms\n", sw.Time());
+
+    printf("Resuming stopwatch and sleeping 3 seconds...");
+    fflush(stdout);
+    sw.Resume();
     wxSleep(3);
     printf("\telapsed time: %ldms\n", sw.Time());
 
     sw.Pause();
-    printf("Sleeping 2 more seconds...");
+    printf("Pausing agan and sleeping 2 more seconds...");
+    fflush(stdout);
     wxSleep(2);
     printf("\telapsed time: %ldms\n", sw.Time());
 
     sw.Resume();
-    printf("And 3 more seconds...");
-    wxSleep(3);
+    printf("Finally resuming and sleeping 2 more seconds...");
+    fflush(stdout);
+    wxSleep(2);
     printf("\telapsed time: %ldms\n", sw.Time());
 
     wxStopWatch sw2;
@@ -3056,6 +3083,7 @@ static void TestStopWatch()
         }
 
         putchar('.');
+        fflush(stdout);
     }
 
     puts(", ok.");
@@ -5808,7 +5836,7 @@ int main(int argc, char **argv)
         DumpFileName(fn);
     }
 
-    if ( 1 )
+    if ( TEST_ALL )
     {
         TestFileNameConstruction();
         TestFileNameMakeRelative();