]> git.saurik.com Git - wxWidgets.git/blob - tests/testprec.h
remember to users that env vars are hardly usable for IPC :)
[wxWidgets.git] / tests / testprec.h
1 #include "wx/wxprec.h"
2 #include "wx/cppunit.h"
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
9
10 // thrown when assert fails in debug build
11 class TestAssertFailure { };
12
13 // macro to use for the functions which are supposed to fail an assertion
14 #if wxDEBUG_LEVEL
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 this build so just check that it fails
27 #define WX_ASSERT_FAILS_WITH_ASSERT(cond) CPPUNIT_ASSERT(!(cond))
28 #endif
29
30 // these functions can be used to hook into wxApp event processing and are
31 // currently used by the events propagation test
32 class WXDLLIMPEXP_FWD_BASE wxEvent;
33
34 typedef int (*FilterEventFunc)(wxEvent&);
35 typedef bool (*ProcessEventFunc)(wxEvent&);
36
37 extern void SetFilterEventFunc(FilterEventFunc func);
38 extern void SetProcessEventFunc(ProcessEventFunc func);