Rewrite TLW unit test as a single function
Get rid of the unnecessary test case class. No real changes yet.
This commit is contained in:
@@ -23,55 +23,7 @@
|
||||
#include "wx/toplevel.h"
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
#include "wx/evtloop.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// test class
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class TopLevelWindowTestCase : public CppUnit::TestCase
|
||||
{
|
||||
public:
|
||||
TopLevelWindowTestCase() { }
|
||||
|
||||
private:
|
||||
CPPUNIT_TEST_SUITE( TopLevelWindowTestCase );
|
||||
CPPUNIT_TEST( DialogShowTest );
|
||||
CPPUNIT_TEST( FrameShowTest );
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
void DialogShowTest();
|
||||
void FrameShowTest();
|
||||
void TopLevelWindowShowTest(wxTopLevelWindow* tlw);
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(TopLevelWindowTestCase);
|
||||
};
|
||||
|
||||
// register in the unnamed registry so that these tests are run by default
|
||||
//CPPUNIT_TEST_SUITE_REGISTRATION( TopLevelWindowTestCase );
|
||||
|
||||
// also include in its own registry so that these tests can be run alone
|
||||
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( TopLevelWindowTestCase, "fixme" );
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// tests themselves
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void TopLevelWindowTestCase::DialogShowTest()
|
||||
{
|
||||
wxDialog* dialog = new wxDialog(NULL, -1, "Dialog Test");
|
||||
TopLevelWindowShowTest(dialog);
|
||||
dialog->Destroy();
|
||||
}
|
||||
|
||||
void TopLevelWindowTestCase::FrameShowTest()
|
||||
{
|
||||
wxFrame* frame = new wxFrame(NULL, -1, "Frame test");
|
||||
TopLevelWindowShowTest(frame);
|
||||
frame->Destroy();
|
||||
}
|
||||
|
||||
void TopLevelWindowTestCase::TopLevelWindowShowTest(wxTopLevelWindow* tlw)
|
||||
static void TopLevelWindowShowTest(wxTopLevelWindow* tlw)
|
||||
{
|
||||
CHECK(!tlw->IsShown());
|
||||
|
||||
@@ -104,3 +56,20 @@ void TopLevelWindowTestCase::TopLevelWindowShowTest(wxTopLevelWindow* tlw)
|
||||
CHECK(tlw->IsActive());
|
||||
#endif
|
||||
}
|
||||
|
||||
TEST_CASE("wxTopLevel::Show", "[tlw][show]")
|
||||
{
|
||||
SECTION("Dialog")
|
||||
{
|
||||
wxDialog* dialog = new wxDialog(NULL, -1, "Dialog Test");
|
||||
TopLevelWindowShowTest(dialog);
|
||||
dialog->Destroy();
|
||||
}
|
||||
|
||||
SECTION("Frame")
|
||||
{
|
||||
wxFrame* frame = new wxFrame(NULL, -1, "Frame test");
|
||||
TopLevelWindowShowTest(frame);
|
||||
frame->Destroy();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user