Get rid of CppUnit compatibility macros in wxSearchCtrl unit test

No real changes, just remove all the CppUnit machinery not needed any
longer and replace it with a simple test function.
This commit is contained in:
Vadim Zeitlin
2018-01-29 19:04:47 +01:00
parent 99dea2e2e0
commit 05ebeb6bac

View File

@@ -20,50 +20,33 @@
#include "wx/srchctrl.h" #include "wx/srchctrl.h"
class SearchCtrlTestCase : public CppUnit::TestCase class SearchCtrlTestCase
{ {
public: public:
SearchCtrlTestCase() { } SearchCtrlTestCase()
: m_search(new wxSearchCtrl(wxTheApp->GetTopWindow(), wxID_ANY))
{
}
virtual void setUp(); ~SearchCtrlTestCase()
virtual void tearDown(); {
delete m_search;
}
private: protected:
CPPUNIT_TEST_SUITE( SearchCtrlTestCase ); wxSearchCtrl* const m_search;
CPPUNIT_TEST( Focus );
CPPUNIT_TEST_SUITE_END();
void Focus();
wxSearchCtrl* m_search;
wxDECLARE_NO_COPY_CLASS(SearchCtrlTestCase);
}; };
// register in the unnamed registry so that these tests are run by default #define SEARCH_CTRL_TEST_CASE(name, tags) \
CPPUNIT_TEST_SUITE_REGISTRATION( SearchCtrlTestCase ); TEST_CASE_METHOD(SearchCtrlTestCase, name, tags)
// also include in its own registry so that these tests can be run alone // TODO OS X test only passes when run solo ...
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( SearchCtrlTestCase, "SearchCtrlTestCase" );
void SearchCtrlTestCase::setUp()
{
m_search = new wxSearchCtrl(wxTheApp->GetTopWindow(), wxID_ANY);
}
void SearchCtrlTestCase::tearDown()
{
delete m_search;
m_search = NULL;
}
void SearchCtrlTestCase::Focus()
{
// TODO OS X test only passes when run solo ...
#ifndef __WXOSX__ #ifndef __WXOSX__
SEARCH_CTRL_TEST_CASE("wxSearchCtrl::Focus", "[wxSearchCtrl][focus]")
{
m_search->SetFocus(); m_search->SetFocus();
CPPUNIT_ASSERT( m_search->HasFocus() ); CHECK( m_search->HasFocus() );
#endif
} }
#endif // !__WXOSX__
#endif // wxUSE_SEARCHCTRL #endif // wxUSE_SEARCHCTRL