Merge branch 'aui-notebook-rtti'
Fix down-casting from wxAuiNotebook to wxBookCtrlBase. See https://github.com/wxWidgets/wxWidgets/pull/2388
This commit is contained in:
@@ -53,7 +53,7 @@ wxDEFINE_EVENT(wxEVT_AUINOTEBOOK_TAB_MIDDLE_DOWN, wxAuiNotebookEvent);
|
|||||||
wxDEFINE_EVENT(wxEVT_AUINOTEBOOK_TAB_RIGHT_UP, wxAuiNotebookEvent);
|
wxDEFINE_EVENT(wxEVT_AUINOTEBOOK_TAB_RIGHT_UP, wxAuiNotebookEvent);
|
||||||
wxDEFINE_EVENT(wxEVT_AUINOTEBOOK_TAB_RIGHT_DOWN, wxAuiNotebookEvent);
|
wxDEFINE_EVENT(wxEVT_AUINOTEBOOK_TAB_RIGHT_DOWN, wxAuiNotebookEvent);
|
||||||
|
|
||||||
wxIMPLEMENT_CLASS(wxAuiNotebook, wxControl);
|
wxIMPLEMENT_CLASS(wxAuiNotebook, wxBookCtrlBase);
|
||||||
wxIMPLEMENT_CLASS(wxAuiTabCtrl, wxControl);
|
wxIMPLEMENT_CLASS(wxAuiTabCtrl, wxControl);
|
||||||
wxIMPLEMENT_DYNAMIC_CLASS(wxAuiNotebookEvent, wxBookCtrlEvent);
|
wxIMPLEMENT_DYNAMIC_CLASS(wxAuiNotebookEvent, wxBookCtrlEvent);
|
||||||
|
|
||||||
|
@@ -20,23 +20,38 @@
|
|||||||
#endif // WX_PRECOMP
|
#endif // WX_PRECOMP
|
||||||
|
|
||||||
#include "wx/panel.h"
|
#include "wx/panel.h"
|
||||||
#include "wx/scopedptr.h"
|
|
||||||
|
|
||||||
#include "wx/aui/auibook.h"
|
#include "wx/aui/auibook.h"
|
||||||
|
|
||||||
#include "asserthelper.h"
|
#include "asserthelper.h"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// test class
|
// test fixtures
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
TEST_CASE( "wxAuiNotebook::DoGetBestSize", "[aui]" )
|
class AuiNotebookTestCase
|
||||||
{
|
{
|
||||||
wxWindow *frame = wxTheApp->GetTopWindow();
|
public:
|
||||||
REQUIRE( frame );
|
AuiNotebookTestCase()
|
||||||
wxAuiNotebook *nb = new wxAuiNotebook(frame);
|
: nb(new wxAuiNotebook(wxTheApp->GetTopWindow()))
|
||||||
wxScopedPtr<wxAuiNotebook> cleanUp(nb);
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
~AuiNotebookTestCase()
|
||||||
|
{
|
||||||
|
delete nb;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
wxAuiNotebook* const nb;
|
||||||
|
};
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// the tests themselves
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
TEST_CASE_METHOD(AuiNotebookTestCase, "wxAuiNotebook::DoGetBestSize", "[aui]")
|
||||||
|
{
|
||||||
wxPanel *p = new wxPanel(nb);
|
wxPanel *p = new wxPanel(nb);
|
||||||
p->SetMinSize(wxSize(100, 100));
|
p->SetMinSize(wxSize(100, 100));
|
||||||
REQUIRE( nb->AddPage(p, "Center Pane") );
|
REQUIRE( nb->AddPage(p, "Center Pane") );
|
||||||
@@ -128,4 +143,12 @@ TEST_CASE( "wxAuiNotebook::DoGetBestSize", "[aui]" )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE_METHOD(AuiNotebookTestCase, "wxAuiNotebook::RTTI", "[aui][rtti]")
|
||||||
|
{
|
||||||
|
wxBookCtrlBase* const book = nb;
|
||||||
|
CHECK( wxDynamicCast(book, wxAuiNotebook) == nb );
|
||||||
|
|
||||||
|
CHECK( wxDynamicCast(nb, wxBookCtrlBase) == book );
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user