]> git.saurik.com Git - wxWidgets.git/blame - tests/controls/frametest.cpp
Convert wxFSW_EVENT_{WARNING,ERROR} to string correctly.
[wxWidgets.git] / tests / controls / frametest.cpp
CommitLineData
232fdc63
VZ
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
23class FrameTestCase : public CppUnit::TestCase
24{
25public:
26 FrameTestCase() { }
27
28 void setUp();
29 void tearDown();
30
31private:
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
46CPPUNIT_TEST_SUITE_REGISTRATION( FrameTestCase );
47
e3778b4d 48// also include in its own registry so that these tests can be run alone
232fdc63
VZ
49CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( FrameTestCase, "FrameTestCase" );
50
51void FrameTestCase::setUp()
52{
53 m_frame = new wxFrame(NULL, wxID_ANY, "test frame");
54 m_frame->Show();
55}
56
57void FrameTestCase::tearDown()
58{
59 wxDELETE(m_frame);
60}
61
62void FrameTestCase::Iconize()
63{
64#ifdef __WXMSW__
744d91d4 65 EventCounter iconize(m_frame, wxEVT_ICONIZE);
232fdc63
VZ
66
67 m_frame->Iconize();
68 m_frame->Iconize(false);
69
744d91d4 70 CPPUNIT_ASSERT_EQUAL(2, iconize.GetCount());
232fdc63
VZ
71#endif
72}
73
74void FrameTestCase::Close()
75{
744d91d4 76 EventCounter close(m_frame, wxEVT_CLOSE_WINDOW);
232fdc63
VZ
77
78 m_frame->Close();
79
744d91d4 80 CPPUNIT_ASSERT_EQUAL(1, close.GetCount());
232fdc63 81}