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