Minor cleanups for the tests.

See https://github.com/wxWidgets/wxWidgets/pull/1998
This commit is contained in:
Vadim Zeitlin
2020-08-03 00:26:43 +02:00
4 changed files with 6 additions and 20 deletions

View File

@@ -59,19 +59,6 @@ private:
void Bitmap();
#if defined(__WXGTK__) && wxUSE_UIACTIONSIMULATOR
virtual void SimSelect() wxOVERRIDE
{
// There is an inexplicable and locally irreproducible failure in this
// test for wxBitmapComboBox when it runs on the Linux buildbot slaves:
// wxUIActionSimulator::Select() fails there for some reason, so skip
// the test. If you ever manage to reproduce this locally, please try
// to debug it to understand what goes on!
if ( !IsAutomaticTest() )
ItemContainerTestCase::SimSelect();
}
#endif // __WXGTK__
wxBitmapComboBox *m_combo;
wxDECLARE_NO_COPY_CLASS(BitmapComboBoxTestCase);

View File

@@ -53,6 +53,7 @@ private:
// any meaning otherwise.
bool CreateCheckBox(long style)
{
wxDELETE( m_check );
m_check = new wxCheckBox(wxTheApp->GetTopWindow(), wxID_ANY, "Check box",
wxDefaultPosition, wxDefaultSize, style);
return false;
@@ -110,7 +111,6 @@ void CheckBoxTestCase::Check()
#ifdef wxHAS_3STATE_CHECKBOX
void CheckBoxTestCase::ThirdState()
{
wxDELETE(m_check);
CreateCheckBox(wxCHK_3STATE);
CPPUNIT_ASSERT_EQUAL(wxCHK_UNCHECKED, m_check->Get3StateValue());
@@ -128,7 +128,6 @@ void CheckBoxTestCase::ThirdState()
void CheckBoxTestCase::ThirdStateUser()
{
wxDELETE(m_check);
CreateCheckBox(wxCHK_3STATE | wxCHK_ALLOW_3RD_STATE_FOR_USER);
CPPUNIT_ASSERT_EQUAL(wxCHK_UNCHECKED, m_check->Get3StateValue());
@@ -147,14 +146,12 @@ void CheckBoxTestCase::ThirdStateUser()
void CheckBoxTestCase::InvalidStyles()
{
// Check that using incompatible styles doesn't work.
wxDELETE( m_check );
WX_ASSERT_FAILS_WITH_ASSERT( CreateCheckBox(wxCHK_2STATE | wxCHK_3STATE) );
#if !wxDEBUG_LEVEL
CPPUNIT_ASSERT( !m_check->Is3State() );
CPPUNIT_ASSERT( !m_check->Is3rdStateAllowedForUser() );
#endif
wxDELETE( m_check );
WX_ASSERT_FAILS_WITH_ASSERT(
CreateCheckBox(wxCHK_2STATE | wxCHK_ALLOW_3RD_STATE_FOR_USER) );
#if !wxDEBUG_LEVEL
@@ -163,7 +160,6 @@ void CheckBoxTestCase::InvalidStyles()
#endif
// wxCHK_ALLOW_3RD_STATE_FOR_USER without wxCHK_3STATE doesn't work.
wxDELETE( m_check );
WX_ASSERT_FAILS_WITH_ASSERT( CreateCheckBox(wxCHK_ALLOW_3RD_STATE_FOR_USER) );
}

View File

@@ -150,8 +150,9 @@ void ComboBoxTestCase::PopDismiss()
// Under wxGTK2, the event is sent only during idle time and not
// immediately, so we need this yield to get it.
wxYield();
CPPUNIT_ASSERT_EQUAL(1, close.GetCount());
#endif // wxGTK2
CPPUNIT_ASSERT_EQUAL(1, close.GetCount());
#endif
}

View File

@@ -273,7 +273,7 @@ TEST_CASE_METHOD(SpinCtrlTestCase2, "SpinCtrl::Value", "[spinctrl]")
CHECK(updatedText.GetCount() == 0);
}
TEST_CASE_METHOD(SpinCtrlTestCase2, "SpinCtrl::Base`", "[spinctrl]")
TEST_CASE_METHOD(SpinCtrlTestCase2, "SpinCtrl::Base", "[spinctrl]")
{
CHECK(m_spin->GetMin() == 0);
CHECK(m_spin->GetMax() == 100);
@@ -338,6 +338,8 @@ TEST_CASE_METHOD(SpinCtrlTestCase3, "SpinCtrl::SetValueInsideEventHandler", "[sp
CHECK(m_spin->GetValue() == 32);
}
delete text;
#endif // wxUSE_UIACTIONSIMULATOR
}