throw;
}
#if wxDEBUG_LEVEL
- catch ( TestAssertFailure& e )
+ catch ( TestAssertFailure& )
{
msg = s_lastAssertMessage;
s_lastAssertMessage.clear();
virtual void startTest(CppUnit::Test *test)
{
- wxPrintf(" %-60s ", test->getName());
+ printf(" %-60s ", test->getName().c_str());
m_result = RESULT_OK;
m_watch.Start();
}
virtual void endTest(CppUnit::Test * WXUNUSED(test))
{
m_watch.Pause();
- wxPrintf(GetResultStr(m_result));
+ printf("%s", GetResultStr(m_result));
if (m_timing)
- wxPrintf(" %6ld ms", m_watch.Time());
- wxPrintf("\n");
+ printf(" %6ld ms", m_watch.Time());
+ printf("\n");
}
protected :
RESULT_MAX
};
- wxString GetResultStr(ResultType type) const
+ const char* GetResultStr(ResultType type) const
{
static const char *resultTypeNames[] =
{
return online;
}
+extern bool IsAutomaticTest()
+{
+ static int s_isAutomatic = -1;
+ if ( s_isAutomatic == -1 )
+ {
+ // Allow setting an environment variable to emulate buildslave user for
+ // testing.
+ wxString username;
+ if ( !wxGetEnv("WX_TEST_USER", &username) )
+ username = wxGetUserId();
+
+ username.MakeLower();
+ s_isAutomatic = username.Matches("buildslave*") ||
+ username.Matches("sandbox*");
+ }
+
+ return s_isAutomatic == 1;
+}
+
// helper of OnRun(): gets the test with the given name, returning NULL (and
// not an empty test suite) if there is no such test
static Test *GetTestByName(const wxString& name)
#else
cout << "Test program for wxWidgets non-GUI features\n"
#endif
- << "build: " << WX_BUILD_OPTIONS_SIGNATURE << std::endl;
+ << "build: " << WX_BUILD_OPTIONS_SIGNATURE << "\n"
+ << "running under " << wxGetOsDescription()
+ << " as " << wxGetUserId() << std::endl;
+
+ if ( m_detail )
+ {
+ // Output some important information about the test environment.
+ cout << "Running under " << wxGetOsDescription() << ", "
+ "locale is " << setlocale(LC_ALL, NULL) << std::endl;
+ }
#if wxUSE_GUI
// create a hidden parent window to be used as parent for the GUI controls
m_eventloop = new wxEventLoop;
wxEventLoop::SetActive(m_eventloop);
+
+#ifdef __WXOSX__
+ // we need to wait until the window is activated and fully ready
+ // otherwise no events can be posted
+ m_eventloop->DispatchTimeout(1000);
+ m_eventloop->Yield();
+#endif
+
#endif // wxUSE_GUI
return true;