]> git.saurik.com Git - wxWidgets.git/blame - tests/testprec.h
always call SetIcon() on the main frame of the sample; some small cleanup
[wxWidgets.git] / tests / testprec.h
CommitLineData
8899b155
RN
1#include "wx/wxprec.h"
2#include "wx/cppunit.h"
8da7a00a
VZ
3
4// define wxHAVE_U_ESCAPE if the compiler supports \uxxxx character constants
5#if (defined(__VISUALC__) && (__VISUALC__ >= 1300)) || \
6 (defined(__GNUC__) && (__GNUC__ >= 3))
7 #define wxHAVE_U_ESCAPE
8#endif
0468a58a
VZ
9
10// thrown when assert fails in debug build
11class TestAssertFailure { };
12
13// macro to use for the functions which are supposed to fail an assertion
14#ifdef __WXDEBUG__
15 // some old cppunit versions don't define CPPUNIT_ASSERT_THROW so roll our
16 // own
17 #define WX_ASSERT_FAILS_WITH_ASSERT(cond) \
18 { \
19 bool throwsAssert = false; \
20 try { cond ; } \
21 catch ( const TestAssertFailure& ) { throwsAssert = true; } \
22 if ( !throwsAssert ) \
23 CPPUNIT_FAIL("expected assertion not generated"); \
24 }
25#else
26 // there are no assertions in non-debug build so just check that it fails
27 #define WX_ASSERT_FAILS_WITH_ASSERT(cond) CPPUNIT_ASSERT(!(cond))
28#endif
29
1649d288
VZ
30// these functions can be used to hook into wxApp event processing and are
31// currently used by the events propagation test
9eab6725
VZ
32class WXDLLIMPEXP_FWD_BASE wxEvent;
33
1649d288
VZ
34typedef int (*FilterEventFunc)(wxEvent&);
35typedef bool (*ProcessEventFunc)(wxEvent&);
36
37extern void SetFilterEventFunc(FilterEventFunc func);
38extern void SetProcessEventFunc(ProcessEventFunc func);