void ItemContainerTestCase::SetSelection()
{
    wxItemContainer * const container = GetContainer();

    container->Append("first");
    container->Append("second");

    // This class is used to check that SetSelection() doesn't generate any
    // events, as documented.
    class CommandEventHandler : public wxEvtHandler
    {
    public:
        virtual bool ProcessEvent(wxEvent& event)
        {
            CPPUNIT_ASSERT_MESSAGE
            (
                "unexpected command event from SetSelection",
                !event.IsCommandEvent()
            );

            return wxEvtHandler::ProcessEvent(event);
        }
    } h;

    wxWindow * const win = GetContainerWindow();
    win->PushEventHandler(&h);
    wxON_BLOCK_EXIT_OBJ1( *win, wxWindow::PopEventHandler, false );

    container->SetSelection(0);
    CPPUNIT_ASSERT_EQUAL( 0, container->GetSelection() );

    container->SetSelection(1);
    CPPUNIT_ASSERT_EQUAL( 1, container->GetSelection() );
}
Void BonkEnc::GeneralSettingsLayerCDDB::SelectDir()
{
	DirSelection	*dialog = new DirSelection();

	dialog->SetParentWindow(GetContainerWindow());
	dialog->SetCaption(String("\n").Append(BonkEnc::i18n->TranslateString("Select the folder of the CDDB database:")));
	dialog->SetDirName(edit_dir->GetText());

	if (dialog->ShowDialog() == Success())
	{
		edit_dir->SetText(dialog->GetDirName());
	}

	DeleteObject(dialog);
}
void ItemContainerTestCase::SimSelect()
{
    wxItemContainer * const container = GetContainer();

    container->Append("first");
    container->Append("second");
    container->Append("third");

    GetContainerWindow()->SetFocus();

    wxUIActionSimulator sim;
    CPPUNIT_ASSERT( sim.Select("third") );
    CPPUNIT_ASSERT_EQUAL( 2, container->GetSelection() );

    CPPUNIT_ASSERT( sim.Select("first") );
    CPPUNIT_ASSERT_EQUAL( 0, container->GetSelection() );

    CPPUNIT_ASSERT( !sim.Select("tenth") );
}