switch off logging sooner (closes #10646)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59866 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-03-26 15:31:54 +00:00
parent 2057acc2a7
commit 875f82b1b6

View File

@@ -376,24 +376,34 @@ extern void SetProcessEventFunc(ProcessEventFunc func)
// //
int TestApp::OnRun() int TestApp::OnRun()
{ {
#if wxUSE_LOG
// Switch off logging unless --verbose
bool verbose = wxLog::GetVerbose();
wxLog::EnableLogging(verbose);
#else
bool verbose = false;
#endif
CppUnit::TextTestRunner runner; CppUnit::TextTestRunner runner;
for (size_t i = 0; i < m_registries.size(); i++) for (size_t i = 0; i < m_registries.size(); i++)
{ {
wxString reg = m_registries[i]; wxString reg = m_registries[i];
if (!reg.empty() && !reg.EndsWith("TestCase"))
reg += "TestCase";
// allow the user to specify the name of the testcase "in short form" // allow the user to specify the name of the testcase "in short form"
// (all wx test cases end with TestCase postfix) // (all wx test cases end with TestCase postfix)
if (!reg.empty() && !reg.EndsWith("TestCase"))
reg += "TestCase";
string stdreg(reg.mb_str());
auto_ptr<Test> test(reg.empty() ? auto_ptr<Test> test(reg.empty() ?
TestFactoryRegistry::getRegistry().makeTest() : TestFactoryRegistry::getRegistry().makeTest() :
TestFactoryRegistry::getRegistry(string(reg.mb_str())).makeTest()); TestFactoryRegistry::getRegistry(stdreg).makeTest());
TestSuite *suite = dynamic_cast<TestSuite*>(test.get()); TestSuite *suite = dynamic_cast<TestSuite*>(test.get());
if (suite && suite->countTestCases() == 0) if (suite && suite->countTestCases() == 0)
wxLogError(_T("No such test suite: %s"), reg); cerr << "No such test suite: " << stdreg << endl;
else if (m_list) else if (m_list)
List(test.get()); List(test.get());
else else
@@ -405,14 +415,6 @@ int TestApp::OnRun()
runner.setOutputter(new CppUnit::CompilerOutputter(&runner.result(), cout)); runner.setOutputter(new CppUnit::CompilerOutputter(&runner.result(), cout));
#if wxUSE_LOG
// Switch off logging unless --verbose
bool verbose = wxLog::GetVerbose();
wxLog::EnableLogging(verbose);
#else
bool verbose = false;
#endif
// there is a bug // there is a bug
// (http://sf.net/tracker/index.php?func=detail&aid=1649369&group_id=11795&atid=111795) // (http://sf.net/tracker/index.php?func=detail&aid=1649369&group_id=11795&atid=111795)
// in some versions of cppunit: they write progress dots to cout (and not // in some versions of cppunit: they write progress dots to cout (and not