X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e6477b92b7d51a6ec7a26cf7bae1e8c7637995e4..04a123c642b0fc589e29cdd507faf11b85973f79:/tests/archive/ziptest.cpp?ds=inline diff --git a/tests/archive/ziptest.cpp b/tests/archive/ziptest.cpp index 4f17fbe4b0..a42248a37f 100644 --- a/tests/archive/ziptest.cpp +++ b/tests/archive/ziptest.cpp @@ -34,12 +34,11 @@ class ZipTestCase : public ArchiveTestCase { public: ZipTestCase(string name, - int id, int options, const wxString& archiver = wxEmptyString, const wxString& unarchiver = wxEmptyString) : - ArchiveTestCase(name, id, new wxZipClassFactory, + ArchiveTestCase(name, new wxZipClassFactory, options, archiver, unarchiver), m_count(0) { } @@ -65,7 +64,7 @@ protected: void ZipTestCase::OnCreateArchive(wxZipOutputStream& zip) { - m_comment << _T("Comment for test ") << m_id; + m_comment << wxT("Comment for test ") << m_id; zip.SetComment(m_comment); } @@ -85,7 +84,7 @@ void ZipTestCase::OnCreateEntry(wxZipOutputStream& zip, switch ((m_id + m_count) % 5) { case 0: { - wxString comment = _T("Comment for ") + entry->GetName(); + wxString comment = wxT("Comment for ") + entry->GetName(); entry->SetComment(comment); // lowercase the expected result, and the notifier should do // the same for the zip entries when ModifyArchive() runs @@ -111,7 +110,7 @@ void ZipTestCase::OnEntryExtracted(wxZipEntry& entry, { // provide some context for the error message so that we know which // iteration of the loop we were on - wxString name = _T(" '") + entry.GetName() + _T("'"); + wxString name = wxT(" '") + entry.GetName() + wxT("'"); string error_entry(name.mb_str()); string error_context(" failed for entry" + error_entry); @@ -161,27 +160,31 @@ class ZipPipeTestCase : public CppUnit::TestCase { public: ZipPipeTestCase(string name, int options) : - CppUnit::TestCase(name), m_options(options) { } + CppUnit::TestCase(TestId::MakeId() + name), + m_options(options), + m_id(TestId::GetId()) + { } protected: void runTest(); int m_options; + int m_id; }; void ZipPipeTestCase::runTest() { TestOutputStream out(m_options); - wxString testdata = _T("test data to pipe through zip"); - wxString cmd = _T("echo ") + testdata + _T(" | zip -q - -"); + wxString testdata = wxT("test data to pipe through zip"); + wxString cmd = wxT("echo ") + testdata + wxT(" | zip -q - -"); { PFileInputStream in(cmd); - if (in.Ok()) + if (in.IsOk()) out.Write(in); } - TestInputStream in(out); + TestInputStream in(out, m_id % ((m_options & PipeIn) ? 4 : 3)); wxZipInputStream zip(in); auto_ptr entry(zip.GetNextEntry()); @@ -214,7 +217,7 @@ public: protected: ArchiveTestSuite *makeSuite(); - CppUnit::Test *makeTest(string descr, int id, int options, + CppUnit::Test *makeTest(string descr, int options, bool genericInterface, const wxString& archiver, const wxString& unarchiver); }; @@ -222,22 +225,21 @@ protected: ziptest::ziptest() : ArchiveTestSuite("zip") { - AddArchiver(_T("zip -qr %s *")); - AddUnArchiver(_T("unzip -q %s")); + AddArchiver(wxT("zip -qr %s *")); + AddUnArchiver(wxT("unzip -q %s")); } ArchiveTestSuite *ziptest::makeSuite() { ArchiveTestSuite::makeSuite(); -#ifndef WXARC_NO_POPEN - // if have popen then can check the piped output of 'zip - -' - if (IsInPath(_T("zip"))) +#if 0 + // zip doesn't support this any more so disabled + if (IsInPath(wxT("zip"))) for (int options = 0; options <= PipeIn; options += PipeIn) { - string name = Description(_T("ZipPipeTestCase"), options, - false, _T(""), _T("zip -q - -")); + string name = Description(wxT("ZipPipeTestCase"), options, + false, wxT(""), wxT("zip -q - -")); addTest(new ZipPipeTestCase(name, options)); - m_id++; } #endif @@ -246,7 +248,6 @@ ArchiveTestSuite *ziptest::makeSuite() CppUnit::Test *ziptest::makeTest( string descr, - int id, int options, bool genericInterface, const wxString& archiver, @@ -257,11 +258,13 @@ CppUnit::Test *ziptest::makeTest( return NULL; if (genericInterface) + { return new ArchiveTestCase( - descr, id, new wxZipClassFactory, + descr, new wxZipClassFactory, options, archiver, unarchiver); - else - return new ZipTestCase(descr, id, options, archiver, unarchiver); + } + + return new ZipTestCase(descr, options, archiver, unarchiver); } CPPUNIT_TEST_SUITE_REGISTRATION(ziptest);