wxwidgets/tests/controls/frametest.cpp
Vadim Zeitlin 4f4c5fcfdf Use nullptr instead of NULL in the code and documentation
This is a combination of running clang-tidy with modernize-use-nullptr
check for some ports (GTK, X11, OSX) and manual changes to the ports for
which it couldn't be used easily (MSW, DFB) and also manually updating
the docs.

Also replace NULL with null or nullptr in the comments as this is more
consistent with the use of nullptr in the code and makes it simpler to
grep for the remaining occurrences of NULL itself.

And also use null in the assert messages.

Only a few occurrences of "NULL" are still left in non-C files, mostly
corresponding to unclear comments or string output which it might not be
safe to change.
2022-10-18 01:25:25 +02:00

77 lines
1.7 KiB
C++

///////////////////////////////////////////////////////////////////////////////
// Name: tests/controls/frametest.cpp
// Purpose: wxFrame unit test
// Author: Steven Lamerton
// Created: 2010-07-10
// Copyright: (c) 2010 Steven Lamerton
///////////////////////////////////////////////////////////////////////////////
#include "testprec.h"
#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() override;
void tearDown() override;
private:
CPPUNIT_TEST_SUITE( FrameTestCase );
CPPUNIT_TEST( Iconize );
CPPUNIT_TEST( Close );
CPPUNIT_TEST_SUITE_END();
void Iconize();
void Close();
wxFrame *m_frame;
wxDECLARE_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 its own registry so that these tests can be run alone
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( FrameTestCase, "FrameTestCase" );
void FrameTestCase::setUp()
{
m_frame = new wxFrame(nullptr, wxID_ANY, "test frame");
m_frame->Show();
}
void FrameTestCase::tearDown()
{
m_frame->Destroy();
}
void FrameTestCase::Iconize()
{
#ifdef __WXMSW__
EventCounter iconize(m_frame, wxEVT_ICONIZE);
m_frame->Iconize();
m_frame->Iconize(false);
CPPUNIT_ASSERT_EQUAL(2, iconize.GetCount());
#endif
}
void FrameTestCase::Close()
{
EventCounter close(m_frame, wxEVT_CLOSE_WINDOW);
m_frame->Close();
CPPUNIT_ASSERT_EQUAL(1, close.GetCount());
}