]> git.saurik.com Git - wxWidgets.git/blobdiff - tests/test.cpp
Added wxPyInputStream dtor. Use PyLong_FromLongLong iff needed for wxFileOffset
[wxWidgets.git] / tests / test.cpp
index 2ed648499314b2cd1cb12d8cf84bf45628e55f7b..97df72a276f9d91702b293e2af392322b03429a1 100644 (file)
 #include "wx/cppunit.h"
 #include <iostream>
 
-using namespace std;
-using namespace CppUnit;
+using CppUnit::Test;
+using CppUnit::TestSuite;
+using CppUnit::TestFactoryRegistry;
+using CppUnit::TextUi::TestRunner;
+
+using std::string;
+using std::vector;
+using std::auto_ptr;
+using std::cout;
 
 // The application class
 //
@@ -66,7 +73,7 @@ TestApp::TestApp()
 bool TestApp::OnInit()
 {
     cout << "Test program for wxWidgets\n"
-         << "build: " << WX_BUILD_OPTIONS_SIGNATURE << endl;
+         << "build: " << WX_BUILD_OPTIONS_SIGNATURE << std::endl;
     return wxAppConsole::OnInit();
 };
 
@@ -100,18 +107,19 @@ bool TestApp::OnCmdLineParsed(wxCmdLineParser& parser)
             m_registries.push_back(string(parser.GetParam(i).mb_str()));
     else
         m_registries.push_back("");
+
     m_longlist = parser.Found(_T("longlist"));
     m_list = m_longlist || parser.Found(_T("list"));
 
     return wxAppConsole::OnCmdLineParsed(parser);
 }
 
+#include "wx/uri.h"
 // Run
 //
 int TestApp::OnRun()
 {
-    TextUi::TestRunner runner;
+    TestRunner runner;
 
     for (size_t i = 0; i < m_registries.size(); i++) {
         auto_ptr<Test> test(m_registries[i].empty() ?
@@ -129,11 +137,17 @@ int TestApp::OnRun()
             runner.addTest(test.release());
     }
 
+#if wxUSE_LOG
     // Switch off logging unless --verbose
-    wxLog::EnableLogging(wxLog::GetVerbose());
+    bool verbose = wxLog::GetVerbose();
+    wxLog::EnableLogging(verbose);
+#else
+    bool verbose = false;
+#endif
 
-    return m_list || runner.run("", false, true, !wxLog::GetVerbose()) ?
-        EXIT_SUCCESS : EXIT_FAILURE;
+    return ( m_list || runner.run("", false, true, !verbose) )
+           ? EXIT_SUCCESS
+           : EXIT_FAILURE;
 }
 
 // List the tests
@@ -157,10 +171,10 @@ void TestApp::List(Test *test, const string& parent /*=""*/) const
             cout << "  " << name.substr(i + 1) << "\n";
         }
 
-        typedef const vector<Test*> Tests;
+        typedef vector<Test*> Tests;
         typedef Tests::const_iterator Iter;
 
-        Tests& tests = suite->getTests();
+        const Tests& tests = suite->getTests();
 
         for (Iter it = tests.begin(); it != tests.end(); ++it)
             List(*it, name);