00001
00002
00003
00004
00005
00006
00007
00008
00010
00011 #ifndef CRCAPTURE_H
00012 #define CRCAPTURE_H
00013
00014 #ifdef __GNUG__
00015 #pragma interface "CRCapture.h"
00016 #endif
00017
00018 #include <wxGuiTest/Common.h>
00019
00020 #include <wxGuiTest/WxGuiTestApp.h>
00021 #include <wxGuiTest/CRLogInterface.h>
00022 #include <wxGuiTest/CREventCaptureManager.h>
00023 #include <wxGuiTest/CRCppEmitter.h>
00024 #include <wxGuiTest/CRCaptureControl.h>
00025
00026 class wxDialog;
00027
00028 namespace wxTst {
00029
00030
00034 class CRCapture : public CRLogInterface
00035 {
00036 public:
00040 CRCapture ();
00041
00042
00046 virtual ~CRCapture ();
00047
00048
00059 #define CAPTURE \
00060 { \
00061 wxApp *app = wxTheApp; \
00062 wxASSERT (app != NULL); \
00063 wxTst::WxGuiTestApp *guiTestApp = dynamic_cast< wxTst::WxGuiTestApp * >(app); \
00064 wxASSERT (guiTestApp != NULL); \
00065 guiTestApp->SetEventFilter (wxTst::CREventCaptureManager::GetInstance ()); \
00066 \
00067 std::string excMsg; \
00068 wxTst::CRCapture *capture = new wxTst::CRCapture (); \
00069 try { \
00070 capture->Capture (__FILE__, __LINE__); \
00071 } catch (std::exception &e) { \
00072 excMsg = e.what (); \
00073 } catch (...) { \
00074 excMsg = "Unexpected capturing exception"; \
00075 } \
00076 guiTestApp->SetEventFilter (NULL); \
00077 delete capture; \
00078 wxTst::CRCppEmitter::Destroy (); \
00079 if (!excMsg.empty ()) { \
00080 CPPUNIT_FAIL (excMsg.c_str ()); \
00081 } \
00082 }
00083
00084
00091 virtual void Capture (const char *file, int line);
00092
00093
00094
00095
00101 virtual void Log (const wxString &text);
00102
00103 protected:
00107 virtual void Show ();
00108
00109
00115 virtual CRCaptureControl * CreateEvtHandler () const;
00116
00117
00121 virtual void CreateDialog ();
00122
00123
00129 virtual wxPanel * LoadPanel ();
00130
00131 protected:
00132 wxDialog *m_dialog;
00133 CRCaptureControl *m_control;
00134
00135 private:
00136 wxTextCtrl *m_logTextCtrl;
00137 };
00138
00139 }
00140
00141 #endif // CRCAPTURE_H