Add wxUIActionSimulator::Select().

Add a helper to select an item in a wxChoice, wxComboBox, wxListBox or similar.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77662 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-09-10 16:52:01 +00:00
parent c4470b8a48
commit 1addaeaa75
6 changed files with 125 additions and 1 deletions

View File

@@ -14,6 +14,7 @@
#endif // WX_PRECOMP
#include "wx/scopeguard.h"
#include "wx/uiaction.h"
#include "itemcontainertest.h"
@@ -303,3 +304,27 @@ void ItemContainerTestCase::SetSelection()
container->SetSelection(1);
CPPUNIT_ASSERT_EQUAL( 1, container->GetSelection() );
}
#if wxUSE_UIACTIONSIMULATOR
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") );
}
#endif // wxUSE_UIACTIONSIMULATOR