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
#include "wx/panel.h"
#include "wx/scopedptr.h"
#include "wx/aui/auibook.h"
#include "asserthelper.h"
// ----------------------------------------------------------------------------
// test class
// test fixtures
// ----------------------------------------------------------------------------
TEST_CASE( "wxAuiNotebook::DoGetBestSize", "[aui]" )
class AuiNotebookTestCase
{
wxWindow *frame = wxTheApp->GetTopWindow();
REQUIRE( frame );
wxAuiNotebook *nb = new wxAuiNotebook(frame);
wxScopedPtr<wxAuiNotebook> cleanUp(nb);
public:
AuiNotebookTestCase()
: nb(new wxAuiNotebook(wxTheApp->GetTopWindow()))
{
}
~AuiNotebookTestCase()
{
delete nb;
}
protected:
wxAuiNotebook* const nb;
};
// ----------------------------------------------------------------------------
// the tests themselves
// ----------------------------------------------------------------------------
TEST_CASE_METHOD(AuiNotebookTestCase, "wxAuiNotebook::DoGetBestSize", "[aui]")
{
wxPanel *p = new wxPanel(nb);
p->SetMinSize(wxSize(100, 100));
REQUIRE( nb->AddPage(p, "Center Pane") );