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:
@@ -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();
|
|
||||||
virtual void tearDown();
|
|
||||||
|
|
||||||
private:
|
|
||||||
CPPUNIT_TEST_SUITE( SearchCtrlTestCase );
|
|
||||||
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
|
|
||||||
CPPUNIT_TEST_SUITE_REGISTRATION( SearchCtrlTestCase );
|
|
||||||
|
|
||||||
// also include in its own registry so that these tests can be run alone
|
|
||||||
CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( SearchCtrlTestCase, "SearchCtrlTestCase" );
|
|
||||||
|
|
||||||
void SearchCtrlTestCase::setUp()
|
|
||||||
{
|
{
|
||||||
m_search = new wxSearchCtrl(wxTheApp->GetTopWindow(), wxID_ANY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchCtrlTestCase::tearDown()
|
~SearchCtrlTestCase()
|
||||||
{
|
{
|
||||||
delete m_search;
|
delete m_search;
|
||||||
m_search = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchCtrlTestCase::Focus()
|
protected:
|
||||||
{
|
wxSearchCtrl* const m_search;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define SEARCH_CTRL_TEST_CASE(name, tags) \
|
||||||
|
TEST_CASE_METHOD(SearchCtrlTestCase, name, tags)
|
||||||
|
|
||||||
// TODO OS X test only passes when run solo ...
|
// 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
|
||||||
|
Reference in New Issue
Block a user