]>
git.saurik.com Git - wxWidgets.git/blob - tests/controls/frametest.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/controls/frametest.cpp
3 // Purpose: wxFrame unit test
4 // Author: Steven Lamerton
7 // Copyright: (c) 2010 Steven Lamerton
8 ///////////////////////////////////////////////////////////////////////////////
21 #include "testableframe.h"
23 class FrameTestCase
: public CppUnit::TestCase
32 CPPUNIT_TEST_SUITE( FrameTestCase
);
33 CPPUNIT_TEST( Iconize
);
34 CPPUNIT_TEST( Close
);
35 CPPUNIT_TEST_SUITE_END();
42 DECLARE_NO_COPY_CLASS(FrameTestCase
)
45 // register in the unnamed registry so that these tests are run by default
46 CPPUNIT_TEST_SUITE_REGISTRATION( FrameTestCase
);
48 // also include in it's own registry so that these tests can be run alone
49 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( FrameTestCase
, "FrameTestCase" );
51 void FrameTestCase::setUp()
53 m_frame
= new wxFrame(NULL
, wxID_ANY
, "test frame");
57 void FrameTestCase::tearDown()
62 void FrameTestCase::Iconize()
65 wxTestableFrame
* testframe
= wxStaticCast(wxTheApp
->GetTopWindow(),
68 EventCounter
count(m_frame
, wxEVT_ICONIZE
);
71 m_frame
->Iconize(false);
73 CPPUNIT_ASSERT_EQUAL(2, testframe
->GetEventCount());
77 void FrameTestCase::Close()
79 wxTestableFrame
* testframe
= wxStaticCast(wxTheApp
->GetTopWindow(),
82 EventCounter
count(m_frame
, wxEVT_CLOSE_WINDOW
);
86 CPPUNIT_ASSERT_EQUAL(1, testframe
->GetEventCount());