Add a generic wxExpectAny helper class for GUI testing.
This is similar to the existing wxExpectModal<wxMessageDialog>, but can be used to dismiss any dialog for which it's just enough to press some button, not just wxMessageDialog. It's convenient to use it as wxTEST_DIALOG(wxYield(), wxExpectAny(wxID_OK)); if some custom dialog which can be safely dismissed is expected. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77656 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -117,11 +117,11 @@ protected:
|
||||
|
||||
// wxExpectModal<T> specializations for common dialogs:
|
||||
|
||||
template<>
|
||||
class wxExpectModal<wxMessageDialog> : public wxExpectModalBase<wxMessageDialog>
|
||||
template<class T>
|
||||
class wxExpectDismissableModal : public wxExpectModalBase<T>
|
||||
{
|
||||
public:
|
||||
wxExpectModal(int id)
|
||||
explicit wxExpectDismissableModal(int id)
|
||||
{
|
||||
switch ( id )
|
||||
{
|
||||
@@ -147,7 +147,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual int OnInvoked(wxMessageDialog *WXUNUSED(dlg)) const
|
||||
virtual int OnInvoked(T *WXUNUSED(dlg)) const
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
@@ -155,6 +155,26 @@ protected:
|
||||
int m_id;
|
||||
};
|
||||
|
||||
template<>
|
||||
class wxExpectModal<wxMessageDialog>
|
||||
: public wxExpectDismissableModal<wxMessageDialog>
|
||||
{
|
||||
public:
|
||||
explicit wxExpectModal(int id)
|
||||
: wxExpectDismissableModal<wxMessageDialog>(id)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class wxExpectAny : public wxExpectDismissableModal<wxDialog>
|
||||
{
|
||||
public:
|
||||
explicit wxExpectAny(int id)
|
||||
: wxExpectDismissableModal<wxDialog>(id)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
#if wxUSE_FILEDLG
|
||||
|
||||
template<>
|
||||
|
Reference in New Issue
Block a user