Remove all lines containing cvs/svn "$Id$" keyword.
[wxWidgets.git] / tests / controls / frametest.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: tests/controls/frametest.cpp
3 // Purpose: wxFrame unit test
4 // Author: Steven Lamerton
5 // Created: 2010-07-10
6 // Copyright: (c) 2010 Steven Lamerton
7 ///////////////////////////////////////////////////////////////////////////////
8
9 #include "testprec.h"
10
11 #ifdef __BORLANDC__
12 #pragma hdrstop
13 #endif
14
15 #ifndef WX_PRECOMP
16 #include "wx/app.h"
17 #include "wx/frame.h"
18 #endif // WX_PRECOMP
19
20 #include "testableframe.h"
21
22 class FrameTestCase : public CppUnit::TestCase
23 {
24 public:
25 FrameTestCase() { }
26
27 void setUp();
28 void tearDown();
29
30 private:
31 CPPUNIT_TEST_SUITE( FrameTestCase );
32 CPPUNIT_TEST( Iconize );
33 CPPUNIT_TEST( Close );
34 CPPUNIT_TEST_SUITE_END();
35
36 void Iconize();
37 void Close();
38
39 wxFrame *m_frame;
40
41 DECLARE_NO_COPY_CLASS(FrameTestCase)
42 };
43
44 // register in the unnamed registry so that these tests are run by default
45 CPPUNIT_TEST_SUITE_REGISTRATION( FrameTestCase );
46
47 // also include in its own registry so that these tests can be run alone
48 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( FrameTestCase, "FrameTestCase" );
49
50 void FrameTestCase::setUp()
51 {
52 m_frame = new wxFrame(NULL, wxID_ANY, "test frame");
53 m_frame->Show();
54 }
55
56 void FrameTestCase::tearDown()
57 {
58 m_frame->Destroy();
59 }
60
61 void FrameTestCase::Iconize()
62 {
63 #ifdef __WXMSW__
64 EventCounter iconize(m_frame, wxEVT_ICONIZE);
65
66 m_frame->Iconize();
67 m_frame->Iconize(false);
68
69 CPPUNIT_ASSERT_EQUAL(2, iconize.GetCount());
70 #endif
71 }
72
73 void FrameTestCase::Close()
74 {
75 EventCounter close(m_frame, wxEVT_CLOSE_WINDOW);
76
77 m_frame->Close();
78
79 CPPUNIT_ASSERT_EQUAL(1, close.GetCount());
80 }