Esempio n. 1
0
void RadioBoxTestCase::FindString()
{
    CPPUNIT_ASSERT_EQUAL(wxNOT_FOUND, m_radio->FindString("not here"));
    CPPUNIT_ASSERT_EQUAL(1, m_radio->FindString("item 1"));
    CPPUNIT_ASSERT_EQUAL(2, m_radio->FindString("ITEM 2"));
    CPPUNIT_ASSERT_EQUAL(wxNOT_FOUND, m_radio->FindString("ITEM 2", true));
}
Esempio n. 2
0
void RadioBoxTestCase::Count()
{
    //A trivial test for the item count as items can neither
    //be added or removed
    CPPUNIT_ASSERT_EQUAL(3, m_radio->GetCount());
    CPPUNIT_ASSERT(!m_radio->IsEmpty());
}
Esempio n. 3
0
void RadioBoxTestCase::SetString()
{
    m_radio->SetString(0, "new item 0");
    m_radio->SetString(2, "");

    CPPUNIT_ASSERT_EQUAL("new item 0", m_radio->GetString(0));
    CPPUNIT_ASSERT_EQUAL("", m_radio->GetString(2));
}
Esempio n. 4
0
void RadioBoxTestCase::HelpText()
{
    CPPUNIT_ASSERT_EQUAL(wxEmptyString, m_radio->GetItemHelpText(0));

    m_radio->SetItemHelpText(1, "Item 1 help");

    CPPUNIT_ASSERT_EQUAL("Item 1 help", m_radio->GetItemHelpText(1));

    m_radio->SetItemHelpText(1, "");

    CPPUNIT_ASSERT_EQUAL(wxEmptyString, m_radio->GetItemHelpText(1));
}
Esempio n. 5
0
void RadioBoxTestCase::ToolTip()
{
#if defined (__WXMSW__) || defined(__WXGTK__)
    //GetItemToolTip returns null if there is no tooltip set
    CPPUNIT_ASSERT(!m_radio->GetItemToolTip(0));

    m_radio->SetItemToolTip(1, "Item 1 help");

    CPPUNIT_ASSERT_EQUAL("Item 1 help", m_radio->GetItemToolTip(1)->GetTip());

    m_radio->SetItemToolTip(1, "");

    //However if we set a blank tip this does count as a tooltip
    CPPUNIT_ASSERT(!m_radio->GetItemToolTip(1));
#endif
}
Esempio n. 6
0
void MyFrame::OnVisibilityChange(wxCommandEvent& WXUNUSED(event))
{
    if ( m_visibilityRadioBox->GetSelection() == 0 )
        MSWGetTaskBarButton()->Show();
    else
        MSWGetTaskBarButton()->Hide();
}
/*****
Make sure the user entry is a valid index for the selected type of part
*****/
bool tmwxSelectPartByIndexDialog::Validate()
{
  size_t maxIndex;
  wxString partTypeStr;
  mPartType = mRadioBox->GetSelection();
  switch(mPartType) {
    case 0:
      partTypeStr = wxT("node");
      maxIndex = mDoc->mTree->GetNodes().size();
      break;
    case 1:
      partTypeStr = wxT("edge");
      maxIndex = mDoc->mTree->GetEdges().size();
      break;
    case 2:
      partTypeStr = wxT("path");
      maxIndex = mDoc->mTree->GetPaths().size();
      break;
    case 3:
      partTypeStr = wxT("poly");
      maxIndex = mDoc->mTree->GetPolys().size();
      break;
    case 4:
      partTypeStr = wxT("vertex");
      maxIndex = mDoc->mTree->GetVertices().size();
      break;
    case 5:
      partTypeStr = wxT("crease");
      maxIndex = mDoc->mTree->GetCreases().size();
      break;
    case 6:
      partTypeStr = wxT("facet");
      maxIndex = mDoc->mTree->GetFacets().size();
      break;
    default:
      maxIndex = 0;
      TMFAIL("unknown case");
  }
  if (maxIndex == 0) {
    tmwxAlertError(wxString::Format(
      wxT("You can't select %s %s by index because there aren't any."),
      mPartType != 1 ? wxT("a") : wxT("an"),
      partTypeStr.c_str()));
    return false;
  }
  size_t index;
  if (!mTextCtrl->ValidateSizeT(wxString::Format(wxT("%s index"), 
    partTypeStr.c_str()), 1, maxIndex, index, 
    wxString::Format(wxT("%s %s index must be between 1 and %d."),
    mPartType != 1 ? wxT("A") : wxT("An"),
    partTypeStr.c_str(),
    int(maxIndex))))
    return false;
  mPartOffset = index - 1;
  return true;
}
Esempio n. 8
0
void RadioBoxTestCase::RowColCount()
{
#ifndef __WXGTK__
    wxArrayString choices;
    choices.push_back("item 0");
    choices.push_back("item 1");
    choices.push_back("item 2");

    m_radio = new wxRadioBox(wxTheApp->GetTopWindow(), wxID_ANY, "RadioBox",
                             wxDefaultPosition, wxDefaultSize, choices, 2);

    CPPUNIT_ASSERT_EQUAL(2, m_radio->GetColumnCount());
    CPPUNIT_ASSERT_EQUAL(2, m_radio->GetRowCount());

    m_radio = new wxRadioBox(wxTheApp->GetTopWindow(), wxID_ANY, "RadioBox",
                             wxDefaultPosition, wxDefaultSize, choices, 1,
                             wxRA_SPECIFY_ROWS);

    CPPUNIT_ASSERT_EQUAL(3, m_radio->GetColumnCount());
    CPPUNIT_ASSERT_EQUAL(1, m_radio->GetRowCount());
#endif
}
Esempio n. 9
0
void RadioBoxTestCase::Selection()
{
    //Until other item containers the first item is selected by default
    CPPUNIT_ASSERT_EQUAL(0, m_radio->GetSelection());
    CPPUNIT_ASSERT_EQUAL("item 0", m_radio->GetStringSelection());

    m_radio->SetSelection(1);

    CPPUNIT_ASSERT_EQUAL(1, m_radio->GetSelection());
    CPPUNIT_ASSERT_EQUAL("item 1", m_radio->GetStringSelection());

    m_radio->SetStringSelection("item 2");

    CPPUNIT_ASSERT_EQUAL(2, m_radio->GetSelection());
    CPPUNIT_ASSERT_EQUAL("item 2", m_radio->GetStringSelection());
}
Esempio n. 10
0
void RadioBoxTestCase::Show()
{
    m_radio->Show(false);

    CPPUNIT_ASSERT(!m_radio->IsItemShown(0));

    m_radio->Show(1, true);

    CPPUNIT_ASSERT(!m_radio->IsItemShown(0));
    CPPUNIT_ASSERT(m_radio->IsItemShown(1));
    CPPUNIT_ASSERT(!m_radio->IsItemShown(2));

    m_radio->Show(true);

    CPPUNIT_ASSERT(m_radio->IsItemShown(0));
    CPPUNIT_ASSERT(m_radio->IsItemShown(1));
    CPPUNIT_ASSERT(m_radio->IsItemShown(2));

    m_radio->Show(0, false);

    CPPUNIT_ASSERT(!m_radio->IsItemShown(0));
    CPPUNIT_ASSERT(m_radio->IsItemShown(1));
    CPPUNIT_ASSERT(m_radio->IsItemShown(2));
}
Esempio n. 11
0
void RadioBoxTestCase::Enable()
{
#ifndef __WXOSX__
    m_radio->Enable(false);

    CPPUNIT_ASSERT(!m_radio->IsItemEnabled(0));

    m_radio->Enable(1, true);

    CPPUNIT_ASSERT(!m_radio->IsItemEnabled(0));
    CPPUNIT_ASSERT(m_radio->IsItemEnabled(1));
    CPPUNIT_ASSERT(!m_radio->IsItemEnabled(2));

    m_radio->Enable(true);

    CPPUNIT_ASSERT(m_radio->IsItemEnabled(0));
    CPPUNIT_ASSERT(m_radio->IsItemEnabled(1));
    CPPUNIT_ASSERT(m_radio->IsItemEnabled(2));

    m_radio->Enable(0, false);

    CPPUNIT_ASSERT(!m_radio->IsItemEnabled(0));
    CPPUNIT_ASSERT(m_radio->IsItemEnabled(1));
    CPPUNIT_ASSERT(m_radio->IsItemEnabled(2));
#endif
}