#include "wx/log.h"
#include "wx/apptrait.h"
#include "wx/platinfo.h"
+#include "wx/wxchar.h"
// without this pragma, the stupid compiler precompiles #defines below so that
// changing them doesn't "take place" later!
#define TEST_WCHAR
#define TEST_ZIP
#else // #if TEST_ALL
- #define TEST_FILE
+ #define TEST_TIMER
#endif
// some tests are interactive, define this to run them
#ifdef TEST_STDPATHS
#include "wx/stdpaths.h"
+#include "wx/wxchar.h" // wxPrintf
static void TestStandardPaths()
{
wxPrintf(_T("Data dir (user):\t%s\n"), stdp.GetUserDataDir().c_str());
wxPrintf(_T("Data dir (user local):\t%s\n"), stdp.GetUserLocalDataDir().c_str());
wxPrintf(_T("Documents dir:\t\t%s\n"), stdp.GetDocumentsDir().c_str());
+ wxPrintf(_T("Executable path:\t%s\n"), stdp.GetExecutablePath().c_str());
wxPrintf(_T("Plugins dir:\t\t%s\n"), stdp.GetPluginsDir().c_str());
wxPrintf(_T("Resources dir:\t\t%s\n"), stdp.GetResourcesDir().c_str());
wxPrintf(_T("Localized res. dir:\t%s\n"),
wxPuts(_T(", ok."));
}
+#include "wx/timer.h"
+#include "wx/evtloop.h"
+
+void TestTimer()
+{
+ wxPuts(_T("*** Testing wxTimer ***\n"));
+
+ class MyTimer : public wxTimer
+ {
+ public:
+ MyTimer() : wxTimer() { m_num = 0; }
+
+ virtual void Notify()
+ {
+ wxPrintf(_T("%d"), m_num++);
+ fflush(stdout);
+
+ if ( m_num == 10 )
+ {
+ wxPrintf(_T("... exiting the event loop"));
+ Stop();
+
+ wxEventLoop::GetActive()->Exit(0);
+ wxPuts(_T(", ok."));
+ }
+
+ fflush(stdout);
+ }
+
+ private:
+ int m_num;
+ };
+
+ wxEventLoop loop;
+
+ wxTimer timer1;
+ timer1.Start(100, true /* one shot */);
+ timer1.Stop();
+ timer1.Start(100, true /* one shot */);
+
+ MyTimer timer;
+ timer.Start(500);
+
+ loop.Run();
+}
+
#endif // TEST_TIMER
// ----------------------------------------------------------------------------
wxLog::AddTraceMask(_T("mime"));
#if TEST_ALL
TestMimeEnum();
+ #endif
TestMimeOverride();
TestMimeAssociate();
- #endif
TestMimeFilename();
#endif // TEST_MIME
#ifdef TEST_TIMER
TestStopWatch();
+ TestTimer();
#endif // TEST_TIMER
#ifdef TEST_DATETIME