diff --git a/tests/controls/radiobuttontest.cpp b/tests/controls/radiobuttontest.cpp index 0d687a7918..649775b294 100644 --- a/tests/controls/radiobuttontest.cpp +++ b/tests/controls/radiobuttontest.cpp @@ -35,11 +35,13 @@ private: WXUISIM_TEST( Click ); CPPUNIT_TEST( Value ); CPPUNIT_TEST( Group ); + CPPUNIT_TEST( Single ); CPPUNIT_TEST_SUITE_END(); void Click(); void Value(); void Group(); + void Single(); wxRadioButton* m_radio; @@ -150,4 +152,36 @@ void RadioButtonTestCase::Group() wxDELETE(g2radio1); } +void RadioButtonTestCase::Single() +{ + //Create a group of 2 buttons, having second button selected + wxScopedPtr gradio0(new wxRadioButton(wxTheApp->GetTopWindow(), + wxID_ANY, "wxRadioButton", + wxDefaultPosition, + wxDefaultSize, wxRB_GROUP)); + + wxScopedPtr gradio1(new wxRadioButton(wxTheApp->GetTopWindow(), + wxID_ANY, "wxRadioButton")); + + gradio1->SetValue(true); + + //Create a "single" button (by default it will not be selected) + wxScopedPtr sradio(new wxRadioButton(wxTheApp->GetTopWindow(), + wxID_ANY, "wxRadioButton", + wxDefaultPosition, + wxDefaultSize, wxRB_SINGLE)); + + //Create a non-grouped button and select it + wxScopedPtr ngradio(new wxRadioButton(wxTheApp->GetTopWindow(), + wxID_ANY, "wxRadioButton")); + + ngradio->SetValue(true); + + //Select the "single" button + sradio->SetValue(true); + + CHECK(gradio1->GetValue()); + CHECK(ngradio->GetValue()); +} + #endif //wxUSE_RADIOBTN