Refactor wxAuiNotebook unit test to use a test fixture

No real changes, this will just make adding more tests using
wxAuiNotebook simpler.
This commit is contained in:
Vadim Zeitlin
2021-06-08 22:40:03 +02:00
parent c817a434d8
commit fbe12789f6

View File

@@ -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") );