]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/archive/archivetest.cpp
Add virtual ~wxAnyScrollHelperBase() to fix compiler warning.
[wxWidgets.git] / tests / archive / archivetest.cpp
index aa843b4e8c6b12fd9fc04792f4af39d688ca21b4..fa122d1f03eff89b9ab194c178a80e88d4f0fed2 100644 (file)
@@ -2,7 +2,6 @@
 // Name:        tests/archive/archive.cpp
 // Purpose:     Test the archive classes
 // Author:      Mike Wetherell
-// RCS-ID:      $Id$
 // Copyright:   (c) 2004 Mike Wetherell
 // Licence:     wxWindows licence
 ///////////////////////////////////////////////////////////////////////////////
@@ -51,9 +50,6 @@ using std::auto_ptr;
 #if defined __DMC__ && __DMC__ >= 0x832
 #   define WXARC_MEMBER_TEMPLATES
 #endif
-#if defined __MWERKS__ && __MWERKS__ >= 0x2200
-#   define WXARC_MEMBER_TEMPLATES
-#endif
 #if defined __HP_aCC && __HP_aCC > 33300
 #   define WXARC_MEMBER_TEMPLATES
 #endif
@@ -409,7 +405,7 @@ void TempDir::RemoveDir(wxString& path)
 #   define WXARC_pclose(fp)
 #endif
 
-#ifdef __WXMSW__
+#ifdef __WINDOWS__
 #   define WXARC_b "b"
 #else
 #   define WXARC_b
@@ -661,7 +657,7 @@ void ArchiveTestCase<ClassFactoryT>::CreateArchive(wxOutputStream& out,
         wxFileName fn(i->first, wxPATH_UNIX);
         TestEntry& entry = *i->second;
         wxDateTime dt = entry.GetDateTime();
-#ifdef __WXMSW__
+#ifdef __WINDOWS__
         if (fn.IsDir())
             entry.SetDateTime(wxDateTime());
         else
@@ -675,12 +671,15 @@ void ArchiveTestCase<ClassFactoryT>::CreateArchive(wxOutputStream& out,
         wxString tmparc = fn.GetPath(wxPATH_GET_SEPARATOR) + fn.GetFullName();
 
         // call the archiver to create an archive file
-        system(wxString::Format(archiver, tmparc.c_str()).mb_str());
+        if ( system(wxString::Format(archiver, tmparc.c_str()).mb_str()) == -1 )
+        {
+            wxLogError("Failed to run acrhiver command \"%s\"", archiver);
+        }
 
         // then load the archive file
         {
             wxFFileInputStream in(tmparc);
-            if (in.Ok())
+            if (in.IsOk())
                 out.Write(in);
         }
 
@@ -690,7 +689,7 @@ void ArchiveTestCase<ClassFactoryT>::CreateArchive(wxOutputStream& out,
         // for the non-seekable test, have the archiver output to "-"
         // and read the archive via a pipe
         PFileInputStream in(wxString::Format(archiver, wxT("-")));
-        if (in.Ok())
+        if (in.IsOk())
             out.Write(in);
     }
 }
@@ -806,7 +805,7 @@ void ArchiveTestCase<ClassFactoryT>::ExtractArchive(wxInputStream& in)
 
         const TestEntry& testEntry = *it->second;
 
-#ifndef __WXMSW__
+#ifndef __WINDOWS__
         // On Windows some archivers compensate for Windows DST handling, but
         // other don't, so disable the test for now.
         wxDateTime dt = testEntry.GetDateTime();
@@ -893,19 +892,23 @@ void ArchiveTestCase<ClassFactoryT>::ExtractArchive(wxInputStream& in,
         // write the archive to a temporary file
         {
             wxFFileOutputStream out(tmparc);
-            if (out.Ok())
+            if (out.IsOk())
                 out.Write(in);
         }
 
         // call unarchiver
-        system(wxString::Format(unarchiver, tmparc.c_str()).mb_str());
+        if ( system(wxString::Format(unarchiver, tmparc.c_str()).mb_str()) == -1 )
+        {
+            wxLogError("Failed to run unarchiver command \"%s\"", unarchiver);
+        }
+
         wxRemoveFile(tmparc);
     }
     else {
         // for the non-seekable test, have the archiver extract "-" and
         // feed it the archive via a pipe
         PFileOutputStream out(wxString::Format(unarchiver, wxT("-")));
-        if (out.Ok())
+        if (out.IsOk())
             out.Write(in);
     }
 
@@ -950,7 +953,7 @@ void ArchiveTestCase<ClassFactoryT>::VerifyDir(wxString& path,
 
             const TestEntry& testEntry = *it->second;
 
-#if 0 //ndef __WXMSW__
+#if 0 //ndef __WINDOWS__
             CPPUNIT_ASSERT_MESSAGE("timestamp check" + error_context,
                                    testEntry.GetDateTime() ==
                                    wxFileName(path).GetModificationTime());
@@ -958,7 +961,7 @@ void ArchiveTestCase<ClassFactoryT>::VerifyDir(wxString& path,
             if (!isDir) {
                 wxFFileInputStream in(path);
                 CPPUNIT_ASSERT_MESSAGE(
-                    "entry not found in archive" + error_entry, in.Ok());
+                    "entry not found in archive" + error_entry, in.IsOk());
 
                 size_t size = (size_t)in.GetLength();
                 wxCharBuffer buf(size);
@@ -1300,7 +1303,7 @@ void ArchiveTestSuite::AddCmd(wxArrayString& cmdlist, const wxString& cmd)
 bool ArchiveTestSuite::IsInPath(const wxString& cmd)
 {
     wxString c = cmd.BeforeFirst(wxT(' '));
-#ifdef __WXMSW__
+#ifdef __WINDOWS__
     c += wxT(".exe");
 #endif
     return !m_path.FindValidPath(c).empty();
@@ -1381,11 +1384,17 @@ string ArchiveTestSuite::Description(const wxString& type,
 
     if (!archiver.empty()) {
         const wxChar *fn = (options & PipeOut) != 0 ? wxT("-") : wxT("file");
-        descr << wxT(" (") << wxString::Format(archiver, fn) << wxT(")");
+        const wxString cmd = archiver.Contains("%s")
+                             ? wxString::Format(archiver, fn)
+                             : archiver;
+        descr << wxT(" (") << cmd << wxT(")");
     }
     if (!unarchiver.empty()) {
         const wxChar *fn = (options & PipeIn) != 0 ? wxT("-") : wxT("file");
-        descr << wxT(" (") << wxString::Format(unarchiver, fn) << wxT(")");
+        const wxString cmd = unarchiver.Contains("%s")
+                             ? wxString::Format(unarchiver, fn)
+                             : unarchiver;
+        descr << wxT(" (") << cmd << wxT(")");
     }
 
     wxString optstr;