From: Václav Slavík Date: Thu, 1 Nov 2012 16:45:11 +0000 (+0000) Subject: Add wxTEST_DIALOG for testing of modal dialogs. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/643e9cf9f61fdbe517b15477f9247ca8ac0b3578 Add wxTEST_DIALOG for testing of modal dialogs. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72837 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/testing.h b/include/wx/testing.h new file mode 100644 index 0000000000..905184e493 --- /dev/null +++ b/include/wx/testing.h @@ -0,0 +1,396 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/testing.h +// Purpose: helpers for GUI testing +// Author: Vaclav Slavik +// Created: 2012-08-28 +// RCS-ID: $Id$ +// Copyright: (c) 2012 Vaclav Slavik +// Licence: wxWindows Licence +///////////////////////////////////////////////////////////////////////////// + +#ifndef _WX_TESTING_H_ +#define _WX_TESTING_H_ + +#include "wx/debug.h" +#include "wx/string.h" + +class WXDLLIMPEXP_FWD_CORE wxDialog; +class WXDLLIMPEXP_FWD_CORE wxMessageDialogBase; +class WXDLLIMPEXP_FWD_CORE wxFileDialogBase; + +// ---------------------------------------------------------------------------- +// implementation helpers +// ---------------------------------------------------------------------------- + +// Helper hook class used to redirect ShowModal() to testing code. +// Instead of showing a dialog modally, hook code is called to simulate what +// the user would do and return appropriate ID from ShowModal(). +class WXDLLIMPEXP_CORE wxModalDialogHook +{ +public: + wxModalDialogHook() {} + virtual ~wxModalDialogHook() {} + + /// Returns currently active hook object or NULL. + static wxModalDialogHook *Get() { return ms_instance; } + + /// Set the hook and returns the previously set one. + static wxModalDialogHook *Set(wxModalDialogHook *hook) + { + wxModalDialogHook *old = ms_instance; + ms_instance = hook; + return old; + } + + /// Entry point that is called from ShowModal(). + virtual int Invoke(wxDialog *dlg) = 0; + +private: + static wxModalDialogHook *ms_instance; + + wxDECLARE_NO_COPY_CLASS(wxModalDialogHook); +}; + +// This macro needs to be used at the top of every implementation of +// ShowModal() in order for the above modal dialogs testing code to work. +#define WX_TESTING_SHOW_MODAL_HOOK() \ + if ( wxModalDialogHook::Get() ) \ + { \ + int rc = wxModalDialogHook::Get()->Invoke(this); \ + if ( rc != wxID_NONE ) \ + return rc; \ + } \ + struct wxDummyTestingStruct /* just to force a semicolon */ + + +// ---------------------------------------------------------------------------- +// testing API +// ---------------------------------------------------------------------------- + +// Don't include this code when building the library itself +#ifndef WXBUILDING + +#include "wx/beforestd.h" +#include +#include +#include +#include "wx/afterstd.h" +#include "wx/cpp.h" + +class wxTestingModalHook; + +// Non-template base class for wxExpectModal (via wxExpectModalBase). +// Only used internally. +class wxModalExpectation +{ +public: + wxModalExpectation() : m_isOptional(false) {} + virtual ~wxModalExpectation() {} + + bool IsOptional() const { return m_isOptional; } + + virtual int Invoke(wxDialog *dlg) const = 0; + + virtual wxString GetDescription() const = 0; + +protected: + // Is this dialog optional, i.e. not required to be shown? + bool m_isOptional; +}; + + +// This must be specialized for each type. The specialization MUST be derived +// from wxExpectModalBase. +template class wxExpectModal {}; + + +/** + Base class for wxExpectModal specializations. + + Every such specialization must be derived from wxExpectModalBase; there's + no other use for this class than to serve as wxExpectModal's base class. + + T must be a class derived from wxDialog. + */ +template +class wxExpectModalBase : public wxModalExpectation +{ +public: + typedef T DialogType; + typedef wxExpectModal ExpectationType; + + /** + Returns a copy of the expectation where the expected dialog is marked + as optional. + + Optional dialogs aren't required to appear, it's not an error if they + don't. + */ + ExpectationType Optional() const + { + ExpectationType e(*static_cast(this)); + e.m_isOptional = true; + return e; + } + +protected: + virtual int Invoke(wxDialog *dlg) const + { + DialogType *t = dynamic_cast(dlg); + if ( t ) + return OnInvoked(t); + else + return wxID_NONE; // not handled + } + + /// Returns description of the expected dialog (by default, its class). + virtual wxString GetDescription() const + { + return wxCLASSINFO(T)->GetClassName(); + } + + /** + This method is called when ShowModal() was invoked on a dialog of type T. + + @return Return value is used as ShowModal()'s return value. + */ + virtual int OnInvoked(DialogType *dlg) const = 0; +}; + + +// wxExpectModal specializations for common dialogs: + +template<> +class wxExpectModal : public wxExpectModalBase +{ +public: + wxExpectModal(int id) + { + switch ( id ) + { + case wxYES: + m_id = wxID_YES; + break; + case wxNO: + m_id = wxID_NO; + break; + case wxCANCEL: + m_id = wxID_CANCEL; + break; + case wxOK: + m_id = wxID_OK; + break; + case wxHELP: + m_id = wxID_HELP; + break; + default: + m_id = id; + break; + } + } + +protected: + virtual int OnInvoked(wxMessageDialog *WXUNUSED(dlg)) const + { + return m_id; + } + + int m_id; +}; + + +template<> +class wxExpectModal : public wxExpectModalBase +{ +public: + wxExpectModal(const wxString& path, int id = wxID_OK) + : m_path(path), m_id(id) + { + } + +protected: + virtual int OnInvoked(wxFileDialog *dlg) const + { + dlg->SetPath(m_path); + return m_id; + } + + wxString m_path; + int m_id; +}; + + +// Implementation of wxModalDialogHook for use in testing, with +// wxExpectModal and the wxTEST_DIALOG() macro. It is not intended for +// direct use, use the macro instead. +class wxTestingModalHook : public wxModalDialogHook +{ +public: + wxTestingModalHook() + { + m_prevHook = wxModalDialogHook::Set(this); + } + + virtual ~wxTestingModalHook() + { + wxModalDialogHook::Set(m_prevHook); + } + + virtual int Invoke(wxDialog *dlg) + { + while ( !m_expectations.empty() ) + { + const wxModalExpectation *expect = m_expectations.front(); + m_expectations.pop(); + + int ret = expect->Invoke(dlg); + if ( ret != wxID_NONE ) + return ret; // dialog shown as expected + + // not showing an optional dialog is OK, but showing an unexpected + // one definitely isn't: + if ( !expect->IsOptional() ) + { + ReportFailure + ( + wxString::Format + ( + "A %s dialog was shown unexpectedly, expected %s.", + dlg->GetClassInfo()->GetClassName(), + expect->GetDescription() + ) + ); + return wxID_NONE; + } + // else: try the next expectation in the chain + } + + ReportFailure + ( + wxString::Format + ( + "A dialog (%s) was shown unexpectedly.", + dlg->GetClassInfo()->GetClassName() + ) + ); + return wxID_NONE; + } + + // Called to verify that all expectations were met. This cannot be done in + // the destructor, because ReportFailure() may throw (either because it's + // overriden or because wx's assertions handling is, globally). And + // throwing from the destructor would introduce all sort of problems, + // including messing up the order of errors in some cases. + void CheckUnmetExpectations() + { + while ( !m_expectations.empty() ) + { + const wxModalExpectation *expect = m_expectations.front(); + m_expectations.pop(); + if ( expect->IsOptional() ) + continue; + + ReportFailure + ( + wxString::Format + ( + "Expected %s dialog was not shown.", + expect->GetDescription() + ) + ); + break; + } + } + + void AddExpectation(const wxModalExpectation& e) + { + m_expectations.push(&e); + } + +protected: + virtual void ReportFailure(const wxString& msg) + { + wxFAIL_MSG( msg ); + } + +private: + wxModalDialogHook *m_prevHook; + std::queue m_expectations; + + wxDECLARE_NO_COPY_CLASS(wxTestingModalHook); +}; + + +// Redefining this value makes it possible to customize the hook class, +// including e.g. its error reporting. +#define wxTEST_DIALOG_HOOK_CLASS wxTestingModalHook + +#define WX_TEST_IMPL_ADD_EXPECTATION(pos, expect) \ + const wxModalExpectation& wx_exp##pos = expect; \ + wx_hook.AddExpectation(wx_exp##pos); + +/** + Runs given code with all modal dialogs redirected to wxExpectModal + hooks, instead of being shown to the user. + + The first argument is any valid expression, typically a function call. The + remaining arguments are wxExpectModal instances defining the dialogs + that are expected to be shown, in order of appearance. + + Some typical examples: + + @code + wxTEST_DIALOG + ( + rc = dlg.ShowModal(), + wxExpectModal(wxGetCwd() + "/test.txt") + ); + @endcode + + Sometimes, the code may show more than one dialog: + + @code + wxTEST_DIALOG + ( + RunSomeFunction(), + wxExpectModal(wxNO), + wxExpectModal(wxYES), + wxExpectModal(wxGetCwd() + "/test.txt") + ); + @endcode + + Notice that wxExpectModal has some convenience methods for further + tweaking the expectations. For example, it's possible to mark an expected + dialog as @em optional for situations when a dialog may be shown, but isn't + required to, by calling the Optional() method: + + @code + wxTEST_DIALOG + ( + RunSomeFunction(), + wxExpectModal(wxNO), + wxExpectModal(wxGetCwd() + "/test.txt").Optional() + ); + @endcode + + @note By default, errors are reported with wxFAIL_MSG(). You may customize this by + implementing a class derived from wxTestingModalHook, overriding its + ReportFailure() method and redefining the wxTEST_DIALOG_HOOK_CLASS + macro to be the name of this class. + + @note Custom dialogs are supported too. All you have to do is to specialize + wxExpectModal<> for your dialog type and implement its OnInvoked() + method. + */ +#define wxTEST_DIALOG(codeToRun, ...) \ + { \ + wxTEST_DIALOG_HOOK_CLASS wx_hook; \ + wxCALL_FOR_EACH(WX_TEST_IMPL_ADD_EXPECTATION, __VA_ARGS__) \ + codeToRun; \ + wx_hook.CheckUnmetExpectations(); \ + } + + +#endif // !WXBUILDING + +#endif // _WX_TESTING_H_ diff --git a/src/cocoa/dialog.mm b/src/cocoa/dialog.mm index 7c5d516907..fbc8bbe18d 100644 --- a/src/cocoa/dialog.mm +++ b/src/cocoa/dialog.mm @@ -19,6 +19,7 @@ #include "wx/settings.h" #endif //WX_PRECOMP +#include "wx/testing.h" #include "wx/cocoa/autorelease.h" #include "wx/cocoa/string.h" @@ -127,6 +128,8 @@ bool wxDialog::Show(bool show) // is stopped (via EndModal()) it returns the exit code. int wxDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + wxCHECK_MSG(!IsModal(),GetReturnCode(),wxT("wxDialog::ShowModal called within its own modal loop")); // Show(true) will set m_isShown = true diff --git a/src/cocoa/dirdlg.mm b/src/cocoa/dirdlg.mm index 1c3c95d8a5..bc4613aa22 100644 --- a/src/cocoa/dirdlg.mm +++ b/src/cocoa/dirdlg.mm @@ -31,6 +31,7 @@ #endif #include "wx/filename.h" +#include "wx/testing.h" #include "wx/cocoa/autorelease.h" #include "wx/cocoa/string.h" @@ -104,6 +105,8 @@ wxDirDialog::~wxDirDialog() int wxDirDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + wxAutoNSAutoreleasePool thePool; m_fileNames.Empty(); diff --git a/src/cocoa/filedlg.mm b/src/cocoa/filedlg.mm index 576ed6920c..613f75bfea 100644 --- a/src/cocoa/filedlg.mm +++ b/src/cocoa/filedlg.mm @@ -33,6 +33,7 @@ #include "wx/cocoa/autorelease.h" #include "wx/cocoa/string.h" +#include "wx/testing.h" #import #import @@ -196,6 +197,8 @@ void wxFileDialog::SetPath(const wxString& path) int wxFileDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + wxAutoNSAutoreleasePool thePool; m_fileNames.Empty(); diff --git a/src/cocoa/msgdlg.mm b/src/cocoa/msgdlg.mm index 772ec2489d..0d6072a226 100644 --- a/src/cocoa/msgdlg.mm +++ b/src/cocoa/msgdlg.mm @@ -31,6 +31,7 @@ #include "wx/cocoa/autorelease.h" #include "wx/cocoa/string.h" +#include "wx/testing.h" #import // ============================================================================ @@ -72,6 +73,8 @@ void wxCocoaMessageDialog::DoSetCustomLabel(wxString& var, const ButtonLabel& va int wxCocoaMessageDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + wxAutoNSAutoreleasePool thePool; NSAlert *alert = [[[NSAlert alloc] init] autorelease]; diff --git a/src/common/dlgcmn.cpp b/src/common/dlgcmn.cpp index 5cbbc7e390..9289aa2d58 100644 --- a/src/common/dlgcmn.cpp +++ b/src/common/dlgcmn.cpp @@ -43,6 +43,7 @@ #include "wx/bookctrl.h" #include "wx/scrolwin.h" #include "wx/textwrapper.h" +#include "wx/testing.h" #if wxUSE_DISPLAY #include "wx/display.h" @@ -50,6 +51,8 @@ extern WXDLLEXPORT_DATA(const char) wxDialogNameStr[] = "dialog"; +wxModalDialogHook *wxModalDialogHook::ms_instance = NULL; + // ---------------------------------------------------------------------------- // XTI // ---------------------------------------------------------------------------- diff --git a/src/generic/filedlgg.cpp b/src/generic/filedlgg.cpp index a2a370d862..cd2e4da73f 100644 --- a/src/generic/filedlgg.cpp +++ b/src/generic/filedlgg.cpp @@ -49,6 +49,7 @@ #include "wx/filectrl.h" #include "wx/generic/filedlgg.h" #include "wx/debug.h" +#include "wx/testing.h" #if wxUSE_TOOLTIPS #include "wx/tooltip.h" @@ -308,6 +309,8 @@ wxBitmapButton* wxGenericFileDialog::AddBitmapButton( wxWindowID winId, int wxGenericFileDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + if (CreateExtraControl()) { wxSizer *sizer = GetSizer(); diff --git a/src/generic/msgdlgg.cpp b/src/generic/msgdlgg.cpp index c3dd7a8067..b2d162d31a 100644 --- a/src/generic/msgdlgg.cpp +++ b/src/generic/msgdlgg.cpp @@ -39,6 +39,7 @@ #include "wx/msgdlg.h" #include "wx/artprov.h" #include "wx/textwrapper.h" +#include "wx/testing.h" #if wxUSE_STATLINE #include "wx/statline.h" @@ -268,6 +269,8 @@ void wxGenericMessageDialog::OnCancel(wxCommandEvent& WXUNUSED(event)) int wxGenericMessageDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + if ( !m_created ) { m_created = true; diff --git a/src/gtk/colordlg.cpp b/src/gtk/colordlg.cpp index c6ac162f2f..87b61d2d44 100644 --- a/src/gtk/colordlg.cpp +++ b/src/gtk/colordlg.cpp @@ -19,6 +19,7 @@ #if wxUSE_COLOURDLG #include "wx/colordlg.h" +#include "wx/testing.h" #ifndef WX_PRECOMP #include "wx/intl.h" @@ -82,6 +83,8 @@ bool wxColourDialog::Create(wxWindow *parent, wxColourData *data) int wxColourDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + ColourDataToDialog(); gint result = gtk_dialog_run(GTK_DIALOG(m_widget)); diff --git a/src/gtk/dialog.cpp b/src/gtk/dialog.cpp index 7fcfd47c56..4cf2730f9c 100644 --- a/src/gtk/dialog.cpp +++ b/src/gtk/dialog.cpp @@ -19,6 +19,7 @@ #include "wx/evtloop.h" #include "wx/scopedptr.h" +#include "wx/testing.h" #include @@ -100,6 +101,8 @@ void wxDialog::SetModal( bool WXUNUSED(flag) ) int wxDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + wxASSERT_MSG( !IsModal(), "ShowModal() can't be called twice" ); // release the mouse if it's currently captured as the window having it diff --git a/src/gtk/filedlg.cpp b/src/gtk/filedlg.cpp index 09508a9f6e..c86a7e37e2 100644 --- a/src/gtk/filedlg.cpp +++ b/src/gtk/filedlg.cpp @@ -29,6 +29,7 @@ #include "wx/filename.h" // wxFilename #include "wx/tokenzr.h" // wxStringTokenizer #include "wx/filefn.h" // ::wxGetCwd +#include "wx/testing.h" //----------------------------------------------------------------------------- // "clicked" for OK-button @@ -342,6 +343,8 @@ void wxFileDialog::OnFakeOk(wxCommandEvent& WXUNUSED(event)) int wxFileDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + CreateExtraControl(); return wxDialog::ShowModal(); diff --git a/src/gtk/gnome/gprint.cpp b/src/gtk/gnome/gprint.cpp index b3800c1dd5..17888b8a6d 100644 --- a/src/gtk/gnome/gprint.cpp +++ b/src/gtk/gnome/gprint.cpp @@ -34,6 +34,7 @@ #include "wx/dynlib.h" #include "wx/paper.h" #include "wx/dcprint.h" +#include "wx/testing.h" #include #include @@ -591,6 +592,8 @@ wxGnomePrintDialog::~wxGnomePrintDialog() int wxGnomePrintDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + int response = gtk_dialog_run (GTK_DIALOG (m_widget)); if (response == GNOME_PRINT_DIALOG_RESPONSE_CANCEL) @@ -736,6 +739,8 @@ wxPageSetupDialogData& wxGnomePageSetupDialog::GetPageSetupDialogData() int wxGnomePageSetupDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + wxGnomePrintNativeData *native = (wxGnomePrintNativeData*) m_pageDialogData.GetPrintData().GetNativeData(); diff --git a/src/gtk/msgdlg.cpp b/src/gtk/msgdlg.cpp index 5bbdc930b8..b01e51b13e 100644 --- a/src/gtk/msgdlg.cpp +++ b/src/gtk/msgdlg.cpp @@ -24,6 +24,8 @@ #include "wx/intl.h" #endif +#include "wx/testing.h" + #include #include "wx/gtk/private.h" #include "wx/gtk/private/messagetype.h" @@ -273,6 +275,8 @@ void wxMessageDialog::GTKCreateMsgDialog() int wxMessageDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + // break the mouse capture as it would interfere with modal dialog (see // wxDialog::ShowModal) wxWindow * const win = wxWindow::GetCapture(); diff --git a/src/gtk/print.cpp b/src/gtk/print.cpp index d3ffb65e26..637e7ec86e 100644 --- a/src/gtk/print.cpp +++ b/src/gtk/print.cpp @@ -34,6 +34,7 @@ #include "wx/dynlib.h" #include "wx/paper.h" #include "wx/scopeguard.h" +#include "wx/testing.h" #include @@ -623,6 +624,8 @@ wxGtkPrintDialog::~wxGtkPrintDialog() // This is called even if we actually don't want the dialog to appear. int wxGtkPrintDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + // We need to restore the settings given in the constructor. wxPrintData data = m_printDialogData.GetPrintData(); wxGtkPrintNativeData *native = @@ -747,6 +750,8 @@ wxGtkPageSetupDialog::~wxGtkPageSetupDialog() int wxGtkPageSetupDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + // Get the config. m_pageDialogData.GetPrintData().ConvertToNative(); wxGtkPrintNativeData *native = (wxGtkPrintNativeData*) m_pageDialogData.GetPrintData().GetNativeData(); diff --git a/src/gtk1/dialog.cpp b/src/gtk1/dialog.cpp index 1646b771cb..8699a02e6b 100644 --- a/src/gtk1/dialog.cpp +++ b/src/gtk1/dialog.cpp @@ -19,6 +19,7 @@ #endif // WX_PRECOMP #include "wx/evtloop.h" +#include "wx/testing.h" #include #include @@ -182,6 +183,8 @@ void wxDialog::SetModal( bool WXUNUSED(flag) ) int wxDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + if (IsModal()) { wxFAIL_MSG( wxT("wxDialog:ShowModal called twice") ); diff --git a/src/gtk1/filedlg.cpp b/src/gtk1/filedlg.cpp index 3827fd1b3d..59f8824386 100644 --- a/src/gtk1/filedlg.cpp +++ b/src/gtk1/filedlg.cpp @@ -13,6 +13,7 @@ #if wxUSE_FILEDLG #include "wx/filedlg.h" +#include "wx/testing.h" //----------------------------------------------------------------------------- @@ -49,6 +50,8 @@ void wxFileDialog::OnFakeOk( wxCommandEvent &event ) int wxFileDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + return wxGenericFileDialog::ShowModal(); } diff --git a/src/motif/dialog.cpp b/src/motif/dialog.cpp index 9291ad72fb..a63aca7d3f 100644 --- a/src/motif/dialog.cpp +++ b/src/motif/dialog.cpp @@ -21,6 +21,7 @@ #endif #include "wx/evtloop.h" +#include "wx/testing.h" #ifdef __VMS__ #pragma message disable nosimpint @@ -288,6 +289,8 @@ bool wxDialog::Show( bool show ) // Shows a dialog modally, returning a return code int wxDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + Show(true); // after the event loop ran, the widget might already have been destroyed diff --git a/src/motif/filedlg.cpp b/src/motif/filedlg.cpp index 57a4970dbe..f1f2970e52 100644 --- a/src/motif/filedlg.cpp +++ b/src/motif/filedlg.cpp @@ -23,6 +23,7 @@ #include "wx/tokenzr.h" #include "wx/stockitem.h" +#include "wx/testing.h" #ifdef __VMS__ #pragma message disable nosimpint @@ -151,6 +152,8 @@ static void wxChangeListBoxColours(wxWindow* WXUNUSED(win), Widget widget) int wxFileDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + wxBeginBusyCursor(); // static char fileBuf[512]; diff --git a/src/motif/msgdlg.cpp b/src/motif/msgdlg.cpp index d648c0e78c..091d430d9d 100644 --- a/src/motif/msgdlg.cpp +++ b/src/motif/msgdlg.cpp @@ -40,6 +40,7 @@ #include "wx/settings.h" #endif +#include "wx/testing.h" #include "wx/motif/private.h" // ---------------------------------------------------------------------------- @@ -105,6 +106,8 @@ extern "C" int wxMessageDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + const long style = GetMessageDialogStyle(); DialogCreateFunction dialogCreateFunction; diff --git a/src/msw/colordlg.cpp b/src/msw/colordlg.cpp index d3a8eaf655..688ca17380 100644 --- a/src/msw/colordlg.cpp +++ b/src/msw/colordlg.cpp @@ -27,6 +27,7 @@ #if wxUSE_COLOURDLG && !(defined(__SMARTPHONE__) && defined(__WXWINCE__)) #include "wx/colordlg.h" +#include "wx/testing.h" #ifndef WX_PRECOMP #include "wx/msw/wrapcdlg.h" @@ -114,6 +115,8 @@ bool wxColourDialog::Create(wxWindow *parent, wxColourData *data) int wxColourDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + // initialize the struct used by Windows CHOOSECOLOR chooseColorStruct; memset(&chooseColorStruct, 0, sizeof(CHOOSECOLOR)); diff --git a/src/msw/dialog.cpp b/src/msw/dialog.cpp index 89d294e760..8c9b2a8d3e 100644 --- a/src/msw/dialog.cpp +++ b/src/msw/dialog.cpp @@ -25,6 +25,7 @@ #endif #include "wx/dialog.h" +#include "wx/testing.h" #ifndef WX_PRECOMP #include "wx/msw/wrapcdlg.h" @@ -197,6 +198,8 @@ bool wxDialog::Show(bool show) // show dialog modally int wxDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + wxASSERT_MSG( !IsModal(), wxT("ShowModal() can't be called twice") ); Show(); diff --git a/src/msw/dirdlg.cpp b/src/msw/dirdlg.cpp index 6b8e2027e1..1760eb8d91 100644 --- a/src/msw/dirdlg.cpp +++ b/src/msw/dirdlg.cpp @@ -30,6 +30,7 @@ (defined(__HANDHELDPC__) && (_WIN32_WCE >= 500))) #include "wx/dirdlg.h" +#include "wx/testing.h" #ifndef WX_PRECOMP #include "wx/utils.h" @@ -220,6 +221,8 @@ void wxDirDialog::SetPath(const wxString& path) int wxDirDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + wxWindow* const parent = GetParent(); WXHWND hWndParent = parent ? GetHwndOf(parent) : NULL; diff --git a/src/msw/filedlg.cpp b/src/msw/filedlg.cpp index 99f73218ac..27dfd888e5 100644 --- a/src/msw/filedlg.cpp +++ b/src/msw/filedlg.cpp @@ -47,6 +47,7 @@ #include "wx/filename.h" #include "wx/scopeguard.h" #include "wx/tokenzr.h" +#include "wx/testing.h" // ---------------------------------------------------------------------------- // constants @@ -449,6 +450,8 @@ void wxFileDialog::MSWOnInitDialogHook(WXHWND hwnd) int wxFileDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + HWND hWnd = 0; if (m_parent) hWnd = (HWND) m_parent->GetHWND(); if (!hWnd && wxTheApp->GetTopWindow()) diff --git a/src/msw/fontdlg.cpp b/src/msw/fontdlg.cpp index 96c3289a6d..848dd4f514 100644 --- a/src/msw/fontdlg.cpp +++ b/src/msw/fontdlg.cpp @@ -27,6 +27,7 @@ #if wxUSE_FONTDLG #include "wx/fontdlg.h" +#include "wx/testing.h" #ifndef WX_PRECOMP #include "wx/msw/wrapcdlg.h" @@ -55,6 +56,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog) int wxFontDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + // It should be OK to always use GDI simulations DWORD flags = CF_SCREENFONTS /* | CF_NOSIMULATIONS */ ; diff --git a/src/msw/msgdlg.cpp b/src/msw/msgdlg.cpp index d2e06d4b79..edff0a0f5a 100644 --- a/src/msw/msgdlg.cpp +++ b/src/msw/msgdlg.cpp @@ -42,6 +42,7 @@ #include "wx/msw/private/button.h" #include "wx/msw/private/metrics.h" #include "wx/msw/private/msgdlg.h" +#include "wx/testing.h" #if wxUSE_MSGBOX_HOOK #include "wx/fontutil.h" @@ -591,6 +592,8 @@ int wxMessageDialog::ShowMessageBox() int wxMessageDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + #ifdef wxHAS_MSW_TASKDIALOG if ( HasNativeTaskDialog() ) { diff --git a/src/msw/printdlg.cpp b/src/msw/printdlg.cpp index 9faae50050..7cf410702c 100644 --- a/src/msw/printdlg.cpp +++ b/src/msw/printdlg.cpp @@ -39,6 +39,7 @@ #include "wx/msw/printdlg.h" #include "wx/msw/dcprint.h" #include "wx/paper.h" +#include "wx/testing.h" #include @@ -738,6 +739,8 @@ wxWindowsPrintDialog::~wxWindowsPrintDialog() int wxWindowsPrintDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + ConvertToNative( m_printDialogData ); PRINTDLG *pd = (PRINTDLG*) m_printDlg; @@ -957,6 +960,8 @@ wxWindowsPageSetupDialog::~wxWindowsPageSetupDialog() int wxWindowsPageSetupDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + ConvertToNative( m_pageSetupData ); PAGESETUPDLG *pd = (PAGESETUPDLG *) m_pageDlg; diff --git a/src/msw/richmsgdlg.cpp b/src/msw/richmsgdlg.cpp index 3b8aa11187..67a827e21b 100644 --- a/src/msw/richmsgdlg.cpp +++ b/src/msw/richmsgdlg.cpp @@ -18,6 +18,7 @@ #if wxUSE_RICHMSGDLG #include "wx/richmsgdlg.h" +#include "wx/testing.h" #ifndef WX_PRECOMP #include "wx/msw/private.h" @@ -33,6 +34,8 @@ int wxRichMessageDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + #ifdef wxHAS_MSW_TASKDIALOG using namespace wxMSWMessageDialog; diff --git a/src/msw/wince/filedlgwce.cpp b/src/msw/wince/filedlgwce.cpp index 6ad061639e..5a7ff8a7a9 100644 --- a/src/msw/wince/filedlgwce.cpp +++ b/src/msw/wince/filedlgwce.cpp @@ -47,6 +47,7 @@ #include #include "wx/filename.h" +#include "wx/testing.h" // ============================================================================ // implementation @@ -112,6 +113,8 @@ void wxFileDialog::SetPath(const wxString& path) int wxFileDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + wxWindow* parentWindow = GetParent(); if (!parentWindow) parentWindow = wxTheApp->GetTopWindow(); diff --git a/src/os2/dialog.cpp b/src/os2/dialog.cpp index 278b22752f..7b1b0d0ce1 100644 --- a/src/os2/dialog.cpp +++ b/src/os2/dialog.cpp @@ -26,6 +26,7 @@ #include "wx/os2/private.h" #include "wx/evtloop.h" #include "wx/scopedptr.h" +#include "wx/testing.h" #define wxDIALOG_DEFAULT_X 300 #define wxDIALOG_DEFAULT_Y 300 @@ -219,6 +220,8 @@ bool wxDialog::Show( bool bShow ) // int wxDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + wxASSERT_MSG( !IsModal(), wxT("wxDialog::ShowModal() reentered?") ); m_endModalCalled = false; diff --git a/src/os2/dirdlg.cpp b/src/os2/dirdlg.cpp index 000c8f61c1..5ae4e61dd6 100644 --- a/src/os2/dirdlg.cpp +++ b/src/os2/dirdlg.cpp @@ -13,6 +13,7 @@ #include "wx/wxprec.h" #include "wx/dirdlg.h" +#include "wx/testing.h" #ifndef WX_PRECOMP #include @@ -42,6 +43,8 @@ wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message, int wxDirDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + // TODO return wxID_CANCEL; } diff --git a/src/os2/filedlg.cpp b/src/os2/filedlg.cpp index f4fc9da6f1..65c8c59df4 100644 --- a/src/os2/filedlg.cpp +++ b/src/os2/filedlg.cpp @@ -39,6 +39,7 @@ #include #include "wx/tokenzr.h" +#include "wx/testing.h" #define wxMAXPATH 1024 #define wxMAXFILE 1024 @@ -104,6 +105,8 @@ void wxFileDialog::GetPaths ( int wxFileDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + wxString sTheFilter; wxString sFilterBuffer; wxChar* pzFilterBuffer; diff --git a/src/os2/fontdlg.cpp b/src/os2/fontdlg.cpp index 676695ac3c..fe9cc27b15 100644 --- a/src/os2/fontdlg.cpp +++ b/src/os2/fontdlg.cpp @@ -23,6 +23,7 @@ #endif #include "wx/fontutil.h" +#include "wx/testing.h" #define INCL_PM #include @@ -36,6 +37,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog) int wxFontDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + FONTDLG vFontDlg; char zCurrentFont[FACESIZE]; HWND hWndFontDlg; diff --git a/src/os2/msgdlg.cpp b/src/os2/msgdlg.cpp index 97e9b8f99c..81dc82639f 100644 --- a/src/os2/msgdlg.cpp +++ b/src/os2/msgdlg.cpp @@ -22,6 +22,7 @@ #include "wx/math.h" #endif +#include "wx/testing.h" #include "wx/os2/private.h" #include @@ -34,6 +35,8 @@ IMPLEMENT_CLASS(wxMessageDialog, wxDialog) int wxMessageDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + HWND hWnd = 0; ULONG ulStyle = MB_OK; int nAns = wxOK; diff --git a/src/osx/carbon/colordlg.cpp b/src/osx/carbon/colordlg.cpp index 1d67843109..18c4af745a 100644 --- a/src/osx/carbon/colordlg.cpp +++ b/src/osx/carbon/colordlg.cpp @@ -14,6 +14,7 @@ #include "wx/colordlg.h" #include "wx/fontdlg.h" +#include "wx/testing.h" #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX @@ -47,6 +48,8 @@ bool wxColourDialog::Create(wxWindow *parent, wxColourData *data) int wxColourDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + RGBColor currentColor ; m_colourData.m_dataColour.GetRGBColor( ¤tColor ); diff --git a/src/osx/carbon/colordlgosx.mm b/src/osx/carbon/colordlgosx.mm index c44060037d..d60418311c 100644 --- a/src/osx/carbon/colordlgosx.mm +++ b/src/osx/carbon/colordlgosx.mm @@ -22,6 +22,7 @@ #include "wx/colordlg.h" #include "wx/fontdlg.h" +#include "wx/testing.h" // ============================================================================ // implementation @@ -122,6 +123,8 @@ bool wxColourDialog::Create(wxWindow *parent, wxColourData *data) } int wxColourDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + //Start the pool. Required for carbon interaction //(For those curious, the only thing that happens //if you don't do this is a bunch of error diff --git a/src/osx/carbon/dirdlg.cpp b/src/osx/carbon/dirdlg.cpp index 1d3c058597..4f98aa02da 100644 --- a/src/osx/carbon/dirdlg.cpp +++ b/src/osx/carbon/dirdlg.cpp @@ -21,6 +21,7 @@ #endif // WX_PRECOMP #include "wx/filename.h" +#include "wx/testing.h" #include "wx/osx/private.h" @@ -72,6 +73,8 @@ wxDirDialog::wxDirDialog(wxWindow *parent, int wxDirDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + NavDialogRef dialog = NULL; NavDialogCreationOptions options; NavReplyRecord reply ; diff --git a/src/osx/carbon/filedlg.cpp b/src/osx/carbon/filedlg.cpp index 9592010d29..d04dfb1923 100644 --- a/src/osx/carbon/filedlg.cpp +++ b/src/osx/carbon/filedlg.cpp @@ -26,6 +26,7 @@ #include "wx/filename.h" #include "wx/osx/private.h" +#include "wx/testing.h" #ifndef __DARWIN__ #include @@ -476,6 +477,8 @@ void wxFileDialog::SetupExtraControls(WXWindow nativeWindow) int wxFileDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + m_paths.Empty(); m_fileNames.Empty(); diff --git a/src/osx/carbon/fontdlg.cpp b/src/osx/carbon/fontdlg.cpp index 8290b53910..0a3cc62812 100644 --- a/src/osx/carbon/fontdlg.cpp +++ b/src/osx/carbon/fontdlg.cpp @@ -42,6 +42,7 @@ #include "wx/fontdlg.h" #include "wx/fontutil.h" +#include "wx/testing.h" #if wxOSX_USE_EXPERIMENTAL_FONTDIALOG @@ -229,6 +230,8 @@ bool wxFontDialog::Create(wxWindow *parent, const wxFontData& data) int wxFontDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + #if wxOSX_USE_CARBON OSStatus err ; diff --git a/src/osx/carbon/fontdlgosx.mm b/src/osx/carbon/fontdlgosx.mm index 6c2ab56c81..b1389b39bc 100644 --- a/src/osx/carbon/fontdlgosx.mm +++ b/src/osx/carbon/fontdlgosx.mm @@ -28,6 +28,7 @@ #endif #include "wx/fontutil.h" +#include "wx/testing.h" // ============================================================================ // implementation @@ -434,6 +435,8 @@ bool wxFontDialog::Create(wxWindow *parent) int wxFontDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + //Start the pool. Required for carbon interaction //(For those curious, the only thing that happens //if you don't do this is a bunch of error diff --git a/src/osx/carbon/msgdlg.cpp b/src/osx/carbon/msgdlg.cpp index b0671595c9..808fbcc385 100644 --- a/src/osx/carbon/msgdlg.cpp +++ b/src/osx/carbon/msgdlg.cpp @@ -19,6 +19,7 @@ #endif #include "wx/thread.h" +#include "wx/testing.h" #include "wx/osx/uma.h" @@ -36,6 +37,8 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent, int wxMessageDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + int resultbutton = wxID_CANCEL; const long style = GetMessageDialogStyle(); diff --git a/src/osx/carbon/printdlg.cpp b/src/osx/carbon/printdlg.cpp index 3f36361060..2a9c234ec7 100644 --- a/src/osx/carbon/printdlg.cpp +++ b/src/osx/carbon/printdlg.cpp @@ -28,9 +28,12 @@ #include "wx/osx/private/print.h" #include "wx/osx/private.h" #include "wx/statline.h" +#include "wx/testing.h" int wxMacPrintDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + m_printDialogData.GetPrintData().ConvertToNative(); ((wxOSXPrintData*)m_printDialogData.GetPrintData().GetNativeData())->TransferFrom( &m_printDialogData ); @@ -74,6 +77,8 @@ int wxMacPrintDialog::ShowModal() int wxMacPageSetupDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + m_pageSetupData.GetPrintData().ConvertToNative(); wxOSXPrintData* nativeData = (wxOSXPrintData*)m_pageSetupData.GetPrintData().GetNativeData(); nativeData->TransferFrom( &m_pageSetupData ); diff --git a/src/osx/cocoa/dirdlg.mm b/src/osx/cocoa/dirdlg.mm index 59f77683c7..700969c3ee 100644 --- a/src/osx/cocoa/dirdlg.mm +++ b/src/osx/cocoa/dirdlg.mm @@ -32,6 +32,7 @@ #include "wx/filename.h" #include "wx/evtloop.h" +#include "wx/testing.h" #include "wx/osx/private.h" @@ -94,6 +95,8 @@ void wxDirDialog::ShowWindowModal() int wxDirDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + wxCFEventLoopPauseIdleEvents pause; NSOpenPanel *oPanel = OSXCreatePanel(); diff --git a/src/osx/cocoa/filedlg.mm b/src/osx/cocoa/filedlg.mm index 6c3386e53f..6e4e5c4f2c 100644 --- a/src/osx/cocoa/filedlg.mm +++ b/src/osx/cocoa/filedlg.mm @@ -38,6 +38,7 @@ #include "wx/osx/private.h" #include "wx/sysopt.h" +#include "wx/testing.h" #include @@ -495,6 +496,8 @@ void wxFileDialog::SetupExtraControls(WXWindow nativeWindow) int wxFileDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + wxCFEventLoopPauseIdleEvents pause; wxMacAutoreleasePool autoreleasepool; diff --git a/src/osx/cocoa/msgdlg.mm b/src/osx/cocoa/msgdlg.mm index 9e4ab729f1..8218fc7e87 100644 --- a/src/osx/cocoa/msgdlg.mm +++ b/src/osx/cocoa/msgdlg.mm @@ -21,6 +21,7 @@ #include "wx/control.h" #include "wx/thread.h" #include "wx/evtloop.h" +#include "wx/testing.h" #include "wx/osx/private.h" @@ -62,6 +63,8 @@ wxMessageDialog::~wxMessageDialog() int wxMessageDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + wxCFEventLoopPauseIdleEvents pause; int resultbutton = wxID_CANCEL; diff --git a/src/osx/cocoa/printdlg.mm b/src/osx/cocoa/printdlg.mm index f7301dc70a..ef9268b377 100644 --- a/src/osx/cocoa/printdlg.mm +++ b/src/osx/cocoa/printdlg.mm @@ -14,6 +14,7 @@ #if wxUSE_PRINTING_ARCHITECTURE #include "wx/printdlg.h" +#include "wx/testing.h" #ifndef WX_PRECOMP #include "wx/object.h" @@ -59,6 +60,8 @@ void wxOSXCocoaPrintData::UpdateToPMState() int wxMacPrintDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + m_printDialogData.GetPrintData().ConvertToNative(); int result = wxID_CANCEL; @@ -82,6 +85,8 @@ int wxMacPrintDialog::ShowModal() int wxMacPageSetupDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + m_pageSetupData.GetPrintData().ConvertToNative(); ((wxOSXCocoaPrintData*)m_pageSetupData.GetPrintData().GetNativeData())->TransferFrom( &m_pageSetupData ); diff --git a/src/osx/dialog_osx.cpp b/src/osx/dialog_osx.cpp index da2c32afec..8bb543ff75 100644 --- a/src/osx/dialog_osx.cpp +++ b/src/osx/dialog_osx.cpp @@ -13,6 +13,7 @@ #include "wx/dialog.h" #include "wx/evtloop.h" +#include "wx/testing.h" #ifndef WX_PRECOMP #include "wx/app.h" @@ -137,6 +138,8 @@ bool wxDialog::Show(bool show) // Replacement for Show(true) for modal dialogs - returns return code int wxDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + m_modality = wxDIALOG_MODALITY_APP_MODAL; Show(); diff --git a/src/osx/iphone/msgdlg.mm b/src/osx/iphone/msgdlg.mm index bb43a66243..9d11768149 100644 --- a/src/osx/iphone/msgdlg.mm +++ b/src/osx/iphone/msgdlg.mm @@ -20,6 +20,7 @@ #include "wx/thread.h" #include "wx/osx/private.h" +#include "wx/testing.h" IMPLEMENT_CLASS(wxMessageDialog, wxDialog) @@ -36,6 +37,8 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent, int wxMessageDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + int resultbutton = wxID_CANCEL; const long style = GetMessageDialogStyle(); diff --git a/src/univ/dialog.cpp b/src/univ/dialog.cpp index c8b9e7aa7d..b698e2a678 100644 --- a/src/univ/dialog.cpp +++ b/src/univ/dialog.cpp @@ -29,6 +29,7 @@ #endif #include "wx/evtloop.h" +#include "wx/testing.h" //----------------------------------------------------------------------------- // wxDialog @@ -165,6 +166,8 @@ bool wxDialog::IsModal() const int wxDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + if ( IsModal() ) { wxFAIL_MSG( wxT("wxDialog:ShowModal called twice") ); diff --git a/tests/Makefile.in b/tests/Makefile.in index 48e44b33da..8a205da130 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -204,6 +204,7 @@ TEST_GUI_OBJECTS = \ test_gui_virtlistctrltest.o \ test_gui_webtest.o \ test_gui_windowtest.o \ + test_gui_dialogtest.o \ test_gui_clone.o \ test_gui_propagation.o \ test_gui_keyboard.o \ @@ -866,6 +867,9 @@ test_gui_webtest.o: $(srcdir)/controls/webtest.cpp $(TEST_GUI_ODEP) test_gui_windowtest.o: $(srcdir)/controls/windowtest.cpp $(TEST_GUI_ODEP) $(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/controls/windowtest.cpp +test_gui_dialogtest.o: $(srcdir)/controls/dialogtest.cpp $(TEST_GUI_ODEP) + $(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/controls/dialogtest.cpp + test_gui_clone.o: $(srcdir)/events/clone.cpp $(TEST_GUI_ODEP) $(CXXC) -c -o $@ $(TEST_GUI_CXXFLAGS) $(srcdir)/events/clone.cpp diff --git a/tests/makefile.bcc b/tests/makefile.bcc index d420b16598..ee3dae68c0 100644 --- a/tests/makefile.bcc +++ b/tests/makefile.bcc @@ -24,9 +24,9 @@ BCCDIR = $(MAKEDIR)\.. WX_RELEASE_NODOT = 29 COMPILER_PREFIX = bcc OBJS = \ - $(COMPILER_PREFIX)$(COMPILER_VERSION)_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WXDLLFLAG)$(CFG) -LIBDIRNAME = \ - .\..\lib\$(COMPILER_PREFIX)$(COMPILER_VERSION)_$(LIBTYPE_SUFFIX)$(CFG) + $(COMPILER_PREFIX)$(COMPILER_VERSION)_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WXDLLFLAG)$(CFG) +LIBDIRNAME = \ + .\..\lib\$(COMPILER_PREFIX)$(COMPILER_VERSION)_$(LIBTYPE_SUFFIX)$(CFG) SETUPHDIR = \ $(LIBDIRNAME)\$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG) TEST_CXXFLAGS = $(__RUNTIME_LIBS) -I$(BCCDIR)\include $(__DEBUGINFO) \ @@ -190,6 +190,7 @@ TEST_GUI_OBJECTS = \ $(OBJS)\test_gui_virtlistctrltest.obj \ $(OBJS)\test_gui_webtest.obj \ $(OBJS)\test_gui_windowtest.obj \ + $(OBJS)\test_gui_dialogtest.obj \ $(OBJS)\test_gui_clone.obj \ $(OBJS)\test_gui_propagation.obj \ $(OBJS)\test_gui_keyboard.obj \ @@ -221,9 +222,9 @@ PORTNAME = base !if "$(USE_GUI)" == "1" PORTNAME = msw !endif -!if "$(OFFICIAL_BUILD)" == "1" -COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD -!endif +!if "$(OFFICIAL_BUILD)" == "1" +COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD +!endif !if "$(BUILD)" == "debug" WXDEBUGFLAG = d !endif @@ -910,6 +911,9 @@ $(OBJS)\test_gui_webtest.obj: .\controls\webtest.cpp $(OBJS)\test_gui_windowtest.obj: .\controls\windowtest.cpp $(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\controls\windowtest.cpp +$(OBJS)\test_gui_dialogtest.obj: .\controls\dialogtest.cpp + $(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\controls\dialogtest.cpp + $(OBJS)\test_gui_clone.obj: .\events\clone.cpp $(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\events\clone.cpp diff --git a/tests/makefile.gcc b/tests/makefile.gcc index 1f6784aca8..21636a2ed5 100644 --- a/tests/makefile.gcc +++ b/tests/makefile.gcc @@ -16,9 +16,9 @@ CPPDEPS = -MT$@ -MF$@.d -MD -MP WX_RELEASE_NODOT = 29 COMPILER_PREFIX = gcc OBJS = \ - $(COMPILER_PREFIX)$(COMPILER_VERSION)_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WXDLLFLAG)$(CFG) -LIBDIRNAME = \ - .\..\lib\$(COMPILER_PREFIX)$(COMPILER_VERSION)_$(LIBTYPE_SUFFIX)$(CFG) + $(COMPILER_PREFIX)$(COMPILER_VERSION)_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WXDLLFLAG)$(CFG) +LIBDIRNAME = \ + .\..\lib\$(COMPILER_PREFIX)$(COMPILER_VERSION)_$(LIBTYPE_SUFFIX)$(CFG) SETUPHDIR = \ $(LIBDIRNAME)\$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG) TEST_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) $(GCCFLAGS) \ @@ -183,6 +183,7 @@ TEST_GUI_OBJECTS = \ $(OBJS)\test_gui_virtlistctrltest.o \ $(OBJS)\test_gui_webtest.o \ $(OBJS)\test_gui_windowtest.o \ + $(OBJS)\test_gui_dialogtest.o \ $(OBJS)\test_gui_clone.o \ $(OBJS)\test_gui_propagation.o \ $(OBJS)\test_gui_keyboard.o \ @@ -217,9 +218,9 @@ endif ifeq ($(USE_GUI),1) PORTNAME = msw endif -ifeq ($(OFFICIAL_BUILD),1) -COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD -endif +ifeq ($(OFFICIAL_BUILD),1) +COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD +endif ifeq ($(BUILD),debug) WXDEBUGFLAG = d endif @@ -893,6 +894,9 @@ $(OBJS)\test_gui_webtest.o: ./controls/webtest.cpp $(OBJS)\test_gui_windowtest.o: ./controls/windowtest.cpp $(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\test_gui_dialogtest.o: ./controls/dialogtest.cpp + $(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\test_gui_clone.o: ./events/clone.cpp $(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $< diff --git a/tests/makefile.vc b/tests/makefile.vc index 5db23a61d4..aa1fc890d5 100644 --- a/tests/makefile.vc +++ b/tests/makefile.vc @@ -15,9 +15,9 @@ WX_RELEASE_NODOT = 29 COMPILER_PREFIX = vc OBJS = \ - $(COMPILER_PREFIX)$(COMPILER_VERSION)_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WXDLLFLAG)$(CFG)$(ARCH_SUFFIX) + $(COMPILER_PREFIX)$(COMPILER_VERSION)_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WXDLLFLAG)$(CFG)$(ARCH_SUFFIX) LIBDIRNAME = \ - .\..\lib\$(COMPILER_PREFIX)$(COMPILER_VERSION)$(ARCH_SUFFIX)_$(LIBTYPE_SUFFIX)$(CFG) + .\..\lib\$(COMPILER_PREFIX)$(COMPILER_VERSION)$(ARCH_SUFFIX)_$(LIBTYPE_SUFFIX)$(CFG) SETUPHDIR = \ $(LIBDIRNAME)\$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG) TEST_CXXFLAGS = /M$(__RUNTIME_LIBS_10)$(__DEBUGRUNTIME) /DWIN32 $(__DEBUGINFO) \ @@ -187,6 +187,7 @@ TEST_GUI_OBJECTS = \ $(OBJS)\test_gui_virtlistctrltest.obj \ $(OBJS)\test_gui_webtest.obj \ $(OBJS)\test_gui_windowtest.obj \ + $(OBJS)\test_gui_dialogtest.obj \ $(OBJS)\test_gui_clone.obj \ $(OBJS)\test_gui_propagation.obj \ $(OBJS)\test_gui_keyboard.obj \ @@ -214,33 +215,33 @@ TEST_GUI_RESOURCES = \ ### Conditionally set variables: ### -!if "$(TARGET_CPU)" == "AMD64" -ARCH_SUFFIX = _x64 -!endif -!if "$(TARGET_CPU)" == "IA64" -ARCH_SUFFIX = _ia64 -!endif -!if "$(TARGET_CPU)" == "X64" -ARCH_SUFFIX = _x64 -!endif -!if "$(TARGET_CPU)" == "amd64" -ARCH_SUFFIX = _x64 -!endif -!if "$(TARGET_CPU)" == "ia64" -ARCH_SUFFIX = _ia64 -!endif -!if "$(TARGET_CPU)" == "x64" -ARCH_SUFFIX = _x64 -!endif +!if "$(TARGET_CPU)" == "AMD64" +ARCH_SUFFIX = _x64 +!endif +!if "$(TARGET_CPU)" == "IA64" +ARCH_SUFFIX = _ia64 +!endif +!if "$(TARGET_CPU)" == "X64" +ARCH_SUFFIX = _x64 +!endif +!if "$(TARGET_CPU)" == "amd64" +ARCH_SUFFIX = _x64 +!endif +!if "$(TARGET_CPU)" == "ia64" +ARCH_SUFFIX = _ia64 +!endif +!if "$(TARGET_CPU)" == "x64" +ARCH_SUFFIX = _x64 +!endif !if "$(USE_GUI)" == "0" PORTNAME = base !endif !if "$(USE_GUI)" == "1" PORTNAME = msw !endif -!if "$(OFFICIAL_BUILD)" == "1" -COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD -!endif +!if "$(OFFICIAL_BUILD)" == "1" +COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD +!endif !if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default" WXDEBUGFLAG = d !endif @@ -268,18 +269,18 @@ LINK_TARGET_CPU = /MACHINE:X64 !if "$(TARGET_CPU)" == "IA64" LINK_TARGET_CPU = /MACHINE:IA64 !endif -!if "$(TARGET_CPU)" == "X64" -LINK_TARGET_CPU = /MACHINE:X64 -!endif +!if "$(TARGET_CPU)" == "X64" +LINK_TARGET_CPU = /MACHINE:X64 +!endif !if "$(TARGET_CPU)" == "amd64" LINK_TARGET_CPU = /MACHINE:X64 !endif !if "$(TARGET_CPU)" == "ia64" LINK_TARGET_CPU = /MACHINE:IA64 !endif -!if "$(TARGET_CPU)" == "x64" -LINK_TARGET_CPU = /MACHINE:X64 -!endif +!if "$(TARGET_CPU)" == "x64" +LINK_TARGET_CPU = /MACHINE:X64 +!endif !if "$(MONOLITHIC)" == "0" EXTRALIBS_FOR_BASE = !endif @@ -1050,6 +1051,9 @@ $(OBJS)\test_gui_webtest.obj: .\controls\webtest.cpp $(OBJS)\test_gui_windowtest.obj: .\controls\windowtest.cpp $(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\controls\windowtest.cpp +$(OBJS)\test_gui_dialogtest.obj: .\controls\dialogtest.cpp + $(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\controls\dialogtest.cpp + $(OBJS)\test_gui_clone.obj: .\events\clone.cpp $(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\events\clone.cpp diff --git a/tests/makefile.wat b/tests/makefile.wat index 7eaa190e05..6cd16d2fcb 100644 --- a/tests/makefile.wat +++ b/tests/makefile.wat @@ -38,10 +38,10 @@ PORTNAME = base !ifeq USE_GUI 1 PORTNAME = msw !endif -COMPILER_VERSION = -!ifeq OFFICIAL_BUILD 1 -COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD -!endif +COMPILER_VERSION = +!ifeq OFFICIAL_BUILD 1 +COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD +!endif WXDEBUGFLAG = !ifeq BUILD debug WXDEBUGFLAG = d @@ -273,9 +273,9 @@ __DLLFLAG_p = -dWXUSINGDLL WX_RELEASE_NODOT = 29 COMPILER_PREFIX = wat OBJS = & - $(COMPILER_PREFIX)$(COMPILER_VERSION)_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WXDLLFLAG)$(CFG) -LIBDIRNAME = & - .\..\lib\$(COMPILER_PREFIX)$(COMPILER_VERSION)_$(LIBTYPE_SUFFIX)$(CFG) + $(COMPILER_PREFIX)$(COMPILER_VERSION)_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WXDLLFLAG)$(CFG) +LIBDIRNAME = & + .\..\lib\$(COMPILER_PREFIX)$(COMPILER_VERSION)_$(LIBTYPE_SUFFIX)$(CFG) SETUPHDIR = & $(LIBDIRNAME)\$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG) TEST_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) & @@ -440,6 +440,7 @@ TEST_GUI_OBJECTS = & $(OBJS)\test_gui_virtlistctrltest.obj & $(OBJS)\test_gui_webtest.obj & $(OBJS)\test_gui_windowtest.obj & + $(OBJS)\test_gui_dialogtest.obj & $(OBJS)\test_gui_clone.obj & $(OBJS)\test_gui_propagation.obj & $(OBJS)\test_gui_keyboard.obj & @@ -954,6 +955,9 @@ $(OBJS)\test_gui_webtest.obj : .AUTODEPEND .\controls\webtest.cpp $(OBJS)\test_gui_windowtest.obj : .AUTODEPEND .\controls\windowtest.cpp $(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $< +$(OBJS)\test_gui_dialogtest.obj : .AUTODEPEND .\controls\dialogtest.cpp + $(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $< + $(OBJS)\test_gui_clone.obj : .AUTODEPEND .\events\clone.cpp $(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $< diff --git a/tests/test.bkl b/tests/test.bkl index cc6d1dec19..1cb5ca5707 100644 --- a/tests/test.bkl +++ b/tests/test.bkl @@ -185,6 +185,7 @@ controls/virtlistctrltest.cpp controls/webtest.cpp controls/windowtest.cpp + controls/dialogtest.cpp events/clone.cpp events/propagation.cpp events/keyboard.cpp diff --git a/tests/test_test_gui.dsp b/tests/test_test_gui.dsp index 67c3188f76..ffc1192388 100644 --- a/tests/test_test_gui.dsp +++ b/tests/test_test_gui.dsp @@ -315,6 +315,10 @@ SOURCE=.\controls\datepickerctrltest.cpp # End Source File # Begin Source File +SOURCE=.\controls\dialogtest.cpp +# End Source File +# Begin Source File + SOURCE=.\dummy.cpp # ADD BASE CPP /Yc"testprec.h" # ADD CPP /Yc"testprec.h" diff --git a/tests/test_vc7_test_gui.vcproj b/tests/test_vc7_test_gui.vcproj index 1a5249e377..4342115560 100644 --- a/tests/test_vc7_test_gui.vcproj +++ b/tests/test_vc7_test_gui.vcproj @@ -625,6 +625,9 @@ + + + + diff --git a/tests/test_vc9_test_gui.vcproj b/tests/test_vc9_test_gui.vcproj index bd65e26ccf..df66968922 100644 --- a/tests/test_vc9_test_gui.vcproj +++ b/tests/test_vc9_test_gui.vcproj @@ -879,6 +879,10 @@ RelativePath=".\controls\datepickerctrltest.cpp" > + +