]> git.saurik.com Git - wxWidgets.git/commitdiff
Add wxTEST_DIALOG for testing of modal dialogs.
authorVáclav Slavík <vslavik@fastmail.fm>
Thu, 1 Nov 2012 16:45:11 +0000 (16:45 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Thu, 1 Nov 2012 16:45:11 +0000 (16:45 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72837 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

58 files changed:
include/wx/testing.h [new file with mode: 0644]
src/cocoa/dialog.mm
src/cocoa/dirdlg.mm
src/cocoa/filedlg.mm
src/cocoa/msgdlg.mm
src/common/dlgcmn.cpp
src/generic/filedlgg.cpp
src/generic/msgdlgg.cpp
src/gtk/colordlg.cpp
src/gtk/dialog.cpp
src/gtk/filedlg.cpp
src/gtk/gnome/gprint.cpp
src/gtk/msgdlg.cpp
src/gtk/print.cpp
src/gtk1/dialog.cpp
src/gtk1/filedlg.cpp
src/motif/dialog.cpp
src/motif/filedlg.cpp
src/motif/msgdlg.cpp
src/msw/colordlg.cpp
src/msw/dialog.cpp
src/msw/dirdlg.cpp
src/msw/filedlg.cpp
src/msw/fontdlg.cpp
src/msw/msgdlg.cpp
src/msw/printdlg.cpp
src/msw/richmsgdlg.cpp
src/msw/wince/filedlgwce.cpp
src/os2/dialog.cpp
src/os2/dirdlg.cpp
src/os2/filedlg.cpp
src/os2/fontdlg.cpp
src/os2/msgdlg.cpp
src/osx/carbon/colordlg.cpp
src/osx/carbon/colordlgosx.mm
src/osx/carbon/dirdlg.cpp
src/osx/carbon/filedlg.cpp
src/osx/carbon/fontdlg.cpp
src/osx/carbon/fontdlgosx.mm
src/osx/carbon/msgdlg.cpp
src/osx/carbon/printdlg.cpp
src/osx/cocoa/dirdlg.mm
src/osx/cocoa/filedlg.mm
src/osx/cocoa/msgdlg.mm
src/osx/cocoa/printdlg.mm
src/osx/dialog_osx.cpp
src/osx/iphone/msgdlg.mm
src/univ/dialog.cpp
tests/Makefile.in
tests/makefile.bcc
tests/makefile.gcc
tests/makefile.vc
tests/makefile.wat
tests/test.bkl
tests/test_test_gui.dsp
tests/test_vc7_test_gui.vcproj
tests/test_vc8_test_gui.vcproj
tests/test_vc9_test_gui.vcproj

diff --git a/include/wx/testing.h b/include/wx/testing.h
new file mode 100644 (file)
index 0000000..905184e
--- /dev/null
@@ -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 <algorithm>
+#include <iterator>
+#include <queue>
+#include "wx/afterstd.h"
+#include "wx/cpp.h"
+
+class wxTestingModalHook;
+
+// Non-template base class for wxExpectModal<T> (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<T>.
+template<class T> class wxExpectModal {};
+
+
+/**
+    Base class for wxExpectModal<T> specializations.
+
+    Every such specialization must be derived from wxExpectModalBase; there's
+    no other use for this class than to serve as wxExpectModal<T>'s base class.
+
+    T must be a class derived from wxDialog.
+ */
+template<class T>
+class wxExpectModalBase : public wxModalExpectation
+{
+public:
+    typedef T DialogType;
+    typedef wxExpectModal<DialogType> 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<const ExpectationType*>(this));
+        e.m_isOptional = true;
+        return e;
+    }
+
+protected:
+    virtual int Invoke(wxDialog *dlg) const
+    {
+        DialogType *t = dynamic_cast<DialogType*>(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<T> specializations for common dialogs:
+
+template<>
+class wxExpectModal<wxMessageDialog> : public wxExpectModalBase<wxMessageDialog>
+{
+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<wxFileDialog> : public wxExpectModalBase<wxFileDialog>
+{
+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<T> 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<const wxModalExpectation*> 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<T>
+    hooks, instead of being shown to the user.
+
+    The first argument is any valid expression, typically a function call. The
+    remaining arguments are wxExpectModal<T> instances defining the dialogs
+    that are expected to be shown, in order of appearance.
+
+    Some typical examples:
+
+    @code
+    wxTEST_DIALOG
+    (
+        rc = dlg.ShowModal(),
+        wxExpectModal<wxFileDialog>(wxGetCwd() + "/test.txt")
+    );
+    @endcode
+
+    Sometimes, the code may show more than one dialog:
+
+    @code
+    wxTEST_DIALOG
+    (
+        RunSomeFunction(),
+        wxExpectModal<wxMessageDialog>(wxNO),
+        wxExpectModal<MyConfirmationDialog>(wxYES),
+        wxExpectModal<wxFileDialog>(wxGetCwd() + "/test.txt")
+    );
+    @endcode
+
+    Notice that wxExpectModal<T> 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<wxMessageDialog>(wxNO),
+        wxExpectModal<wxFileDialog>(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_
index 7c5d51690741e22826b894a59b4894309aff3251..fbc8bbe18d48749a162aa3a47b0247f45929e530 100644 (file)
@@ -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
index 1c3c95d8a5c5502a89b161c44cdb55ad8c235def..bc4613aa22e2503433cd9733772a6de2ab300edd 100644 (file)
@@ -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();
index 576ed6920c2332e4b21cf74bb9767eadc72ea5b6..613f75bfeab2b521314ac61297a1ad60d902bee6 100644 (file)
@@ -33,6 +33,7 @@
 
 #include "wx/cocoa/autorelease.h"
 #include "wx/cocoa/string.h"
+#include "wx/testing.h"
 
 #import <AppKit/NSOpenPanel.h>
 #import <AppKit/NSSavePanel.h>
@@ -196,6 +197,8 @@ void wxFileDialog::SetPath(const wxString& path)
 
 int wxFileDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     wxAutoNSAutoreleasePool thePool;
 
     m_fileNames.Empty();
index 772ec2489de7a35f5b0fdcc7f1c0c18e4db9c936..0d6072a226f83235d412ba51577a3c029c6e5825 100644 (file)
@@ -31,6 +31,7 @@
 
 #include "wx/cocoa/autorelease.h"
 #include "wx/cocoa/string.h"
+#include "wx/testing.h"
 
 #import <AppKit/NSAlert.h>
 // ============================================================================
@@ -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];
index 5cbbc7e390ba3c85899705ddd54716c17abbf5ec..9289aa2d583fa882b8624d34fbd8e3210d2de9f5 100644 (file)
@@ -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
 // ----------------------------------------------------------------------------
index a2a370d862fed7f76af7e71bdf2b782209b116b3..cd2e4da73f007f841464b3948d193e034bac5fc4 100644 (file)
@@ -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();
index c3dd7a8067f28e0ec8b74adbc634c28870bc3af1..b2d162d31af8d2db350fa8faa27005aae232db5e 100644 (file)
@@ -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;
index c6ac162f2fc934bdb89a946012b6851a7e8ef4ee..87b61d2d443e5b0c3decfef861039803549a9b65 100644 (file)
@@ -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));
index 7fcfd47c56e7eb9304bb486c0e4903542753ff48..4cf2730f9c3854d099d2af3a82771397c1959f77 100644 (file)
@@ -19,6 +19,7 @@
 #include "wx/evtloop.h"
 
 #include "wx/scopedptr.h"
+#include "wx/testing.h"
 
 #include <gtk/gtk.h>
 
@@ -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
index 09508a9f6eba0fb9bc2bd0c81b25a633a4eb3cd0..c86a7e37e21e4ae1858ee5e5108e3d1408a5cff5 100644 (file)
@@ -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();
index b3800c1dd5b645826c17d6b876474c35db04be8d..17888b8a6ddb98737335f7c49cc4aa29d59be457 100644 (file)
@@ -34,6 +34,7 @@
 #include "wx/dynlib.h"
 #include "wx/paper.h"
 #include "wx/dcprint.h"
+#include "wx/testing.h"
 
 #include <libgnomeprint/gnome-print.h>
 #include <libgnomeprint/gnome-print-pango.h>
@@ -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();
 
index 5bbdc930b815ccc555ccdf5cd3c17aebe6c6b373..b01e51b13e95639306c7c1f508b4b20fc2fcc575 100644 (file)
@@ -24,6 +24,8 @@
     #include "wx/intl.h"
 #endif
 
+#include "wx/testing.h"
+
 #include <gtk/gtk.h>
 #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();
index d3ffb65e26cb8ae4cc07d570a4c5e4e9180b28a0..637e7ec86ee113393c13876b951ae4079d6f60a6 100644 (file)
@@ -34,6 +34,7 @@
 #include "wx/dynlib.h"
 #include "wx/paper.h"
 #include "wx/scopeguard.h"
+#include "wx/testing.h"
 
 #include <gtk/gtk.h>
 
@@ -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();
index 1646b771cbde9e447009f9106e0277dae0739e08..8699a02e6b50980bc4b64d9815e32d330e5a811e 100644 (file)
@@ -19,6 +19,7 @@
 #endif // WX_PRECOMP
 
 #include "wx/evtloop.h"
+#include "wx/testing.h"
 
 #include <gdk/gdk.h>
 #include <gtk/gtk.h>
@@ -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") );
index 3827fd1b3d2917bc52aedaf80736860bdd647027..59f8824386cee798d7be064e48b154a8f236a7fa 100644 (file)
@@ -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();
 }
 
index 9291ad72fb99f138a65bb54a7966c7d48aa021dc..a63aca7d3fc7c0248eef870ce51f429fde9baa50 100644 (file)
@@ -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
index 57a4970dbe43260181de4d24e35007a90f12d6cd..f1f2970e52f25d60dc5212d9cb5147721c9389c5 100644 (file)
@@ -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];
index d648c0e78c95c06afb287d1aea9bde23c0417f30..091d430d9d6406a6c5aaf92e038e70ac93a02e71 100644 (file)
@@ -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;
index d3a8eaf655650f001cb729bac97a7f3ed99b5b53..688ca17380e51d4ab41f777b304324e109434d99 100644 (file)
@@ -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));
index 89d294e76021e4b98a2668d26bd7d97ee14c898d..8c9b2a8d3efd44226ca1ce1befca6b3d5e47458e 100644 (file)
@@ -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();
index 6b8e2027e13a9f7471a70d5c163ab526f34f4897..1760eb8d91aecd1f65bb903c16a86da3d57554bf 100644 (file)
@@ -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;
 
index 99f73218ac8d1a7fb6745a9c8b0513c02e7beec5..27dfd888e5c4f4da3e17ee7bc5a3c78eca3f2da8 100644 (file)
@@ -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())
index 96c3289a6d7c925c19aa2f0bda44ad54aaad4a37..848dd4f5143e08b4040e36148b393d18c7273e63 100644 (file)
@@ -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 */ ;
 
index d2e06d4b7914c6cf4b91c62093fb624a541afe9c..edff0a0f5a55c7523c79fb55989e8e5014a2b2b3 100644 (file)
@@ -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() )
     {
index 9faae50050755071bea0fd65944ac1f9d57c584b..7cf410702c05cec428e8bf227460dda2bdad067c 100644 (file)
@@ -39,6 +39,7 @@
 #include "wx/msw/printdlg.h"
 #include "wx/msw/dcprint.h"
 #include "wx/paper.h"
+#include "wx/testing.h"
 
 #include <stdlib.h>
 
@@ -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;
index 3b8aa11187d5319d96cf4612ebe3593c0b138d19..67a827e21b151560b0d9a9b5015700536a906512 100644 (file)
@@ -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;
 
index 6ad061639eb1a1dcbd6e804c2cd53fa769ea8b6b..5a7ff8a7a94bb279951ee7707f4ac04e8ec5d6bd 100644 (file)
@@ -47,6 +47,7 @@
 #include <string.h>
 
 #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();
index 278b22752fa23d2c937010deb1af6b80a6fba595..7b1b0d0ce13d33d996a47f900589a8a17cca25aa 100644 (file)
@@ -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;
index 000c8f61c18b8d284efa30db6515f1d876e89450..5ae4e61dd64b6868f0e6ced58d4450b87c1d27c4 100644 (file)
@@ -13,6 +13,7 @@
 #include "wx/wxprec.h"
 
 #include "wx/dirdlg.h"
+#include "wx/testing.h"
 
 #ifndef WX_PRECOMP
     #include <stdio.h>
@@ -42,6 +43,8 @@ wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message,
 
 int wxDirDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     // TODO
     return wxID_CANCEL;
 }
index f4fc9da6f11269bc69734045a1ca7ed63b9fb494..65c8c59df48831e0f560cde2197a29264df22bd0 100644 (file)
@@ -39,6 +39,7 @@
 #include <string.h>
 
 #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;
index 676695ac3c985757e687ecea3e4461932b76b888..fe9cc27b1559d07a885d21ecc1b285d2708de717 100644 (file)
@@ -23,6 +23,7 @@
 #endif
 
 #include "wx/fontutil.h"
+#include "wx/testing.h"
 
 #define INCL_PM
 #include <os2.h>
@@ -36,6 +37,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog)
 
 int wxFontDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     FONTDLG      vFontDlg;
     char         zCurrentFont[FACESIZE];
     HWND         hWndFontDlg;
index 97e9b8f99c4ca1d7e317208b7a86616c1d04f355..81dc82639f44554b22047a6465c9b4edead0dd10 100644 (file)
@@ -22,6 +22,7 @@
     #include "wx/math.h"
 #endif
 
+#include "wx/testing.h"
 #include "wx/os2/private.h"
 
 #include <stdlib.h>
@@ -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;
index 1d678431098c494b6bece1982e98a88003816c5d..18c4af745a7811cf84ec6e7f80b56465c67c4523 100644 (file)
@@ -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( &currentColor );
index c44060037d313d78115efac678ae48d72e1bc8f4..d60418311cfab27d5264c6276de334d52c4b3aed 100644 (file)
@@ -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
index 1d3c058597272938769770402704569db47a59d8..4f98aa02da956540ea16cb6fb5a7b05a53d65a04 100644 (file)
@@ -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 ;
index 9592010d29a745d114973d963cbf30ef7a4d8a8b..d04dfb192362bcf1f70e58e5dfe1d870e44c62c9 100644 (file)
@@ -26,6 +26,7 @@
 #include "wx/filename.h"
 
 #include "wx/osx/private.h"
+#include "wx/testing.h"
 
 #ifndef __DARWIN__
     #include <Navigation.h>
@@ -476,6 +477,8 @@ void wxFileDialog::SetupExtraControls(WXWindow nativeWindow)
 
 int wxFileDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     m_paths.Empty();
     m_fileNames.Empty();
 
index 8290b53910ecae1953d4f87db69962d8db8023eb..0a3cc628123e58518255423b67b8dd0aedeef12f 100644 (file)
@@ -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 ;
index 6c2ab56c81a3e5a25b92f3c9e1c117ece1a26267..b1389b39bce11d8afd6c9c8610e6f0161874a126 100644 (file)
@@ -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
index b0671595c9fc694f3215a9da5a2bad5c5ccd2789..808fbcc3857a10bead04885d545ed1a872207bc5 100644 (file)
@@ -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();
index 3f36361060f38cf6f1bac980e6511d950bc1ad0d..2a9c234ec75bb3e5c8f6cfb8530c0802d996eebf 100644 (file)
 #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 );
index 59f77683c79593a1439607ce76ded497228cfa16..700969c3ee598d851fd7cd469ec4b5fba9ed52bc 100644 (file)
@@ -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();
index 6c3386e53fefa73a84b779e5316bf4070561c5cf..6e4e5c4f2c243a8e7af63960de8e8abbb31bd501 100644 (file)
@@ -38,6 +38,7 @@
 
 #include "wx/osx/private.h"
 #include "wx/sysopt.h"
+#include "wx/testing.h"
 
 #include <mach-o/dyld.h>
 
@@ -495,6 +496,8 @@ void wxFileDialog::SetupExtraControls(WXWindow nativeWindow)
 
 int wxFileDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     wxCFEventLoopPauseIdleEvents pause;
 
     wxMacAutoreleasePool autoreleasepool;
index 9e4ab729f16779ef0485dba43091b532f07aca87..8218fc7e872dad4920a334ec3e4efbbdb03c710c 100644 (file)
@@ -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;
index f7301dc70a0d255c699fab3332f15dcf54f7814d..ef9268b37720e23f41a34bc004fc95c496991772 100644 (file)
@@ -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 );
 
index da2c32afece2da807ca4292e67b7f5183e82a845..8bb543ff756dce463b92d38b16a911e36adbeec4 100644 (file)
@@ -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();
index bb43a6624376492bf0fac5599dd13eb7e2479146..9d11768149a16fde2ef2ab4dc81cabf59b0c47d1 100644 (file)
@@ -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();
index c8b9e7aa7da7a14a741c00374c3e6526dc8338d0..b698e2a6787e46ba46980c7cb9d101ae3b0c4ded 100644 (file)
@@ -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") );
index 48e44b33da5d2d5dfa9eb98e73723de29823633f..8a205da13009d8e7566a17f4b42bb958c80c2c63 100644 (file)
@@ -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
 
index d420b1659803a19c23fcef1684b9ac9a342c79cf..ee3dae68c019d40f8c21cd7728d7388e2b21c1b6 100644 (file)
@@ -24,9 +24,9 @@ BCCDIR = $(MAKEDIR)\..
 WX_RELEASE_NODOT = 29\r
 COMPILER_PREFIX = bcc\r
 OBJS = \\r
-       $(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)\r
+LIBDIRNAME = \\r
+       .\..\lib\$(COMPILER_PREFIX)$(COMPILER_VERSION)_$(LIBTYPE_SUFFIX)$(CFG)\r
 SETUPHDIR = \\r
        $(LIBDIRNAME)\$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)\r
 TEST_CXXFLAGS = $(__RUNTIME_LIBS) -I$(BCCDIR)\include $(__DEBUGINFO) \\r
@@ -190,6 +190,7 @@ TEST_GUI_OBJECTS =  \
        $(OBJS)\test_gui_virtlistctrltest.obj \\r
        $(OBJS)\test_gui_webtest.obj \\r
        $(OBJS)\test_gui_windowtest.obj \\r
+       $(OBJS)\test_gui_dialogtest.obj \\r
        $(OBJS)\test_gui_clone.obj \\r
        $(OBJS)\test_gui_propagation.obj \\r
        $(OBJS)\test_gui_keyboard.obj \\r
@@ -221,9 +222,9 @@ PORTNAME = base
 !if "$(USE_GUI)" == "1"\r
 PORTNAME = msw\r
 !endif\r
-!if "$(OFFICIAL_BUILD)" == "1"
-COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD
-!endif
+!if "$(OFFICIAL_BUILD)" == "1"\r
+COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD\r
+!endif\r
 !if "$(BUILD)" == "debug"\r
 WXDEBUGFLAG = d\r
 !endif\r
@@ -910,6 +911,9 @@ $(OBJS)\test_gui_webtest.obj: .\controls\webtest.cpp
 $(OBJS)\test_gui_windowtest.obj: .\controls\windowtest.cpp\r
        $(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\controls\windowtest.cpp\r
 \r
+$(OBJS)\test_gui_dialogtest.obj: .\controls\dialogtest.cpp\r
+       $(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\controls\dialogtest.cpp\r
+\r
 $(OBJS)\test_gui_clone.obj: .\events\clone.cpp\r
        $(CXX) -q -c -P -o$@ $(TEST_GUI_CXXFLAGS) .\events\clone.cpp\r
 \r
index 1f6784aca8b8cfd47296b741c8978ac80db0648c..21636a2ed5623b5d5fa17a97e754c2aa5b9a592b 100644 (file)
@@ -16,9 +16,9 @@ CPPDEPS = -MT$@ -MF$@.d -MD -MP
 WX_RELEASE_NODOT = 29\r
 COMPILER_PREFIX = gcc\r
 OBJS = \\r
-       $(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)\r
+LIBDIRNAME = \\r
+       .\..\lib\$(COMPILER_PREFIX)$(COMPILER_VERSION)_$(LIBTYPE_SUFFIX)$(CFG)\r
 SETUPHDIR = \\r
        $(LIBDIRNAME)\$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)\r
 TEST_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) $(GCCFLAGS) \\r
@@ -183,6 +183,7 @@ TEST_GUI_OBJECTS =  \
        $(OBJS)\test_gui_virtlistctrltest.o \\r
        $(OBJS)\test_gui_webtest.o \\r
        $(OBJS)\test_gui_windowtest.o \\r
+       $(OBJS)\test_gui_dialogtest.o \\r
        $(OBJS)\test_gui_clone.o \\r
        $(OBJS)\test_gui_propagation.o \\r
        $(OBJS)\test_gui_keyboard.o \\r
@@ -217,9 +218,9 @@ endif
 ifeq ($(USE_GUI),1)\r
 PORTNAME = msw\r
 endif\r
-ifeq ($(OFFICIAL_BUILD),1)
-COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD
-endif
+ifeq ($(OFFICIAL_BUILD),1)\r
+COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD\r
+endif\r
 ifeq ($(BUILD),debug)\r
 WXDEBUGFLAG = d\r
 endif\r
@@ -893,6 +894,9 @@ $(OBJS)\test_gui_webtest.o: ./controls/webtest.cpp
 $(OBJS)\test_gui_windowtest.o: ./controls/windowtest.cpp\r
        $(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<\r
 \r
+$(OBJS)\test_gui_dialogtest.o: ./controls/dialogtest.cpp\r
+       $(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<\r
+\r
 $(OBJS)\test_gui_clone.o: ./events/clone.cpp\r
        $(CXX) -c -o $@ $(TEST_GUI_CXXFLAGS) $(CPPDEPS) $<\r
 \r
index 5db23a61d44e38beaa9e2aed7107e8d672977462..aa1fc890d533a582b4c2c3ee11b0639e9ededd1a 100644 (file)
@@ -15,9 +15,9 @@
 WX_RELEASE_NODOT = 29\r
 COMPILER_PREFIX = vc\r
 OBJS = \\r
-       $(COMPILER_PREFIX)$(COMPILER_VERSION)_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WXDLLFLAG)$(CFG)$(ARCH_SUFFIX)
+       $(COMPILER_PREFIX)$(COMPILER_VERSION)_$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WXDLLFLAG)$(CFG)$(ARCH_SUFFIX)\r
 LIBDIRNAME = \\r
-       .\..\lib\$(COMPILER_PREFIX)$(COMPILER_VERSION)$(ARCH_SUFFIX)_$(LIBTYPE_SUFFIX)$(CFG)
+       .\..\lib\$(COMPILER_PREFIX)$(COMPILER_VERSION)$(ARCH_SUFFIX)_$(LIBTYPE_SUFFIX)$(CFG)\r
 SETUPHDIR = \\r
        $(LIBDIRNAME)\$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)\r
 TEST_CXXFLAGS = /M$(__RUNTIME_LIBS_10)$(__DEBUGRUNTIME) /DWIN32 $(__DEBUGINFO) \\r
@@ -187,6 +187,7 @@ TEST_GUI_OBJECTS =  \
        $(OBJS)\test_gui_virtlistctrltest.obj \\r
        $(OBJS)\test_gui_webtest.obj \\r
        $(OBJS)\test_gui_windowtest.obj \\r
+       $(OBJS)\test_gui_dialogtest.obj \\r
        $(OBJS)\test_gui_clone.obj \\r
        $(OBJS)\test_gui_propagation.obj \\r
        $(OBJS)\test_gui_keyboard.obj \\r
@@ -214,33 +215,33 @@ TEST_GUI_RESOURCES =  \
 \r
 ### Conditionally set variables: ###\r
 \r
-!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"\r
+ARCH_SUFFIX = _x64\r
+!endif\r
+!if "$(TARGET_CPU)" == "IA64"\r
+ARCH_SUFFIX = _ia64\r
+!endif\r
+!if "$(TARGET_CPU)" == "X64"\r
+ARCH_SUFFIX = _x64\r
+!endif\r
+!if "$(TARGET_CPU)" == "amd64"\r
+ARCH_SUFFIX = _x64\r
+!endif\r
+!if "$(TARGET_CPU)" == "ia64"\r
+ARCH_SUFFIX = _ia64\r
+!endif\r
+!if "$(TARGET_CPU)" == "x64"\r
+ARCH_SUFFIX = _x64\r
+!endif\r
 !if "$(USE_GUI)" == "0"\r
 PORTNAME = base\r
 !endif\r
 !if "$(USE_GUI)" == "1"\r
 PORTNAME = msw\r
 !endif\r
-!if "$(OFFICIAL_BUILD)" == "1"
-COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD
-!endif
+!if "$(OFFICIAL_BUILD)" == "1"\r
+COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD\r
+!endif\r
 !if "$(BUILD)" == "debug" && "$(DEBUG_RUNTIME_LIBS)" == "default"\r
 WXDEBUGFLAG = d\r
 !endif\r
@@ -268,18 +269,18 @@ LINK_TARGET_CPU = /MACHINE:X64
 !if "$(TARGET_CPU)" == "IA64"\r
 LINK_TARGET_CPU = /MACHINE:IA64\r
 !endif\r
-!if "$(TARGET_CPU)" == "X64"
-LINK_TARGET_CPU = /MACHINE:X64
-!endif
+!if "$(TARGET_CPU)" == "X64"\r
+LINK_TARGET_CPU = /MACHINE:X64\r
+!endif\r
 !if "$(TARGET_CPU)" == "amd64"\r
 LINK_TARGET_CPU = /MACHINE:X64\r
 !endif\r
 !if "$(TARGET_CPU)" == "ia64"\r
 LINK_TARGET_CPU = /MACHINE:IA64\r
 !endif\r
-!if "$(TARGET_CPU)" == "x64"
-LINK_TARGET_CPU = /MACHINE:X64
-!endif
+!if "$(TARGET_CPU)" == "x64"\r
+LINK_TARGET_CPU = /MACHINE:X64\r
+!endif\r
 !if "$(MONOLITHIC)" == "0"\r
 EXTRALIBS_FOR_BASE = \r
 !endif\r
@@ -1050,6 +1051,9 @@ $(OBJS)\test_gui_webtest.obj: .\controls\webtest.cpp
 $(OBJS)\test_gui_windowtest.obj: .\controls\windowtest.cpp\r
        $(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\controls\windowtest.cpp\r
 \r
+$(OBJS)\test_gui_dialogtest.obj: .\controls\dialogtest.cpp\r
+       $(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\controls\dialogtest.cpp\r
+\r
 $(OBJS)\test_gui_clone.obj: .\events\clone.cpp\r
        $(CXX) /c /nologo /TP /Fo$@ $(TEST_GUI_CXXFLAGS) .\events\clone.cpp\r
 \r
index 7eaa190e0552a936ce0f664e7a4396ee0631626c..6cd16d2fcb727777e50624e0976ef8665e1d2267 100644 (file)
@@ -38,10 +38,10 @@ PORTNAME = base
 !ifeq USE_GUI 1\r
 PORTNAME = msw\r
 !endif\r
-COMPILER_VERSION =
-!ifeq OFFICIAL_BUILD 1
-COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD
-!endif
+COMPILER_VERSION =\r
+!ifeq OFFICIAL_BUILD 1\r
+COMPILER_VERSION = ERROR-COMPILER-VERSION-MUST-BE-SET-FOR-OFFICIAL-BUILD\r
+!endif\r
 WXDEBUGFLAG =\r
 !ifeq BUILD debug\r
 WXDEBUGFLAG = d\r
@@ -273,9 +273,9 @@ __DLLFLAG_p = -dWXUSINGDLL
 WX_RELEASE_NODOT = 29\r
 COMPILER_PREFIX = wat\r
 OBJS = &\r
-       $(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)\r
+LIBDIRNAME = &\r
+       .\..\lib\$(COMPILER_PREFIX)$(COMPILER_VERSION)_$(LIBTYPE_SUFFIX)$(CFG)\r
 SETUPHDIR = &\r
        $(LIBDIRNAME)\$(PORTNAME)$(WXUNIVNAME)$(WXUNICODEFLAG)$(WXDEBUGFLAG)\r
 TEST_CXXFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) &\r
@@ -440,6 +440,7 @@ TEST_GUI_OBJECTS =  &
        $(OBJS)\test_gui_virtlistctrltest.obj &\r
        $(OBJS)\test_gui_webtest.obj &\r
        $(OBJS)\test_gui_windowtest.obj &\r
+       $(OBJS)\test_gui_dialogtest.obj &\r
        $(OBJS)\test_gui_clone.obj &\r
        $(OBJS)\test_gui_propagation.obj &\r
        $(OBJS)\test_gui_keyboard.obj &\r
@@ -954,6 +955,9 @@ $(OBJS)\test_gui_webtest.obj :  .AUTODEPEND .\controls\webtest.cpp
 $(OBJS)\test_gui_windowtest.obj :  .AUTODEPEND .\controls\windowtest.cpp\r
        $(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $<\r
 \r
+$(OBJS)\test_gui_dialogtest.obj :  .AUTODEPEND .\controls\dialogtest.cpp\r
+       $(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $<\r
+\r
 $(OBJS)\test_gui_clone.obj :  .AUTODEPEND .\events\clone.cpp\r
        $(CXX) -bt=nt -zq -fo=$^@ $(TEST_GUI_CXXFLAGS) $<\r
 \r
index cc6d1dec194d4b8053053e7be8a53cd808035ff4..1cb5ca570737b2cf650ba8e2caef256ae88e4eb1 100644 (file)
             controls/virtlistctrltest.cpp
             controls/webtest.cpp
             controls/windowtest.cpp
+            controls/dialogtest.cpp
             events/clone.cpp
             events/propagation.cpp
             events/keyboard.cpp
index 67c3188f7641b8e78fb1b86207317a843cc6ce9f..ffc119238897b0eceb15a5252e42ab2e141f686e 100644 (file)
@@ -315,6 +315,10 @@ SOURCE=.\controls\datepickerctrltest.cpp
 # End Source File\r
 # Begin Source File\r
 \r
+SOURCE=.\controls\dialogtest.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
 SOURCE=.\dummy.cpp\r
 # ADD BASE CPP /Yc"testprec.h"\r
 # ADD CPP /Yc"testprec.h"\r
index 1a5249e3775aa2d8ff5f45ed3c997ff13d00ac68..4342115560ef82dbc87e50fe425d473e9e58ff24 100644 (file)
                        <File\r
                                RelativePath=".\controls\datepickerctrltest.cpp">\r
                        </File>\r
+                       <File\r
+                               RelativePath=".\controls\dialogtest.cpp">\r
+                       </File>\r
                        <File\r
                                RelativePath=".\dummy.cpp">\r
                                <FileConfiguration\r
index 771a1d2e3393c1c713776eaa668722647a415760..f4d5618fd76f744ba4bbbd3fe24a7cf8f48cdc57 100644 (file)
                                RelativePath=".\controls\datepickerctrltest.cpp"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath=".\controls\dialogtest.cpp"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath=".\dummy.cpp"\r
                                >\r
index bd65e26ccf7f2f4ade85e58fc9cffe976920e1a4..df66968922b565f5b9a500c159833add2cf7e63e 100644 (file)
                                RelativePath=".\controls\datepickerctrltest.cpp"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath=".\controls\dialogtest.cpp"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath=".\dummy.cpp"\r
                                >\r