00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00013 #ifndef WXGUITESTHELPER_H
00014 #define WXGUITESTHELPER_H
00015
00016 #ifdef __GNUG__
00017 #pragma interface "WxGuiTestHelper.h"
00018 #endif
00019
00020 #include <wxGuiTest/Common.h>
00021
00022 #include <map>
00023
00024
00032 #ifdef USE_WXGUITESTING
00033 #ifdef IMPLEMENT_APP
00034 #undef IMPLEMENT_APP
00035 #endif
00036 #define IMPLEMENT_APP(appname)
00037 #endif
00038
00039
00040 namespace wxTst {
00041
00042 class WarningAsserterInterface;
00043
00044
00098 class WxGuiTestHelper
00099 {
00100 public:
00104 WxGuiTestHelper ();
00105
00106
00110 virtual ~WxGuiTestHelper ();
00111
00112
00121 static int FlushEventQueue ();
00122
00123
00132 static int Show (wxWindow *wdw, bool show, bool isModal);
00133
00134
00144 static int Show (wxWindow *wdw, bool show, bool isModal,
00145 bool isGuiLessUnitTest);
00146
00147
00157 static bool PopupMenu (wxWindow *wdw, wxMenu *menu, const wxPoint &pos,
00158 const wxString &cacheMapKey);
00159
00160
00171 static bool PopupMenu (wxWindow *wdw, wxMenu *menu, const wxPoint &pos,
00172 const wxString &cacheMapKey, bool isGuiLessUnitTest);
00173
00174
00184 static void BreakTestToShowCurrentGui ();
00185
00194 static void SetIsGuiLessUnitTestFlag (bool isGuiLess);
00195
00196
00202 static bool IsGuiLessUnitTestFlag ();
00203
00204
00213 static void SetShowModalDialogsNonModalFlag (bool showNonModal);
00214
00215
00224 static bool GetShowModalDialogsNonModalFlag ();
00225
00226
00235 static void SetShowPopupMenusFlag (bool showPopupMenus);
00236
00237
00247 static bool GetShowPopupMenusFlag ();
00248
00255 static void SetInteractive(bool interactive);
00256
00262 static bool GetInteractive();
00263
00272 static void SetDisableTestInteractivity (bool disable);
00273
00274
00280 static bool GetDisableTestInteractivity ();
00281
00282
00294 static void SetPopupWarningForFailingAssert (bool popup);
00295
00296
00303 static bool GetPopupWarningForFailingAssert ();
00304
00305
00312 static wxMenu *FindPopupMenu (const wxString &key);
00313
00314
00323 static wxString FindPopupMenuKey (wxMenu *menu);
00324
00325
00336 static wxWindow *FindPopupMenuEvtHandlerWdw (const wxString &key);
00337
00338
00351 static bool IsProvokedWarning (const wxString &caption, const wxString &message);
00352
00353
00360 static void SetCheckForProvokedWarnings (bool check);
00361
00362
00369 static bool GetCheckForProvokedWarnings ();
00370
00371
00377 static void SetWarningAsserter (WarningAsserterInterface *warningAsserter);
00378
00379
00380 static void AddTestFailure (const wxString &file, const int line,
00381 const wxString &shortDescription, const wxString &message);
00382
00383 private:
00384 static bool s_isGuiLessUnitTest;
00385
00386 static bool s_showModalDialogsNonModal;
00387 static bool s_showPopupMenus;
00388
00389 static bool s_interactive;
00390 static bool s_disableTestInteractivity;
00391
00392 static bool s_popupWarningForFailingAssert;
00393
00394 typedef std::pair< wxMenu *, wxWindow * > MenuWdwPair;
00395 typedef std::map< wxString, MenuWdwPair > PopupMenuMap;
00396 static PopupMenuMap s_popupMenuMap;
00397
00398 static bool s_checkForProvokedWarnings;
00399
00400 static WarningAsserterInterface *s_warningAsserter;
00401
00402
00403
00404 static wxString s_fileOfFirstTestFailure;
00405 static int s_lineNmbOfFirstTestFailure;
00406 static wxString s_shortDescriptionOfFirstTestFailure;
00407 static wxString s_accTestFailures;
00408 };
00409
00410 }
00411
00412 #endif // WXGUITESTHELPER_H
00413