2010-08-22 18:16:05 -04:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: tests/controls/frametest.cpp
|
|
|
|
// Purpose: wxFrame unit test
|
|
|
|
// Author: Steven Lamerton
|
|
|
|
// Created: 2010-07-10
|
|
|
|
// Copyright: (c) 2010 Steven Lamerton
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include "testprec.h"
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef WX_PRECOMP
|
|
|
|
#include "wx/app.h"
|
|
|
|
#include "wx/frame.h"
|
|
|
|
#endif // WX_PRECOMP
|
|
|
|
|
|
|
|
#include "testableframe.h"
|
|
|
|
|
|
|
|
class FrameTestCase : public CppUnit::TestCase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
FrameTestCase() { }
|
|
|
|
|
2018-07-29 05:09:17 -04:00
|
|
|
void setUp() wxOVERRIDE;
|
|
|
|
void tearDown() wxOVERRIDE;
|
2010-08-22 18:16:05 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
CPPUNIT_TEST_SUITE( FrameTestCase );
|
|
|
|
CPPUNIT_TEST( Iconize );
|
|
|
|
CPPUNIT_TEST( Close );
|
|
|
|
CPPUNIT_TEST_SUITE_END();
|
|
|
|
|
|
|
|
void Iconize();
|
|
|
|
void Close();
|
|
|
|
|
|
|
|
wxFrame *m_frame;
|
|
|
|
|
2015-04-23 07:49:01 -04:00
|
|
|
wxDECLARE_NO_COPY_CLASS(FrameTestCase);
|
2010-08-22 18:16:05 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
// register in the unnamed registry so that these tests are run by default
|
|
|
|
CPPUNIT_TEST_SUITE_REGISTRATION( FrameTestCase );
|
|
|
|
|
2011-04-30 06:57:04 -04:00
|
|
|
// also include in its own registry so that these tests can be run alone
|
2010-08-22 18:16:05 -04:00
|
|
|
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( FrameTestCase, "FrameTestCase" );
|
|
|
|
|
|
|
|
void FrameTestCase::setUp()
|
|
|
|
{
|
|
|
|
m_frame = new wxFrame(NULL, wxID_ANY, "test frame");
|
|
|
|
m_frame->Show();
|
|
|
|
}
|
|
|
|
|
|
|
|
void FrameTestCase::tearDown()
|
|
|
|
{
|
2013-06-12 20:11:18 -04:00
|
|
|
m_frame->Destroy();
|
2010-08-22 18:16:05 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void FrameTestCase::Iconize()
|
|
|
|
{
|
|
|
|
#ifdef __WXMSW__
|
2012-03-11 10:32:24 -04:00
|
|
|
EventCounter iconize(m_frame, wxEVT_ICONIZE);
|
2010-08-22 18:16:05 -04:00
|
|
|
|
|
|
|
m_frame->Iconize();
|
|
|
|
m_frame->Iconize(false);
|
|
|
|
|
2012-03-11 10:32:24 -04:00
|
|
|
CPPUNIT_ASSERT_EQUAL(2, iconize.GetCount());
|
2010-08-22 18:16:05 -04:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void FrameTestCase::Close()
|
|
|
|
{
|
2012-03-11 10:32:24 -04:00
|
|
|
EventCounter close(m_frame, wxEVT_CLOSE_WINDOW);
|
2010-08-22 18:16:05 -04:00
|
|
|
|
|
|
|
m_frame->Close();
|
|
|
|
|
2012-03-11 10:32:24 -04:00
|
|
|
CPPUNIT_ASSERT_EQUAL(1, close.GetCount());
|
2010-08-22 18:16:05 -04:00
|
|
|
}
|