void BitmapToggleButtonTestCase::Click()
{
#if wxUSE_UIACTIONSIMULATOR
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_button, wxEVT_COMMAND_TOGGLEBUTTON_CLICKED);
+ EventCounter clicked(m_button, wxEVT_COMMAND_TOGGLEBUTTON_CLICKED);
wxUIActionSimulator sim;
sim.MouseClick();
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(1, clicked.GetCount());
CPPUNIT_ASSERT(m_button->GetValue());
+ clicked.Clear();
wxMilliSleep(1000);
sim.MouseClick();
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(1, clicked.GetCount());
CPPUNIT_ASSERT(!m_button->GetValue());
#endif // wxUSE_UIACTIONSIMULATOR
}
void BitmapToggleButtonTestCase::Value()
{
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_button, wxEVT_COMMAND_BUTTON_CLICKED);
+ EventCounter clicked(m_button, wxEVT_COMMAND_BUTTON_CLICKED);
m_button->SetValue(true);
CPPUNIT_ASSERT(!m_button->GetValue());
- CPPUNIT_ASSERT_EQUAL( 0, frame->GetEventCount() );
+ CPPUNIT_ASSERT_EQUAL( 0, clicked.GetCount() );
}
#endif // wxHAS_BITMAPTOGGLEBUTTON
void BookCtrlBaseTestCase::ChangeEvents()
{
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
wxBookCtrlBase * const base = GetBase();
base->SetSelection(0);
- EventCounter count(base, GetChangingEvent());
- EventCounter count1(base, GetChangedEvent());
+ EventCounter changing(base, GetChangingEvent());
+ EventCounter changed(base, GetChangedEvent());
base->SetSelection(1);
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(GetChangingEvent()));
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(GetChangedEvent()));
+ CPPUNIT_ASSERT_EQUAL(1, changing.GetCount());
+ CPPUNIT_ASSERT_EQUAL(1, changed.GetCount());
+ changed.Clear();
+ changing.Clear();
base->ChangeSelection(2);
- CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount(GetChangingEvent()));
- CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount(GetChangedEvent()));
+ CPPUNIT_ASSERT_EQUAL(0, changing.GetCount());
+ CPPUNIT_ASSERT_EQUAL(0, changed.GetCount());
base->AdvanceSelection();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(GetChangingEvent()));
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(GetChangedEvent()));
+ CPPUNIT_ASSERT_EQUAL(1, changing.GetCount());
+ CPPUNIT_ASSERT_EQUAL(1, changed.GetCount());
+ changed.Clear();
+ changing.Clear();
base->AdvanceSelection(false);
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(GetChangingEvent()));
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(GetChangedEvent()));
+ CPPUNIT_ASSERT_EQUAL(1, changing.GetCount());
+ CPPUNIT_ASSERT_EQUAL(1, changed.GetCount());
}
void BookCtrlBaseTestCase::Image()
void ButtonTestCase::Click()
{
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
//We use the internal class EventCounter which handles connecting and
//disconnecting the control to the wxTestableFrame
- EventCounter count(m_button, wxEVT_COMMAND_BUTTON_CLICKED);
+ EventCounter clicked(m_button, wxEVT_COMMAND_BUTTON_CLICKED);
wxUIActionSimulator sim;
sim.MouseClick();
wxYield();
- CPPUNIT_ASSERT_EQUAL( 1, frame->GetEventCount() );
+ CPPUNIT_ASSERT_EQUAL( 1, clicked.GetCount() );
}
void ButtonTestCase::Disabled()
{
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_button, wxEVT_COMMAND_BUTTON_CLICKED);
+ EventCounter clicked(m_button, wxEVT_COMMAND_BUTTON_CLICKED);
wxUIActionSimulator sim;
sim.MouseClick();
wxYield();
- CPPUNIT_ASSERT_EQUAL( 0, frame->GetEventCount() );
+ CPPUNIT_ASSERT_EQUAL( 0, clicked.GetCount() );
}
#endif // wxUSE_UIACTIONSIMULATOR
void CheckBoxTestCase::Check()
{
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_check, wxEVT_COMMAND_CHECKBOX_CLICKED);
+ EventCounter clicked(m_check, wxEVT_COMMAND_CHECKBOX_CLICKED);
//We should be unchecked by default
CPPUNIT_ASSERT(!m_check->IsChecked());
CPPUNIT_ASSERT(!m_check->IsChecked());
//None of these should send events
- CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(0, clicked.GetCount());
}
#ifdef wxHAS_3STATE_CHECKBOX
void CheckListBoxTestCase::Check()
{
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_check, wxEVT_COMMAND_CHECKLISTBOX_TOGGLED);
+ EventCounter toggled(m_check, wxEVT_COMMAND_CHECKLISTBOX_TOGGLED);
wxArrayString testitems;
testitems.Add("item 0");
m_check->Check(1, false);
//We should not get any events when changing this from code
- CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(0, toggled.GetCount());
CPPUNIT_ASSERT_EQUAL(true, m_check->IsChecked(0));
CPPUNIT_ASSERT_EQUAL(false, m_check->IsChecked(1));
void ComboBoxTestCase::PopDismiss()
{
#if defined(__WXMSW__) || defined(__WXGTK210__)
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_combo, wxEVT_COMMAND_COMBOBOX_DROPDOWN);
- EventCounter count1(m_combo, wxEVT_COMMAND_COMBOBOX_CLOSEUP);
+ EventCounter drop(m_combo, wxEVT_COMMAND_COMBOBOX_DROPDOWN);
+ EventCounter close(m_combo, wxEVT_COMMAND_COMBOBOX_CLOSEUP);
m_combo->Popup();
m_combo->Dismiss();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_COMBOBOX_DROPDOWN));
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_COMBOBOX_CLOSEUP));
+ CPPUNIT_ASSERT_EQUAL(1, drop.GetCount());
+ CPPUNIT_ASSERT_EQUAL(1, close.GetCount());
#endif
}
void FrameTestCase::Iconize()
{
#ifdef __WXMSW__
- wxTestableFrame* testframe = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_frame, wxEVT_ICONIZE);
+ EventCounter iconize(m_frame, wxEVT_ICONIZE);
m_frame->Iconize();
m_frame->Iconize(false);
- CPPUNIT_ASSERT_EQUAL(2, testframe->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(2, iconize.GetCount());
#endif
}
void FrameTestCase::Close()
{
- wxTestableFrame* testframe = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_frame, wxEVT_CLOSE_WINDOW);
+ EventCounter close(m_frame, wxEVT_CLOSE_WINDOW);
m_frame->Close();
- CPPUNIT_ASSERT_EQUAL(1, testframe->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(1, close.GetCount());
}
void GridTestCase::CellEdit()
{
#if wxUSE_UIACTIONSIMULATOR
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_grid, wxEVT_GRID_CELL_CHANGING);
- EventCounter count1(m_grid, wxEVT_GRID_CELL_CHANGED);
- EventCounter count2(m_grid, wxEVT_GRID_EDITOR_CREATED);
+ EventCounter changing(m_grid, wxEVT_GRID_CELL_CHANGING);
+ EventCounter changed(m_grid, wxEVT_GRID_CELL_CHANGED);
+ EventCounter created(m_grid, wxEVT_GRID_EDITOR_CREATED);
wxUIActionSimulator sim;
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_EDITOR_CREATED));
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_CELL_CHANGING));
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_CELL_CHANGED));
+ CPPUNIT_ASSERT_EQUAL(1, created.GetCount());
+ CPPUNIT_ASSERT_EQUAL(1, changing.GetCount());
+ CPPUNIT_ASSERT_EQUAL(1, changed.GetCount());
#endif
}
void GridTestCase::CellClick()
{
#if wxUSE_UIACTIONSIMULATOR
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_grid, wxEVT_GRID_CELL_LEFT_CLICK);
- EventCounter count1(m_grid, wxEVT_GRID_CELL_LEFT_DCLICK);
- EventCounter count2(m_grid, wxEVT_GRID_CELL_RIGHT_CLICK);
- EventCounter count3(m_grid, wxEVT_GRID_CELL_RIGHT_DCLICK);
+ EventCounter lclick(m_grid, wxEVT_GRID_CELL_LEFT_CLICK);
+ EventCounter ldclick(m_grid, wxEVT_GRID_CELL_LEFT_DCLICK);
+ EventCounter rclick(m_grid, wxEVT_GRID_CELL_RIGHT_CLICK);
+ EventCounter rdclick(m_grid, wxEVT_GRID_CELL_RIGHT_DCLICK);
wxUIActionSimulator sim;
wxRect rect = m_grid->CellToRect(0, 0);
wxPoint point = m_grid->CalcScrolledPosition(rect.GetPosition());
- point = frame->ClientToScreen(point + wxPoint(m_grid->GetRowLabelSize(),
- m_grid->GetColLabelSize())
- + wxPoint(2, 2));
+ point = m_grid->ClientToScreen(point + wxPoint(m_grid->GetRowLabelSize(),
+ m_grid->GetColLabelSize())
+ + wxPoint(2, 2));
sim.MouseMove(point);
wxYield();
sim.MouseClick();
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_CELL_LEFT_CLICK));
+ CPPUNIT_ASSERT_EQUAL(1, lclick.GetCount());
+ lclick.Clear();
sim.MouseDblClick();
wxYield();
//A double click event sends a single click event first
//test to ensure this still happens in the future
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_CELL_LEFT_CLICK));
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_CELL_LEFT_DCLICK));
+ CPPUNIT_ASSERT_EQUAL(1, lclick.GetCount());
+ CPPUNIT_ASSERT_EQUAL(1, ldclick.GetCount());
sim.MouseClick(wxMOUSE_BTN_RIGHT);
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_CELL_RIGHT_CLICK));
+ CPPUNIT_ASSERT_EQUAL(1, rclick.GetCount());
+ rclick.Clear();
sim.MouseDblClick(wxMOUSE_BTN_RIGHT);
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_CELL_RIGHT_CLICK));
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_CELL_RIGHT_DCLICK));
+ CPPUNIT_ASSERT_EQUAL(1, rclick.GetCount());
+ CPPUNIT_ASSERT_EQUAL(1, rdclick.GetCount());
#endif
}
void GridTestCase::CellSelect()
{
#if wxUSE_UIACTIONSIMULATOR
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_grid, wxEVT_GRID_SELECT_CELL);
+ EventCounter cell(m_grid, wxEVT_GRID_SELECT_CELL);
wxUIActionSimulator sim;
wxRect rect = m_grid->CellToRect(0, 0);
wxPoint point = m_grid->CalcScrolledPosition(rect.GetPosition());
- point = frame->ClientToScreen(point + wxPoint(m_grid->GetRowLabelSize(),
- m_grid->GetColLabelSize())
- + wxPoint(4, 4));
+ point = m_grid->ClientToScreen(point + wxPoint(m_grid->GetRowLabelSize(),
+ m_grid->GetColLabelSize())
+ + wxPoint(4, 4));
sim.MouseMove(point);
wxYield();
sim.MouseClick();
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_SELECT_CELL));
+ CPPUNIT_ASSERT_EQUAL(1, cell.GetCount());
+
+ cell.Clear();
m_grid->SetGridCursor(1, 1);
m_grid->GoToCell(1, 0);
sim.MouseDblClick();
wxYield();
- CPPUNIT_ASSERT_EQUAL(3, frame->GetEventCount(wxEVT_GRID_SELECT_CELL));
+ CPPUNIT_ASSERT_EQUAL(3, cell.GetCount());
#endif
}
void GridTestCase::LabelClick()
{
#if wxUSE_UIACTIONSIMULATOR
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_grid, wxEVT_GRID_LABEL_LEFT_CLICK);
- EventCounter count1(m_grid, wxEVT_GRID_LABEL_LEFT_DCLICK);
- EventCounter count2(m_grid, wxEVT_GRID_LABEL_RIGHT_CLICK);
- EventCounter count3(m_grid, wxEVT_GRID_LABEL_RIGHT_DCLICK);
+ EventCounter lclick(m_grid, wxEVT_GRID_LABEL_LEFT_CLICK);
+ EventCounter ldclick(m_grid, wxEVT_GRID_LABEL_LEFT_DCLICK);
+ EventCounter rclick(m_grid, wxEVT_GRID_LABEL_RIGHT_CLICK);
+ EventCounter rdclick(m_grid, wxEVT_GRID_LABEL_RIGHT_DCLICK);
wxUIActionSimulator sim;
sim.MouseClick();
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_LABEL_LEFT_CLICK));
+ CPPUNIT_ASSERT_EQUAL(1, lclick.GetCount());
sim.MouseDblClick();
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_LABEL_LEFT_DCLICK));
+ CPPUNIT_ASSERT_EQUAL(1, ldclick.GetCount());
sim.MouseClick(wxMOUSE_BTN_RIGHT);
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_LABEL_RIGHT_CLICK));
+ CPPUNIT_ASSERT_EQUAL(1, rclick.GetCount());
+ rclick.Clear();
sim.MouseDblClick(wxMOUSE_BTN_RIGHT);
wxYield();
{
//Right double click not supported with native headers so we get two
//right click events
- CPPUNIT_ASSERT_EQUAL(2, frame->GetEventCount(wxEVT_GRID_LABEL_RIGHT_CLICK));
+ CPPUNIT_ASSERT_EQUAL(2, rclick.GetCount());
}
else
{
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_LABEL_RIGHT_CLICK));
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_LABEL_RIGHT_DCLICK));
+ CPPUNIT_ASSERT_EQUAL(1, rclick.GetCount());
+ CPPUNIT_ASSERT_EQUAL(1, rdclick.GetCount());
}
#endif
}
#if wxUSE_UIACTIONSIMULATOR
m_grid->SetSortingColumn(0);
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_grid, wxEVT_GRID_COL_SORT);
+ EventCounter sort(m_grid, wxEVT_GRID_COL_SORT);
wxUIActionSimulator sim;
sim.MouseClick();
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(1, sort.GetCount());
#endif
}
void GridTestCase::Size()
{
#if wxUSE_UIACTIONSIMULATOR && !defined(__WXGTK__)
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_grid, wxEVT_GRID_COL_SIZE);
- EventCounter count1(m_grid, wxEVT_GRID_ROW_SIZE);
+ EventCounter colsize(m_grid, wxEVT_GRID_COL_SIZE);
+ EventCounter rowsize(m_grid, wxEVT_GRID_ROW_SIZE);
wxUIActionSimulator sim;
sim.MouseUp();
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_COL_SIZE));
+ CPPUNIT_ASSERT_EQUAL(1, colsize.GetCount());
pt = m_grid->ClientToScreen(wxPoint(5, m_grid->GetColLabelSize() +
m_grid->GetRowSize(0)));
sim.MouseDragDrop(pt.x, pt.y, pt.x, pt.y + 50);
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_ROW_SIZE));
+ CPPUNIT_ASSERT_EQUAL(1, rowsize.GetCount());
#endif
}
void GridTestCase::RangeSelect()
{
#if wxUSE_UIACTIONSIMULATOR
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_grid, wxEVT_GRID_RANGE_SELECT);
+ EventCounter select(m_grid, wxEVT_GRID_RANGE_SELECT);
wxUIActionSimulator sim;
sim.MouseUp();
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_RANGE_SELECT));
+ CPPUNIT_ASSERT_EQUAL(1, select.GetCount());
#endif
}
void GridTestCase::Editable()
{
#if wxUSE_UIACTIONSIMULATOR
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
//As the grid is not editable we shouldn't create an editor
- EventCounter count(m_grid, wxEVT_GRID_EDITOR_CREATED);
+ EventCounter created(m_grid, wxEVT_GRID_EDITOR_CREATED);
wxUIActionSimulator sim;
sim.Char(WXK_RETURN);
wxYield();
- CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(0, created.GetCount());
#endif
}
void GridTestCase::ReadOnly()
{
#if wxUSE_UIACTIONSIMULATOR
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
//As the cell is readonly we shouldn't create an editor
- EventCounter count(m_grid, wxEVT_GRID_EDITOR_CREATED);
+ EventCounter created(m_grid, wxEVT_GRID_EDITOR_CREATED);
wxUIActionSimulator sim;
sim.Char(WXK_RETURN);
wxYield();
- CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(0, created.GetCount());
#endif
}
void HyperlinkCtrlTestCase::Click()
{
#if wxUSE_UIACTIONSIMULATOR && !defined(__WXGTK__)
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_hyperlink, wxEVT_COMMAND_HYPERLINK);
+ EventCounter hyperlink(m_hyperlink, wxEVT_COMMAND_HYPERLINK);
wxUIActionSimulator sim;
sim.MouseClick();
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(1, hyperlink.GetCount());
#endif
}
if ( wxGetUserId().Lower().Matches("buildslave*") )
return;
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
wxListCtrl* const list = GetList();
list->InsertColumn(0, "Column 0", wxLIST_FORMAT_LEFT, 60);
list->SetItem(0, 1, "first column");
list->SetItem(0, 2, "second column");
- EventCounter count(list, wxEVT_COMMAND_LIST_ITEM_SELECTED);
- EventCounter count1(list, wxEVT_COMMAND_LIST_ITEM_FOCUSED);
- EventCounter count2(list, wxEVT_COMMAND_LIST_ITEM_ACTIVATED);
- EventCounter count3(list, wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK);
+ EventCounter selected(list, wxEVT_COMMAND_LIST_ITEM_SELECTED);
+ EventCounter focused(list, wxEVT_COMMAND_LIST_ITEM_FOCUSED);
+ EventCounter activated(list, wxEVT_COMMAND_LIST_ITEM_ACTIVATED);
+ EventCounter rclick(list, wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK);
wxUIActionSimulator sim;
// when the first item was selected the focus changes to it, but not
// on subsequent clicks
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_LIST_ITEM_FOCUSED));
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_LIST_ITEM_SELECTED));
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_LIST_ITEM_ACTIVATED));
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK));
+ CPPUNIT_ASSERT_EQUAL(1, focused.GetCount());
+ CPPUNIT_ASSERT_EQUAL(1, selected.GetCount());
+ CPPUNIT_ASSERT_EQUAL(1, activated.GetCount());
+ CPPUNIT_ASSERT_EQUAL(1, rclick.GetCount());
//tidy up when we are finished
list->ClearAll();
void ListBaseTestCase::KeyDown()
{
#if wxUSE_UIACTIONSIMULATOR
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
wxListCtrl* const list = GetList();
- EventCounter count(list, wxEVT_COMMAND_LIST_KEY_DOWN);
+ EventCounter keydown(list, wxEVT_COMMAND_LIST_KEY_DOWN);
wxUIActionSimulator sim;
sim.Text("aAbB");
wxYield();
- CPPUNIT_ASSERT_EQUAL(6, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(6, keydown.GetCount());
#endif
}
void ListBaseTestCase::DeleteItems()
{
#ifndef __WXOSX__
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
wxListCtrl* const list = GetList();
- EventCounter count(list, wxEVT_COMMAND_LIST_DELETE_ITEM);
- EventCounter count1(list, wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS);
+ EventCounter deleteitem(list, wxEVT_COMMAND_LIST_DELETE_ITEM);
+ EventCounter deleteall(list, wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS);
list->InsertColumn(0, "Column 0", wxLIST_FORMAT_LEFT, 60);
list->ClearAll();
list->DeleteAllItems();
- CPPUNIT_ASSERT_EQUAL(2, frame->GetEventCount(wxEVT_COMMAND_LIST_DELETE_ITEM));
- CPPUNIT_ASSERT_EQUAL(2, frame->GetEventCount(wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS));
+ CPPUNIT_ASSERT_EQUAL(2, deleteitem.GetCount());
+ CPPUNIT_ASSERT_EQUAL(2, deleteall.GetCount());
#endif
}
void ListBaseTestCase::InsertItem()
{
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
wxListCtrl* const list = GetList();
- EventCounter count(list, wxEVT_COMMAND_LIST_INSERT_ITEM);
+ EventCounter insert(list, wxEVT_COMMAND_LIST_INSERT_ITEM);
list->InsertColumn(0, "Column 0", wxLIST_FORMAT_LEFT, 60);
list->InsertItem(item);
list->InsertItem(1, "more text");
- CPPUNIT_ASSERT_EQUAL(2, frame->GetEventCount(wxEVT_COMMAND_LIST_INSERT_ITEM));
+ CPPUNIT_ASSERT_EQUAL(2, insert.GetCount());
}
void ListBaseTestCase::Find()
list->InsertItem(0, "Item 0");
list->InsertItem(1, "Item 1");
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(list, wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT);
- EventCounter count1(list, wxEVT_COMMAND_LIST_END_LABEL_EDIT);
+ EventCounter beginedit(list, wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT);
+ EventCounter endedit(list, wxEVT_COMMAND_LIST_END_LABEL_EDIT);
wxUIActionSimulator sim;
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT));
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_LIST_END_LABEL_EDIT));
+ CPPUNIT_ASSERT_EQUAL(1, beginedit.GetCount());
+ CPPUNIT_ASSERT_EQUAL(1, endedit.GetCount());
#endif
}
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
wxTestableFrame);
- EventCounter count(frame, wxEVT_COMMAND_LISTBOX_SELECTED);
- EventCounter count1(frame, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED);
+ EventCounter selected(frame, wxEVT_COMMAND_LISTBOX_SELECTED);
+ EventCounter dclicked(frame, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED);
wxUIActionSimulator sim;
sim.MouseClick();
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(1, selected.GetCount());
sim.MouseDblClick();
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(1, dclicked.GetCount());
#endif
}
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
wxTestableFrame);
- EventCounter count(frame, wxEVT_COMMAND_LISTBOX_SELECTED);
- EventCounter count1(frame, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED);
+ EventCounter selected(frame, wxEVT_COMMAND_LISTBOX_SELECTED);
+ EventCounter dclicked(frame, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED);
wxUIActionSimulator sim;
wxYield();
//If we are not clicking on an item we shouldn't have any events
- CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(0, selected.GetCount());
+ CPPUNIT_ASSERT_EQUAL(0, dclicked.GetCount());
#endif
}
#if wxUSE_UIACTIONSIMULATOR
void ListCtrlTestCase::ColumnDrag()
{
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_list, wxEVT_COMMAND_LIST_COL_BEGIN_DRAG);
- EventCounter count1(m_list, wxEVT_COMMAND_LIST_COL_DRAGGING);
- EventCounter count2(m_list, wxEVT_COMMAND_LIST_COL_END_DRAG);
+ EventCounter begindrag(m_list, wxEVT_COMMAND_LIST_COL_BEGIN_DRAG);
+ EventCounter dragging(m_list, wxEVT_COMMAND_LIST_COL_DRAGGING);
+ EventCounter enddrag(m_list, wxEVT_COMMAND_LIST_COL_END_DRAG);
m_list->InsertColumn(0, "Column 0");
m_list->InsertColumn(1, "Column 1");
sim.MouseUp();
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_LIST_COL_BEGIN_DRAG));
- CPPUNIT_ASSERT(frame->GetEventCount(wxEVT_COMMAND_LIST_COL_DRAGGING) > 0);
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_LIST_COL_END_DRAG));
+ CPPUNIT_ASSERT_EQUAL(1, begindrag.GetCount());
+ CPPUNIT_ASSERT(dragging.GetCount() > 0);
+ CPPUNIT_ASSERT_EQUAL(1, enddrag.GetCount());
m_list->ClearAll();
}
void ListCtrlTestCase::ColumnClick()
{
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_list, wxEVT_COMMAND_LIST_COL_CLICK);
- EventCounter count1(m_list, wxEVT_COMMAND_LIST_COL_RIGHT_CLICK);
+ EventCounter colclick(m_list, wxEVT_COMMAND_LIST_COL_CLICK);
+ EventCounter colrclick(m_list, wxEVT_COMMAND_LIST_COL_RIGHT_CLICK);
m_list->InsertColumn(0, "Column 0", wxLIST_FORMAT_LEFT, 60);
sim.MouseClick(wxMOUSE_BTN_RIGHT);
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_LIST_COL_CLICK));
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_LIST_COL_RIGHT_CLICK));
+ CPPUNIT_ASSERT_EQUAL(1, colclick.GetCount());
+ CPPUNIT_ASSERT_EQUAL(1, colrclick.GetCount());
m_list->ClearAll();
}
void OwnerDrawnComboBoxTestCase::PopDismiss()
{
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_combo, wxEVT_COMMAND_COMBOBOX_DROPDOWN);
- EventCounter count1(m_combo, wxEVT_COMMAND_COMBOBOX_CLOSEUP);
+ EventCounter drop(m_combo, wxEVT_COMMAND_COMBOBOX_DROPDOWN);
+ EventCounter close(m_combo, wxEVT_COMMAND_COMBOBOX_CLOSEUP);
m_combo->Popup();
m_combo->Dismiss();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_COMBOBOX_DROPDOWN));
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_COMBOBOX_CLOSEUP));
+ CPPUNIT_ASSERT_EQUAL(1, drop.GetCount());
+ CPPUNIT_ASSERT_EQUAL(1, close.GetCount());
}
void OwnerDrawnComboBoxTestCase::Sort()
{
// GTK does not support selecting a single radio button
#if wxUSE_UIACTIONSIMULATOR && !defined(__WXGTK__)
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_radio, wxEVT_COMMAND_RADIOBUTTON_SELECTED);
+ EventCounter selected(m_radio, wxEVT_COMMAND_RADIOBUTTON_SELECTED);
wxUIActionSimulator sim;
wxYield();
- CPPUNIT_ASSERT_EQUAL( 1, frame->GetEventCount() );
+ CPPUNIT_ASSERT_EQUAL( 1, selected.GetCount() );
#endif
}
void RadioButtonTestCase::Value()
{
#ifndef __WXGTK__
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_radio, wxEVT_COMMAND_RADIOBUTTON_SELECTED);
+ EventCounter selected(m_radio, wxEVT_COMMAND_RADIOBUTTON_SELECTED);
m_radio->SetValue(true);
CPPUNIT_ASSERT(!m_radio->GetValue());
- CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(0, selected.GetCount());
#endif
}
// There seems to be an event sequence problem on GTK+ that causes the events
// to be disconnected before they're processed, generating spurious errors.
#if !defined(__WXGTK__)
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_rich, wxEVT_COMMAND_RICHTEXT_CHARACTER);
- EventCounter count1(m_rich, wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED);
+ EventCounter character(m_rich, wxEVT_COMMAND_RICHTEXT_CHARACTER);
+ EventCounter content(m_rich, wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED);
m_rich->SetFocus();
sim.Text("abcdef");
wxYield();
- CPPUNIT_ASSERT_EQUAL(6, frame->GetEventCount(wxEVT_COMMAND_RICHTEXT_CHARACTER));
- CPPUNIT_ASSERT_EQUAL(6, frame->GetEventCount(wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED));
+ CPPUNIT_ASSERT_EQUAL(6, character.GetCount());
+ CPPUNIT_ASSERT_EQUAL(6, content.GetCount());
+
+ character.Clear();
+ content.Clear();
//As these are not characters they shouldn't count
sim.Char(WXK_RETURN);
sim.Char(WXK_SHIFT);
wxYield();
- CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount(wxEVT_COMMAND_RICHTEXT_CHARACTER));
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED));
+ CPPUNIT_ASSERT_EQUAL(0, character.GetCount());
+ CPPUNIT_ASSERT_EQUAL(1, content.GetCount());
#endif
#endif
}
// There seems to be an event sequence problem on GTK+ that causes the events
// to be disconnected before they're processed, generating spurious errors.
#if !defined(__WXGTK__)
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_rich, wxEVT_COMMAND_RICHTEXT_DELETE);
- EventCounter count1(m_rich, wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED);
+ EventCounter deleteevent(m_rich, wxEVT_COMMAND_RICHTEXT_DELETE);
+ EventCounter contentdelete(m_rich, wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED);
m_rich->SetFocus();
sim.Char(WXK_DELETE);
wxYield();
- CPPUNIT_ASSERT_EQUAL(2, frame->GetEventCount(wxEVT_COMMAND_RICHTEXT_DELETE));
+ CPPUNIT_ASSERT_EQUAL(2, deleteevent.GetCount());
//Only one as the delete doesn't delete anthing
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED));
+ CPPUNIT_ASSERT_EQUAL(1, contentdelete.GetCount());
#endif
#endif
}
// There seems to be an event sequence problem on GTK+ that causes the events
// to be disconnected before they're processed, generating spurious errors.
#if !defined(__WXGTK__)
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_rich, wxEVT_COMMAND_RICHTEXT_RETURN);
+ EventCounter returnevent(m_rich, wxEVT_COMMAND_RICHTEXT_RETURN);
m_rich->SetFocus();
sim.Char(WXK_RETURN);
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(1, returnevent.GetCount());
#endif
#endif
}
void RichTextCtrlTestCase::StyleEvent()
{
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_rich, wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED);
+ EventCounter stylechanged(m_rich, wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED);
m_rich->SetValue("Sometext");
m_rich->SetStyle(0, 8, wxTextAttr(*wxRED, *wxWHITE));
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED));
+ CPPUNIT_ASSERT_EQUAL(1, stylechanged.GetCount());
}
void RichTextCtrlTestCase::BufferResetEvent()
{
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_rich, wxEVT_COMMAND_RICHTEXT_BUFFER_RESET);
+ EventCounter reset(m_rich, wxEVT_COMMAND_RICHTEXT_BUFFER_RESET);
m_rich->AppendText("more text!");
m_rich->SetValue("");
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(1, reset.GetCount());
+ reset.Clear();
m_rich->AppendText("more text!");
m_rich->Clear();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(1, reset.GetCount());
+
+ reset.Clear();
//We expect a buffer reset here as setvalue clears the existing text
m_rich->SetValue("replace");
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(1, reset.GetCount());
}
void RichTextCtrlTestCase::UrlEvent()
#if wxUSE_UIACTIONSIMULATOR
// Mouse up event not being caught on GTK+
#if !defined(__WXGTK__)
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_rich, wxEVT_COMMAND_TEXT_URL);
+ EventCounter url(m_rich, wxEVT_COMMAND_TEXT_URL);
m_rich->BeginURL("http://www.wxwidgets.org");
m_rich->WriteText("http://www.wxwidgets.org");
sim.MouseClick();
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(1, url.GetCount());
#endif
#endif
}
{
#if wxUSE_UIACTIONSIMULATOR
#if !defined(__WXGTK__)
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_rich, wxEVT_COMMAND_TEXT_UPDATED);
+ EventCounter updated(m_rich, wxEVT_COMMAND_TEXT_UPDATED);
m_rich->SetFocus();
wxYield();
CPPUNIT_ASSERT_EQUAL("abcdef", m_rich->GetValue());
- CPPUNIT_ASSERT_EQUAL(6, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(6, updated.GetCount());
#endif
#endif
}
{
#if wxUSE_UIACTIONSIMULATOR
#if !defined(__WXGTK__)
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_rich, wxEVT_COMMAND_TEXT_UPDATED);
+ EventCounter updated(m_rich, wxEVT_COMMAND_TEXT_UPDATED);
m_rich->SetFocus();
wxYield();
CPPUNIT_ASSERT_EQUAL("abcdef", m_rich->GetValue());
- CPPUNIT_ASSERT_EQUAL(6, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(6, updated.GetCount());
+ updated.Clear();
m_rich->SetEditable(false);
sim.Text("gh");
wxYield();
CPPUNIT_ASSERT_EQUAL("abcdef", m_rich->GetValue());
- CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(0, updated.GetCount());
#endif
#endif
}
void SliderTestCase::PageUpDown()
{
#if wxUSE_UIACTIONSIMULATOR
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_slider, wxEVT_SCROLL_PAGEUP);
- EventCounter count1(m_slider, wxEVT_SCROLL_PAGEDOWN);
+ EventCounter pageup(m_slider, wxEVT_SCROLL_PAGEUP);
+ EventCounter pagedown(m_slider, wxEVT_SCROLL_PAGEDOWN);
wxUIActionSimulator sim;
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_SCROLL_PAGEUP));
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_SCROLL_PAGEDOWN));
+ CPPUNIT_ASSERT_EQUAL(1, pageup.GetCount());
+ CPPUNIT_ASSERT_EQUAL(1, pagedown.GetCount());
#endif
}
void SliderTestCase::LineUpDown()
{
#if wxUSE_UIACTIONSIMULATOR
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_slider, wxEVT_SCROLL_LINEUP);
- EventCounter count1(m_slider, wxEVT_SCROLL_LINEDOWN);
+ EventCounter lineup(m_slider, wxEVT_SCROLL_LINEUP);
+ EventCounter linedown(m_slider, wxEVT_SCROLL_LINEDOWN);
wxUIActionSimulator sim;
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_SCROLL_LINEUP));
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_SCROLL_LINEDOWN));
+ CPPUNIT_ASSERT_EQUAL(1, lineup.GetCount());
+ CPPUNIT_ASSERT_EQUAL(1, linedown.GetCount());
#endif
}
void SliderTestCase::Thumb()
{
#if wxUSE_UIACTIONSIMULATOR && !defined(__WXGTK__)
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_slider, wxEVT_SCROLL_THUMBTRACK);
- EventCounter count1(m_slider, wxEVT_SCROLL_THUMBRELEASE);
- EventCounter count2(m_slider, wxEVT_SCROLL_CHANGED);
+ EventCounter track(m_slider, wxEVT_SCROLL_THUMBTRACK);
+ EventCounter release(m_slider, wxEVT_SCROLL_THUMBRELEASE);
+ EventCounter changed(m_slider, wxEVT_SCROLL_CHANGED);
wxUIActionSimulator sim;
sim.MouseUp();
wxYield();
- CPPUNIT_ASSERT(frame->GetEventCount(wxEVT_SCROLL_THUMBTRACK) != 0);
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_SCROLL_THUMBRELEASE));
+ CPPUNIT_ASSERT(track.GetCount() != 0);
+ CPPUNIT_ASSERT_EQUAL(1, release.GetCount());
#ifdef __WXMSW__
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_SCROLL_CHANGED));
+ CPPUNIT_ASSERT_EQUAL(1, changed.GetCount());
#endif
#endif
}
void SpinCtrlDoubleTestCase::Arrows()
{
#ifndef __WXGTK__
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_spin, wxEVT_COMMAND_SPINCTRLDOUBLE_UPDATED);
+ EventCounter updated(m_spin, wxEVT_COMMAND_SPINCTRLDOUBLE_UPDATED);
wxUIActionSimulator sim;
sim.Char(WXK_UP);
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(1, updated.GetCount());
CPPUNIT_ASSERT_EQUAL(1.0, m_spin->GetValue());
+ updated.Clear();
sim.Char(WXK_DOWN);
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(1, updated.GetCount());
CPPUNIT_ASSERT_EQUAL(0.0, m_spin->GetValue());
#endif
}
void SpinCtrlTestCase::Arrows()
{
#if wxUSE_UIACTIONSIMULATOR
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_spin, wxEVT_COMMAND_SPINCTRL_UPDATED);
+ EventCounter updated(m_spin, wxEVT_COMMAND_SPINCTRL_UPDATED);
wxUIActionSimulator sim;
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(1, updated.GetCount());
CPPUNIT_ASSERT_EQUAL(1, m_spin->GetValue());
+ updated.Clear();
sim.Char(WXK_DOWN);
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(1, updated.GetCount());
CPPUNIT_ASSERT_EQUAL(0, m_spin->GetValue());
#endif
}
wxDefaultPosition, wxDefaultSize,
wxTE_READONLY);
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_text, wxEVT_COMMAND_TEXT_UPDATED);
+ EventCounter updated(m_text, wxEVT_COMMAND_TEXT_UPDATED);
m_text->SetFocus();
wxYield();
CPPUNIT_ASSERT_EQUAL("", m_text->GetValue());
- CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(0, updated.GetCount());
// SetEditable() is supposed to override wxTE_READONLY
m_text->SetEditable(true);
wxYield();
CPPUNIT_ASSERT_EQUAL("abcdef", m_text->GetValue());
- CPPUNIT_ASSERT_EQUAL(6, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(6, updated.GetCount());
delete m_text;
m_text = new wxTextCtrl(wxTheApp->GetTopWindow(), wxID_ANY);
void TextCtrlTestCase::MaxLength()
{
#if wxUSE_UIACTIONSIMULATOR
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_text, wxEVT_COMMAND_TEXT_UPDATED);
- EventCounter count1(m_text, wxEVT_COMMAND_TEXT_MAXLEN);
+ EventCounter updated(m_text, wxEVT_COMMAND_TEXT_UPDATED);
+ EventCounter maxlen(m_text, wxEVT_COMMAND_TEXT_MAXLEN);
m_text->SetFocus();
m_text->SetMaxLength(10);
sim.Text("abcdef");
wxYield();
- CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount(wxEVT_COMMAND_TEXT_MAXLEN));
+ CPPUNIT_ASSERT_EQUAL(0, maxlen.GetCount());
sim.Text("ghij");
wxYield();
- CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount(wxEVT_COMMAND_TEXT_MAXLEN));
- CPPUNIT_ASSERT_EQUAL(10, frame->GetEventCount(wxEVT_COMMAND_TEXT_UPDATED));
+ CPPUNIT_ASSERT_EQUAL(0, maxlen.GetCount());
+ CPPUNIT_ASSERT_EQUAL(10, updated.GetCount());
+
+ maxlen.Clear();
+ updated.Clear();
sim.Text("k");
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_TEXT_MAXLEN));
- CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount(wxEVT_COMMAND_TEXT_UPDATED));
+ CPPUNIT_ASSERT_EQUAL(1, maxlen.GetCount());
+ CPPUNIT_ASSERT_EQUAL(0, updated.GetCount());
+
+ maxlen.Clear();
+ updated.Clear();
m_text->SetMaxLength(0);
sim.Text("k");
wxYield();
- CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount(wxEVT_COMMAND_TEXT_MAXLEN));
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_TEXT_UPDATED));
+ CPPUNIT_ASSERT_EQUAL(0, maxlen.GetCount());
+ CPPUNIT_ASSERT_EQUAL(1, updated.GetCount());
#endif
}
wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE | wxTE_RICH | wxTE_AUTO_URL);
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_text, wxEVT_COMMAND_TEXT_URL);
+ EventCounter url(m_text, wxEVT_COMMAND_TEXT_URL);
m_text->AppendText("http://www.wxwidgets.org");
sim.MouseClick();
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(1, url.GetCount());
#endif
}
void TextEntryTestCase::TextChangeEvents()
{
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(GetTestWindow(), wxEVT_COMMAND_TEXT_UPDATED);
+ EventCounter updated(GetTestWindow(), wxEVT_COMMAND_TEXT_UPDATED);
wxTextEntry * const entry = GetTestEntry();
// notice that SetValue() generates an event even if the text didn't change
entry->SetValue("");
- CPPUNIT_ASSERT_EQUAL( 1, frame->GetEventCount() );
+ CPPUNIT_ASSERT_EQUAL( 1, updated.GetCount() );
+ updated.Clear();
entry->SetValue("foo");
- CPPUNIT_ASSERT_EQUAL( 1, frame->GetEventCount() );
+ CPPUNIT_ASSERT_EQUAL( 1, updated.GetCount() );
+ updated.Clear();
entry->SetValue("foo");
- CPPUNIT_ASSERT_EQUAL( 1, frame->GetEventCount() );
+ CPPUNIT_ASSERT_EQUAL( 1, updated.GetCount() );
+ updated.Clear();
entry->ChangeValue("bar");
- CPPUNIT_ASSERT_EQUAL( 0, frame->GetEventCount() );
+ CPPUNIT_ASSERT_EQUAL( 0, updated.GetCount() );
entry->AppendText("bar");
- CPPUNIT_ASSERT_EQUAL( 1, frame->GetEventCount() );
+ CPPUNIT_ASSERT_EQUAL( 1, updated.GetCount() );
+ updated.Clear();
entry->Replace(3, 6, "baz");
- CPPUNIT_ASSERT_EQUAL( 1, frame->GetEventCount() );
+ CPPUNIT_ASSERT_EQUAL( 1, updated.GetCount() );
+ updated.Clear();
entry->Remove(0, 3);
- CPPUNIT_ASSERT_EQUAL( 1, frame->GetEventCount() );
+ CPPUNIT_ASSERT_EQUAL( 1, updated.GetCount() );
+ updated.Clear();
entry->WriteText("foo");
- CPPUNIT_ASSERT_EQUAL( 1, frame->GetEventCount() );
+ CPPUNIT_ASSERT_EQUAL( 1, updated.GetCount() );
+ updated.Clear();
entry->Clear();
- CPPUNIT_ASSERT_EQUAL( 1, frame->GetEventCount() );
+ CPPUNIT_ASSERT_EQUAL( 1, updated.GetCount() );
+ updated.Clear();
}
void TextEntryTestCase::CheckStringSelection(const char *sel)
void TextEntryTestCase::Editable()
{
#if wxUSE_UIACTIONSIMULATOR
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
wxTextEntry * const entry = GetTestEntry();
wxWindow * const window = GetTestWindow();
- EventCounter count(window, wxEVT_COMMAND_TEXT_UPDATED);
+ EventCounter updated(window, wxEVT_COMMAND_TEXT_UPDATED);
window->SetFocus();
wxYield();
wxYield();
CPPUNIT_ASSERT_EQUAL("abcdef", entry->GetValue());
- CPPUNIT_ASSERT_EQUAL(6, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(6, updated.GetCount());
+
+ updated.Clear();
entry->SetEditable(false);
sim.Text("gh");
wxYield();
CPPUNIT_ASSERT_EQUAL("abcdef", entry->GetValue());
- CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(0, updated.GetCount());
#endif
}
void ToggleButtonTestCase::Click()
{
#if wxUSE_UIACTIONSIMULATOR
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_button, wxEVT_COMMAND_TOGGLEBUTTON_CLICKED);
+ EventCounter clicked(m_button, wxEVT_COMMAND_TOGGLEBUTTON_CLICKED);
wxUIActionSimulator sim;
sim.MouseClick();
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(1, clicked.GetCount());
CPPUNIT_ASSERT(m_button->GetValue());
+ clicked.Clear();
sim.MouseClick();
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(1, clicked.GetCount());
CPPUNIT_ASSERT(!m_button->GetValue());
#endif
}
void ToggleButtonTestCase::Value()
{
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_button, wxEVT_COMMAND_BUTTON_CLICKED);
+ EventCounter clicked(m_button, wxEVT_COMMAND_BUTTON_CLICKED);
m_button->SetValue(true);
CPPUNIT_ASSERT(!m_button->GetValue());
- CPPUNIT_ASSERT_EQUAL( 0, frame->GetEventCount() );
+ CPPUNIT_ASSERT_EQUAL( 0, clicked.GetCount() );
}
#endif //wxUSE_TOGGLEBTN
void TreeCtrlTestCase::ItemClick()
{
#if wxUSE_UIACTIONSIMULATOR
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_tree, wxEVT_COMMAND_TREE_ITEM_ACTIVATED);
- EventCounter count1(m_tree, wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK);
+ EventCounter activated(m_tree, wxEVT_COMMAND_TREE_ITEM_ACTIVATED);
+ EventCounter rclick(m_tree, wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK);
wxUIActionSimulator sim;
sim.MouseClick(wxMOUSE_BTN_RIGHT);
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_TREE_ITEM_ACTIVATED));
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK));
+ CPPUNIT_ASSERT_EQUAL(1, activated.GetCount());
+ CPPUNIT_ASSERT_EQUAL(1, rclick.GetCount());
#endif // wxUSE_UIACTIONSIMULATOR
}
void TreeCtrlTestCase::DeleteItem()
{
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_tree, wxEVT_COMMAND_TREE_DELETE_ITEM);
+ EventCounter deleteitem(m_tree, wxEVT_COMMAND_TREE_DELETE_ITEM);
wxTreeItemId todelete = m_tree->AppendItem(m_root, "deleteme");
m_tree->Delete(todelete);
// We do not test DeleteAllItems() as under some versions of Windows events
// are not generated.
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(1, deleteitem.GetCount());
}
#if wxUSE_UIACTIONSIMULATOR
void TreeCtrlTestCase::LabelEdit()
{
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_tree, wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT);
- EventCounter count1(m_tree, wxEVT_COMMAND_TREE_END_LABEL_EDIT);
+ EventCounter beginedit(m_tree, wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT);
+ EventCounter endedit(m_tree, wxEVT_COMMAND_TREE_END_LABEL_EDIT);
wxUIActionSimulator sim;
sim.Text("newroottext");
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(1, beginedit.GetCount());
sim.Char(WXK_RETURN);
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(1, endedit.GetCount());
}
void TreeCtrlTestCase::KeyDown()
{
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_tree, wxEVT_COMMAND_TREE_KEY_DOWN);
+ EventCounter keydown(m_tree, wxEVT_COMMAND_TREE_KEY_DOWN);
wxUIActionSimulator sim;
sim.Text("aAbB");
wxYield();
- CPPUNIT_ASSERT_EQUAL(6, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(6, keydown.GetCount());
}
#if !defined(__WXGTK__)
void TreeCtrlTestCase::CollapseExpandEvents()
{
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
m_tree->CollapseAll();
- EventCounter count(m_tree, wxEVT_COMMAND_TREE_ITEM_COLLAPSED);
- EventCounter count1(m_tree, wxEVT_COMMAND_TREE_ITEM_COLLAPSING);
- EventCounter count2(m_tree, wxEVT_COMMAND_TREE_ITEM_EXPANDED);
- EventCounter count3(m_tree, wxEVT_COMMAND_TREE_ITEM_EXPANDING);
+ EventCounter collapsed(m_tree, wxEVT_COMMAND_TREE_ITEM_COLLAPSED);
+ EventCounter collapsing(m_tree, wxEVT_COMMAND_TREE_ITEM_COLLAPSING);
+ EventCounter expanded(m_tree, wxEVT_COMMAND_TREE_ITEM_EXPANDED);
+ EventCounter expanding(m_tree, wxEVT_COMMAND_TREE_ITEM_EXPANDING);
wxUIActionSimulator sim;
sim.MouseDblClick();
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_TREE_ITEM_EXPANDING));
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_TREE_ITEM_EXPANDED));
+ CPPUNIT_ASSERT_EQUAL(1, expanding.GetCount());
+ CPPUNIT_ASSERT_EQUAL(1, expanded.GetCount());
sim.MouseDblClick();
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_TREE_ITEM_COLLAPSING));
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_TREE_ITEM_COLLAPSED));
+ CPPUNIT_ASSERT_EQUAL(1, collapsing.GetCount());
+ CPPUNIT_ASSERT_EQUAL(1, collapsed.GetCount());
}
void TreeCtrlTestCase::SelectionChange()
{
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
m_tree->ExpandAll();
m_tree->UnselectAll();
- EventCounter count(m_tree, wxEVT_COMMAND_TREE_SEL_CHANGED);
- EventCounter count1(m_tree, wxEVT_COMMAND_TREE_SEL_CHANGING);
+ EventCounter changed(m_tree, wxEVT_COMMAND_TREE_SEL_CHANGED);
+ EventCounter changing(m_tree, wxEVT_COMMAND_TREE_SEL_CHANGING);
wxUIActionSimulator sim;
sim.MouseClick();
wxYield();
- CPPUNIT_ASSERT_EQUAL(2, frame->GetEventCount(wxEVT_COMMAND_TREE_SEL_CHANGED));
- CPPUNIT_ASSERT_EQUAL(2, frame->GetEventCount(wxEVT_COMMAND_TREE_SEL_CHANGING));
+ CPPUNIT_ASSERT_EQUAL(2, changed.GetCount());
+ CPPUNIT_ASSERT_EQUAL(2, changing.GetCount());
}
#endif // !__WXGTK__
void TreeCtrlTestCase::Menu()
{
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_tree, wxEVT_COMMAND_TREE_ITEM_MENU);
+ EventCounter menu(m_tree, wxEVT_COMMAND_TREE_ITEM_MENU);
wxUIActionSimulator sim;
wxRect pos;
sim.MouseClick(wxMOUSE_BTN_RIGHT);
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_TREE_ITEM_MENU));
+ CPPUNIT_ASSERT_EQUAL(1, menu.GetCount());
}
#endif // wxUSE_UIACTIONSIMULATOR
void WindowTestCase::ShowHideEvent()
{
#if defined(__WXMSW__) || defined (__WXPM__)
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_window, wxEVT_SHOW);
+ EventCounter show(m_window, wxEVT_SHOW);
CPPUNIT_ASSERT(m_window->IsShown());
CPPUNIT_ASSERT(m_window->IsShown());
- CPPUNIT_ASSERT_EQUAL(2, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(2, show.GetCount());
#endif
}
void WindowTestCase::KeyEvent()
{
#if wxUSE_UIACTIONSIMULATOR
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_window, wxEVT_KEY_DOWN);
- EventCounter count1(m_window, wxEVT_KEY_UP);
- EventCounter count2(m_window, wxEVT_CHAR);
+ EventCounter keydown(m_window, wxEVT_KEY_DOWN);
+ EventCounter keyup(m_window, wxEVT_KEY_UP);
+ EventCounter keychar(m_window, wxEVT_CHAR);
wxUIActionSimulator sim;
sim.Char(WXK_SHIFT);
wxYield();
- CPPUNIT_ASSERT_EQUAL(5, frame->GetEventCount(wxEVT_KEY_DOWN));
- CPPUNIT_ASSERT_EQUAL(5, frame->GetEventCount(wxEVT_KEY_UP));
- CPPUNIT_ASSERT_EQUAL(4, frame->GetEventCount(wxEVT_CHAR));
+ CPPUNIT_ASSERT_EQUAL(5, keydown.GetCount());
+ CPPUNIT_ASSERT_EQUAL(5, keyup.GetCount());
+ CPPUNIT_ASSERT_EQUAL(4, keychar.GetCount());
#endif
}
void WindowTestCase::FocusEvent()
{
#ifndef __WXOSX__
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count(m_window, wxEVT_SET_FOCUS);
- EventCounter count1(m_window, wxEVT_KILL_FOCUS);
+ EventCounter setfocus(m_window, wxEVT_SET_FOCUS);
+ EventCounter killfocus(m_window, wxEVT_KILL_FOCUS);
m_window->SetFocus();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_SET_FOCUS));
+ CPPUNIT_ASSERT_EQUAL(1, setfocus.GetCount());
CPPUNIT_ASSERT(m_window->HasFocus());
wxButton* button = new wxButton(wxTheApp->GetTopWindow(), wxID_ANY);
button->SetFocus();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_KILL_FOCUS));
+ CPPUNIT_ASSERT_EQUAL(1, killfocus.GetCount());
CPPUNIT_ASSERT(!m_window->HasFocus());
#endif
}
#if wxUSE_UIACTIONSIMULATOR
void HtmlWindowTestCase::CellClick()
{
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count1(m_win, wxEVT_COMMAND_HTML_CELL_CLICKED);
+ EventCounter clicked(m_win, wxEVT_COMMAND_HTML_CELL_CLICKED);
wxUIActionSimulator sim;
sim.MouseClick();
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(1, clicked.GetCount());
}
void HtmlWindowTestCase::LinkClick()
{
- wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
-
- EventCounter count1(m_win, wxEVT_COMMAND_HTML_LINK_CLICKED);
+ EventCounter clicked(m_win, wxEVT_COMMAND_HTML_LINK_CLICKED);
wxUIActionSimulator sim;
sim.MouseClick();
wxYield();
- CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
+ CPPUNIT_ASSERT_EQUAL(1, clicked.GetCount());
}
#endif // wxUSE_UIACTIONSIMULATOR
int wxTestableFrame::GetEventCount(wxEventType type)
{
- if (type == wxEVT_ANY)
- {
- //Get the total event count
- long total = 0;
-
- for(wxLongToLongHashMap::iterator iter = m_count.begin();
- iter != m_count.end();
- iter++)
- {
- total += iter->second;
- iter->second = 0;
- }
-
- return total;
- }
- else
- {
- long count = m_count[type];
- m_count[type] = 0;
- return count;
- }
+ return m_count[type];
}
void wxTestableFrame::ClearEventCount(wxEventType type)
m_win(win)
{
- m_frame = wxStaticCast(wxTheApp->GetTopWindow(),
- wxTestableFrame);
+ m_frame = wxStaticCast(wxTheApp->GetTopWindow(), wxTestableFrame);
- m_win->Connect(m_type,
- wxEventHandler(wxTestableFrame::OnEvent),
- NULL,
- m_frame);
+ m_win->Connect(m_type, wxEventHandler(wxTestableFrame::OnEvent),
+ NULL, m_frame);
}
EventCounter::~EventCounter()
{
- m_win->Disconnect(m_type,
- wxEventHandler(wxTestableFrame::OnEvent),
- NULL,
- m_frame);
+ m_win->Disconnect(m_type, wxEventHandler(wxTestableFrame::OnEvent),
+ NULL, m_frame);
//This stops spurious counts from previous tests
- m_frame->ClearEventCount(m_type);
+ Clear();
m_frame = NULL;
m_win = NULL;
void OnEvent(wxEvent& evt);
- //wxEVT_ANY get the count for all events or a type can be specified
- int GetEventCount(wxEventType type = wxEVT_ANY);
+private:
+ friend class EventCounter;
- //Used to clear an event count, after disconnecting a counter for example
+ int GetEventCount(wxEventType type);
void ClearEventCount(wxEventType type);
-private:
wxLongToLongHashMap m_count;
};
EventCounter(wxWindow* win, wxEventType type);
~EventCounter();
+ int GetCount() { return m_frame->GetEventCount(m_type); }
+ void Clear() { m_frame->ClearEventCount(m_type); }
+
private:
wxEventType m_type;
wxTestableFrame* m_frame;