--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// 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_
 
     #include "wx/settings.h"
 #endif //WX_PRECOMP
 
+#include "wx/testing.h"
 #include "wx/cocoa/autorelease.h"
 #include "wx/cocoa/string.h"
 
 // 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
 
 #endif
 
 #include "wx/filename.h"
+#include "wx/testing.h"
 
 #include "wx/cocoa/autorelease.h"
 #include "wx/cocoa/string.h"
 
 int wxDirDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     wxAutoNSAutoreleasePool thePool;
 
     m_fileNames.Empty();
 
 
 #include "wx/cocoa/autorelease.h"
 #include "wx/cocoa/string.h"
+#include "wx/testing.h"
 
 #import <AppKit/NSOpenPanel.h>
 #import <AppKit/NSSavePanel.h>
 
 int wxFileDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     wxAutoNSAutoreleasePool thePool;
 
     m_fileNames.Empty();
 
 
 #include "wx/cocoa/autorelease.h"
 #include "wx/cocoa/string.h"
+#include "wx/testing.h"
 
 #import <AppKit/NSAlert.h>
 // ============================================================================
 
 int wxCocoaMessageDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     wxAutoNSAutoreleasePool thePool;
 
     NSAlert *alert = [[[NSAlert alloc] init] autorelease];
 
 #include "wx/bookctrl.h"
 #include "wx/scrolwin.h"
 #include "wx/textwrapper.h"
+#include "wx/testing.h"
 
 #if wxUSE_DISPLAY
 #include "wx/display.h"
 
 extern WXDLLEXPORT_DATA(const char) wxDialogNameStr[] = "dialog";
 
+wxModalDialogHook *wxModalDialogHook::ms_instance = NULL;
+
 // ----------------------------------------------------------------------------
 // XTI
 // ----------------------------------------------------------------------------
 
 #include "wx/filectrl.h"
 #include "wx/generic/filedlgg.h"
 #include "wx/debug.h"
+#include "wx/testing.h"
 
 #if wxUSE_TOOLTIPS
     #include "wx/tooltip.h"
 
 int wxGenericFileDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     if (CreateExtraControl())
     {
         wxSizer *sizer = GetSizer();
 
 #include "wx/msgdlg.h"
 #include "wx/artprov.h"
 #include "wx/textwrapper.h"
+#include "wx/testing.h"
 
 #if wxUSE_STATLINE
     #include "wx/statline.h"
 
 int wxGenericMessageDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     if ( !m_created )
     {
         m_created = true;
 
 #if wxUSE_COLOURDLG
 
 #include "wx/colordlg.h"
+#include "wx/testing.h"
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
 
 int wxColourDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     ColourDataToDialog();
 
     gint result = gtk_dialog_run(GTK_DIALOG(m_widget));
 
 #include "wx/evtloop.h"
 
 #include "wx/scopedptr.h"
+#include "wx/testing.h"
 
 #include <gtk/gtk.h>
 
 
 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
 
 #include "wx/filename.h" // wxFilename
 #include "wx/tokenzr.h" // wxStringTokenizer
 #include "wx/filefn.h" // ::wxGetCwd
+#include "wx/testing.h"
 
 //-----------------------------------------------------------------------------
 // "clicked" for OK-button
 
 int wxFileDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     CreateExtraControl();
 
     return wxDialog::ShowModal();
 
 #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>
 
 int wxGnomePrintDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     int response = gtk_dialog_run (GTK_DIALOG (m_widget));
 
     if (response == GNOME_PRINT_DIALOG_RESPONSE_CANCEL)
 
 int wxGnomePageSetupDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     wxGnomePrintNativeData *native =
       (wxGnomePrintNativeData*) m_pageDialogData.GetPrintData().GetNativeData();
 
 
     #include "wx/intl.h"
 #endif
 
+#include "wx/testing.h"
+
 #include <gtk/gtk.h>
 #include "wx/gtk/private.h"
 #include "wx/gtk/private/messagetype.h"
 
 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();
 
 #include "wx/dynlib.h"
 #include "wx/paper.h"
 #include "wx/scopeguard.h"
+#include "wx/testing.h"
 
 #include <gtk/gtk.h>
 
 // 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 =
 
 int wxGtkPageSetupDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     // Get the config.
     m_pageDialogData.GetPrintData().ConvertToNative();
     wxGtkPrintNativeData *native = (wxGtkPrintNativeData*) m_pageDialogData.GetPrintData().GetNativeData();
 
 #endif // WX_PRECOMP
 
 #include "wx/evtloop.h"
+#include "wx/testing.h"
 
 #include <gdk/gdk.h>
 #include <gtk/gtk.h>
 
 int wxDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     if (IsModal())
     {
        wxFAIL_MSG( wxT("wxDialog:ShowModal called twice") );
 
 #if wxUSE_FILEDLG
 
 #include "wx/filedlg.h"
+#include "wx/testing.h"
 
 
 //-----------------------------------------------------------------------------
 
 int wxFileDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     return wxGenericFileDialog::ShowModal();
 }
 
 
 #endif
 
 #include "wx/evtloop.h"
+#include "wx/testing.h"
 
 #ifdef __VMS__
 #pragma message disable nosimpint
 // 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
 
 
 #include "wx/tokenzr.h"
 #include "wx/stockitem.h"
+#include "wx/testing.h"
 
 #ifdef __VMS__
 #pragma message disable nosimpint
 
 int wxFileDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     wxBeginBusyCursor();
 
     //  static char fileBuf[512];
 
     #include "wx/settings.h"
 #endif
 
+#include "wx/testing.h"
 #include "wx/motif/private.h"
 
 // ----------------------------------------------------------------------------
 
 int wxMessageDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     const long style = GetMessageDialogStyle();
 
     DialogCreateFunction dialogCreateFunction;
 
 #if wxUSE_COLOURDLG && !(defined(__SMARTPHONE__) && defined(__WXWINCE__))
 
 #include "wx/colordlg.h"
+#include "wx/testing.h"
 
 #ifndef WX_PRECOMP
     #include "wx/msw/wrapcdlg.h"
 
 int wxColourDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     // initialize the struct used by Windows
     CHOOSECOLOR chooseColorStruct;
     memset(&chooseColorStruct, 0, sizeof(CHOOSECOLOR));
 
 #endif
 
 #include "wx/dialog.h"
+#include "wx/testing.h"
 
 #ifndef WX_PRECOMP
     #include "wx/msw/wrapcdlg.h"
 // show dialog modally
 int wxDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     wxASSERT_MSG( !IsModal(), wxT("ShowModal() can't be called twice") );
 
     Show();
 
     (defined(__HANDHELDPC__) && (_WIN32_WCE >= 500)))
 
 #include "wx/dirdlg.h"
+#include "wx/testing.h"
 
 #ifndef WX_PRECOMP
     #include "wx/utils.h"
 
 int wxDirDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     wxWindow* const parent = GetParent();
     WXHWND hWndParent = parent ? GetHwndOf(parent) : NULL;
 
 
 #include "wx/filename.h"
 #include "wx/scopeguard.h"
 #include "wx/tokenzr.h"
+#include "wx/testing.h"
 
 // ----------------------------------------------------------------------------
 // constants
 
 int wxFileDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     HWND hWnd = 0;
     if (m_parent) hWnd = (HWND) m_parent->GetHWND();
     if (!hWnd && wxTheApp->GetTopWindow())
 
 #if wxUSE_FONTDLG
 
 #include "wx/fontdlg.h"
+#include "wx/testing.h"
 
 #ifndef WX_PRECOMP
     #include "wx/msw/wrapcdlg.h"
 
 int wxFontDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     // It should be OK to always use GDI simulations
     DWORD flags = CF_SCREENFONTS /* | CF_NOSIMULATIONS */ ;
 
 
 #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"
 
 int wxMessageDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
 #ifdef wxHAS_MSW_TASKDIALOG
     if ( HasNativeTaskDialog() )
     {
 
 #include "wx/msw/printdlg.h"
 #include "wx/msw/dcprint.h"
 #include "wx/paper.h"
+#include "wx/testing.h"
 
 #include <stdlib.h>
 
 
 int wxWindowsPrintDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     ConvertToNative( m_printDialogData );
 
     PRINTDLG *pd = (PRINTDLG*) m_printDlg;
 
 int wxWindowsPageSetupDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     ConvertToNative( m_pageSetupData );
 
     PAGESETUPDLG *pd = (PAGESETUPDLG *) m_pageDlg;
 
 #if wxUSE_RICHMSGDLG
 
 #include "wx/richmsgdlg.h"
+#include "wx/testing.h"
 
 #ifndef WX_PRECOMP
     #include "wx/msw/private.h"
 
 int wxRichMessageDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
 #ifdef wxHAS_MSW_TASKDIALOG
     using namespace wxMSWMessageDialog;
 
 
 #include <string.h>
 
 #include "wx/filename.h"
+#include "wx/testing.h"
 
 // ============================================================================
 // implementation
 
 int wxFileDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     wxWindow* parentWindow = GetParent();
     if (!parentWindow)
         parentWindow = wxTheApp->GetTopWindow();
 
 #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
 //
 int wxDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     wxASSERT_MSG( !IsModal(), wxT("wxDialog::ShowModal() reentered?") );
 
     m_endModalCalled = false;
 
 #include "wx/wxprec.h"
 
 #include "wx/dirdlg.h"
+#include "wx/testing.h"
 
 #ifndef WX_PRECOMP
     #include <stdio.h>
 
 int wxDirDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     // TODO
     return wxID_CANCEL;
 }
 
 #include <string.h>
 
 #include "wx/tokenzr.h"
+#include "wx/testing.h"
 
 #define wxMAXPATH                    1024
 #define wxMAXFILE                    1024
 
 int wxFileDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     wxString                        sTheFilter;
     wxString                        sFilterBuffer;
     wxChar*                         pzFilterBuffer;
 
 #endif
 
 #include "wx/fontutil.h"
+#include "wx/testing.h"
 
 #define INCL_PM
 #include <os2.h>
 
 int wxFontDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     FONTDLG      vFontDlg;
     char         zCurrentFont[FACESIZE];
     HWND         hWndFontDlg;
 
     #include "wx/math.h"
 #endif
 
+#include "wx/testing.h"
 #include "wx/os2/private.h"
 
 #include <stdlib.h>
 
 int wxMessageDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     HWND                            hWnd = 0;
     ULONG                           ulStyle = MB_OK;
     int                             nAns = wxOK;
 
 
 #include "wx/colordlg.h"
 #include "wx/fontdlg.h"
+#include "wx/testing.h"
 
 
 #if !USE_NATIVE_FONT_DIALOG_FOR_MACOSX
 
 int wxColourDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     RGBColor currentColor ;
 
     m_colourData.m_dataColour.GetRGBColor( ¤tColor );
 
 
 #include "wx/colordlg.h"
 #include "wx/fontdlg.h"
+#include "wx/testing.h"
 
 // ============================================================================
 // implementation
 }
 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
 
 #endif // WX_PRECOMP
 
 #include "wx/filename.h"
+#include "wx/testing.h"
 
 #include "wx/osx/private.h"
 
 
 int wxDirDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     NavDialogRef dialog = NULL;
     NavDialogCreationOptions options;
     NavReplyRecord reply ;
 
 #include "wx/filename.h"
 
 #include "wx/osx/private.h"
+#include "wx/testing.h"
 
 #ifndef __DARWIN__
     #include <Navigation.h>
 
 int wxFileDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     m_paths.Empty();
     m_fileNames.Empty();
 
 
 
 #include "wx/fontdlg.h"
 #include "wx/fontutil.h"
+#include "wx/testing.h"
 
 #if wxOSX_USE_EXPERIMENTAL_FONTDIALOG
 
 
 int wxFontDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
 #if wxOSX_USE_CARBON
 
     OSStatus err ;
 
 #endif
 
 #include "wx/fontutil.h"
+#include "wx/testing.h"
 
 // ============================================================================
 // implementation
 
 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
 
 #endif
 
 #include "wx/thread.h"
+#include "wx/testing.h"
 #include "wx/osx/uma.h"
 
 
 
 int wxMessageDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     int resultbutton = wxID_CANCEL;
 
     const long style = GetMessageDialogStyle();
 
 #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 );
 
 
 int wxMacPageSetupDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     m_pageSetupData.GetPrintData().ConvertToNative();
     wxOSXPrintData* nativeData = (wxOSXPrintData*)m_pageSetupData.GetPrintData().GetNativeData();
     nativeData->TransferFrom( &m_pageSetupData );
 
 
 #include "wx/filename.h"
 #include "wx/evtloop.h"
+#include "wx/testing.h"
 
 #include "wx/osx/private.h"
 
 
 int wxDirDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     wxCFEventLoopPauseIdleEvents pause;
 
     NSOpenPanel *oPanel = OSXCreatePanel();
 
 
 #include "wx/osx/private.h"
 #include "wx/sysopt.h"
+#include "wx/testing.h"
 
 #include <mach-o/dyld.h>
 
 
 int wxFileDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     wxCFEventLoopPauseIdleEvents pause;
 
     wxMacAutoreleasePool autoreleasepool;
 
 #include "wx/control.h"
 #include "wx/thread.h"
 #include "wx/evtloop.h"
+#include "wx/testing.h"
 #include "wx/osx/private.h"
 
 
 
 int wxMessageDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     wxCFEventLoopPauseIdleEvents pause;
     
     int resultbutton = wxID_CANCEL;
 
 #if wxUSE_PRINTING_ARCHITECTURE
 
 #include "wx/printdlg.h"
+#include "wx/testing.h"
 
 #ifndef WX_PRECOMP
     #include "wx/object.h"
 
 int wxMacPrintDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     m_printDialogData.GetPrintData().ConvertToNative();
 
     int result = wxID_CANCEL;
 
 int wxMacPageSetupDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     m_pageSetupData.GetPrintData().ConvertToNative();
     ((wxOSXCocoaPrintData*)m_pageSetupData.GetPrintData().GetNativeData())->TransferFrom( &m_pageSetupData );
 
 
 
 #include "wx/dialog.h"
 #include "wx/evtloop.h"
+#include "wx/testing.h"
 
 #ifndef WX_PRECOMP
     #include "wx/app.h"
 // 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();
 
 
 #include "wx/thread.h"
 #include "wx/osx/private.h"
+#include "wx/testing.h"
 
 
 IMPLEMENT_CLASS(wxMessageDialog, wxDialog)
 
 int wxMessageDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     int resultbutton = wxID_CANCEL;
 
     const long style = GetMessageDialogStyle();
 
 #endif
 
 #include "wx/evtloop.h"
+#include "wx/testing.h"
 
 //-----------------------------------------------------------------------------
 // wxDialog
 
 int wxDialog::ShowModal()
 {
+    WX_TESTING_SHOW_MODAL_HOOK();
+
     if ( IsModal() )
     {
        wxFAIL_MSG( wxT("wxDialog:ShowModal called twice") );
 
        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 \
 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
 
 
 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
        $(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
 !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
 $(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
 
 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
        $(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
 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
 $(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
 
 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
        $(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
 \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
 !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
 $(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
 
 !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
 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
        $(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
 $(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
 
             controls/virtlistctrltest.cpp
             controls/webtest.cpp
             controls/windowtest.cpp
+            controls/dialogtest.cpp
             events/clone.cpp
             events/propagation.cpp
             events/keyboard.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
 
                        <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
 
                                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
 
                                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