232fdc630c
Add a lot of tests for many wx GUI classes. Add tests using the new wxUIActionSimulator class but disable them under OS X as too many of them currently fail there. Refactor the test suite to make organizing the existing tests and adding the new ones easier. Improve documentation using the information gathered while testing the classes. Also update the documentation of the testing system itself. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65386 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
88 lines
2.0 KiB
C++
88 lines
2.0 KiB
C++
///////////////////////////////////////////////////////////////////////////////
|
|
// Name: tests/controls/frametest.cpp
|
|
// Purpose: wxFrame unit test
|
|
// Author: Steven Lamerton
|
|
// Created: 2010-07-10
|
|
// RCS-ID: $Id$
|
|
// Copyright: (c) 2010 Steven Lamerton
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
#include "testprec.h"
|
|
|
|
#ifdef __BORLANDC__
|
|
#pragma hdrstop
|
|
#endif
|
|
|
|
#ifndef WX_PRECOMP
|
|
#include "wx/app.h"
|
|
#include "wx/frame.h"
|
|
#endif // WX_PRECOMP
|
|
|
|
#include "testableframe.h"
|
|
|
|
class FrameTestCase : public CppUnit::TestCase
|
|
{
|
|
public:
|
|
FrameTestCase() { }
|
|
|
|
void setUp();
|
|
void tearDown();
|
|
|
|
private:
|
|
CPPUNIT_TEST_SUITE( FrameTestCase );
|
|
CPPUNIT_TEST( Iconize );
|
|
CPPUNIT_TEST( Close );
|
|
CPPUNIT_TEST_SUITE_END();
|
|
|
|
void Iconize();
|
|
void Close();
|
|
|
|
wxFrame *m_frame;
|
|
|
|
DECLARE_NO_COPY_CLASS(FrameTestCase)
|
|
};
|
|
|
|
// register in the unnamed registry so that these tests are run by default
|
|
CPPUNIT_TEST_SUITE_REGISTRATION( FrameTestCase );
|
|
|
|
// also include in it's own registry so that these tests can be run alone
|
|
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()
|
|
{
|
|
wxDELETE(m_frame);
|
|
}
|
|
|
|
void FrameTestCase::Iconize()
|
|
{
|
|
#ifdef __WXMSW__
|
|
wxTestableFrame* testframe = wxStaticCast(wxTheApp->GetTopWindow(),
|
|
wxTestableFrame);
|
|
|
|
EventCounter count(m_frame, wxEVT_ICONIZE);
|
|
|
|
m_frame->Iconize();
|
|
m_frame->Iconize(false);
|
|
|
|
CPPUNIT_ASSERT_EQUAL(2, testframe->GetEventCount());
|
|
#endif
|
|
}
|
|
|
|
void FrameTestCase::Close()
|
|
{
|
|
wxTestableFrame* testframe = wxStaticCast(wxTheApp->GetTopWindow(),
|
|
wxTestableFrame);
|
|
|
|
EventCounter count(m_frame, wxEVT_CLOSE_WINDOW);
|
|
|
|
m_frame->Close();
|
|
|
|
CPPUNIT_ASSERT_EQUAL(1, testframe->GetEventCount());
|
|
}
|