added wxTimer test (now that it works in console applications too)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46042 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
c67b782d27
commit
549b95b3de
@ -88,7 +88,7 @@
|
||||
#define TEST_WCHAR
|
||||
#define TEST_ZIP
|
||||
#else // #if TEST_ALL
|
||||
#define TEST_STDPATHS
|
||||
#define TEST_TIMER
|
||||
#endif
|
||||
|
||||
// some tests are interactive, define this to run them
|
||||
@ -2943,6 +2943,46 @@ static void TestStopWatch()
|
||||
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++);
|
||||
|
||||
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;
|
||||
|
||||
MyTimer timer;
|
||||
timer.Start(500);
|
||||
|
||||
loop.Run();
|
||||
}
|
||||
|
||||
#endif // TEST_TIMER
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -4450,6 +4490,7 @@ int main(int argc, char **argv)
|
||||
|
||||
#ifdef TEST_TIMER
|
||||
TestStopWatch();
|
||||
TestTimer();
|
||||
#endif // TEST_TIMER
|
||||
|
||||
#ifdef TEST_DATETIME
|
||||
|
Loading…
Reference in New Issue
Block a user