Move getting the unit test event count from wxTestableFrame to the EventCounter class. This reduces the need to have wxTestableFrame pointers all over the unit testing code and should reduce bugs caused by counting the wrong events.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70871 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -74,10 +74,7 @@ void BitmapToggleButtonTestCase::tearDown()
|
|||||||
void BitmapToggleButtonTestCase::Click()
|
void BitmapToggleButtonTestCase::Click()
|
||||||
{
|
{
|
||||||
#if wxUSE_UIACTIONSIMULATOR
|
#if wxUSE_UIACTIONSIMULATOR
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter clicked(m_button, wxEVT_COMMAND_TOGGLEBUTTON_CLICKED);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count(m_button, wxEVT_COMMAND_TOGGLEBUTTON_CLICKED);
|
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -88,25 +85,23 @@ void BitmapToggleButtonTestCase::Click()
|
|||||||
sim.MouseClick();
|
sim.MouseClick();
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(1, clicked.GetCount());
|
||||||
CPPUNIT_ASSERT(m_button->GetValue());
|
CPPUNIT_ASSERT(m_button->GetValue());
|
||||||
|
|
||||||
|
clicked.Clear();
|
||||||
wxMilliSleep(1000);
|
wxMilliSleep(1000);
|
||||||
|
|
||||||
sim.MouseClick();
|
sim.MouseClick();
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(1, clicked.GetCount());
|
||||||
CPPUNIT_ASSERT(!m_button->GetValue());
|
CPPUNIT_ASSERT(!m_button->GetValue());
|
||||||
#endif // wxUSE_UIACTIONSIMULATOR
|
#endif // wxUSE_UIACTIONSIMULATOR
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitmapToggleButtonTestCase::Value()
|
void BitmapToggleButtonTestCase::Value()
|
||||||
{
|
{
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter clicked(m_button, wxEVT_COMMAND_BUTTON_CLICKED);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count(m_button, wxEVT_COMMAND_BUTTON_CLICKED);
|
|
||||||
|
|
||||||
m_button->SetValue(true);
|
m_button->SetValue(true);
|
||||||
|
|
||||||
@@ -116,7 +111,7 @@ void BitmapToggleButtonTestCase::Value()
|
|||||||
|
|
||||||
CPPUNIT_ASSERT(!m_button->GetValue());
|
CPPUNIT_ASSERT(!m_button->GetValue());
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL( 0, frame->GetEventCount() );
|
CPPUNIT_ASSERT_EQUAL( 0, clicked.GetCount() );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxHAS_BITMAPTOGGLEBUTTON
|
#endif // wxHAS_BITMAPTOGGLEBUTTON
|
||||||
|
@@ -122,35 +122,36 @@ void BookCtrlBaseTestCase::PageManagement()
|
|||||||
|
|
||||||
void BookCtrlBaseTestCase::ChangeEvents()
|
void BookCtrlBaseTestCase::ChangeEvents()
|
||||||
{
|
{
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
wxBookCtrlBase * const base = GetBase();
|
wxBookCtrlBase * const base = GetBase();
|
||||||
|
|
||||||
base->SetSelection(0);
|
base->SetSelection(0);
|
||||||
|
|
||||||
EventCounter count(base, GetChangingEvent());
|
EventCounter changing(base, GetChangingEvent());
|
||||||
EventCounter count1(base, GetChangedEvent());
|
EventCounter changed(base, GetChangedEvent());
|
||||||
|
|
||||||
base->SetSelection(1);
|
base->SetSelection(1);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(GetChangingEvent()));
|
CPPUNIT_ASSERT_EQUAL(1, changing.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(GetChangedEvent()));
|
CPPUNIT_ASSERT_EQUAL(1, changed.GetCount());
|
||||||
|
|
||||||
|
changed.Clear();
|
||||||
|
changing.Clear();
|
||||||
base->ChangeSelection(2);
|
base->ChangeSelection(2);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount(GetChangingEvent()));
|
CPPUNIT_ASSERT_EQUAL(0, changing.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount(GetChangedEvent()));
|
CPPUNIT_ASSERT_EQUAL(0, changed.GetCount());
|
||||||
|
|
||||||
base->AdvanceSelection();
|
base->AdvanceSelection();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(GetChangingEvent()));
|
CPPUNIT_ASSERT_EQUAL(1, changing.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(GetChangedEvent()));
|
CPPUNIT_ASSERT_EQUAL(1, changed.GetCount());
|
||||||
|
|
||||||
|
changed.Clear();
|
||||||
|
changing.Clear();
|
||||||
base->AdvanceSelection(false);
|
base->AdvanceSelection(false);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(GetChangingEvent()));
|
CPPUNIT_ASSERT_EQUAL(1, changing.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(GetChangedEvent()));
|
CPPUNIT_ASSERT_EQUAL(1, changed.GetCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
void BookCtrlBaseTestCase::Image()
|
void BookCtrlBaseTestCase::Image()
|
||||||
|
@@ -80,12 +80,9 @@ void ButtonTestCase::tearDown()
|
|||||||
|
|
||||||
void ButtonTestCase::Click()
|
void ButtonTestCase::Click()
|
||||||
{
|
{
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
//We use the internal class EventCounter which handles connecting and
|
//We use the internal class EventCounter which handles connecting and
|
||||||
//disconnecting the control to the wxTestableFrame
|
//disconnecting the control to the wxTestableFrame
|
||||||
EventCounter count(m_button, wxEVT_COMMAND_BUTTON_CLICKED);
|
EventCounter clicked(m_button, wxEVT_COMMAND_BUTTON_CLICKED);
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -97,15 +94,12 @@ void ButtonTestCase::Click()
|
|||||||
sim.MouseClick();
|
sim.MouseClick();
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL( 1, frame->GetEventCount() );
|
CPPUNIT_ASSERT_EQUAL( 1, clicked.GetCount() );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ButtonTestCase::Disabled()
|
void ButtonTestCase::Disabled()
|
||||||
{
|
{
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter clicked(m_button, wxEVT_COMMAND_BUTTON_CLICKED);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count(m_button, wxEVT_COMMAND_BUTTON_CLICKED);
|
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -118,7 +112,7 @@ void ButtonTestCase::Disabled()
|
|||||||
sim.MouseClick();
|
sim.MouseClick();
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL( 0, frame->GetEventCount() );
|
CPPUNIT_ASSERT_EQUAL( 0, clicked.GetCount() );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_UIACTIONSIMULATOR
|
#endif // wxUSE_UIACTIONSIMULATOR
|
||||||
|
@@ -83,10 +83,7 @@ void CheckBoxTestCase::tearDown()
|
|||||||
|
|
||||||
void CheckBoxTestCase::Check()
|
void CheckBoxTestCase::Check()
|
||||||
{
|
{
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter clicked(m_check, wxEVT_COMMAND_CHECKBOX_CLICKED);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count(m_check, wxEVT_COMMAND_CHECKBOX_CLICKED);
|
|
||||||
|
|
||||||
//We should be unchecked by default
|
//We should be unchecked by default
|
||||||
CPPUNIT_ASSERT(!m_check->IsChecked());
|
CPPUNIT_ASSERT(!m_check->IsChecked());
|
||||||
@@ -108,7 +105,7 @@ void CheckBoxTestCase::Check()
|
|||||||
CPPUNIT_ASSERT(!m_check->IsChecked());
|
CPPUNIT_ASSERT(!m_check->IsChecked());
|
||||||
|
|
||||||
//None of these should send events
|
//None of these should send events
|
||||||
CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(0, clicked.GetCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef wxHAS_3STATE_CHECKBOX
|
#ifdef wxHAS_3STATE_CHECKBOX
|
||||||
|
@@ -65,10 +65,7 @@ void CheckListBoxTestCase::tearDown()
|
|||||||
|
|
||||||
void CheckListBoxTestCase::Check()
|
void CheckListBoxTestCase::Check()
|
||||||
{
|
{
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter toggled(m_check, wxEVT_COMMAND_CHECKLISTBOX_TOGGLED);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count(m_check, wxEVT_COMMAND_CHECKLISTBOX_TOGGLED);
|
|
||||||
|
|
||||||
wxArrayString testitems;
|
wxArrayString testitems;
|
||||||
testitems.Add("item 0");
|
testitems.Add("item 0");
|
||||||
@@ -83,7 +80,7 @@ void CheckListBoxTestCase::Check()
|
|||||||
m_check->Check(1, false);
|
m_check->Check(1, false);
|
||||||
|
|
||||||
//We should not get any events when changing this from code
|
//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(true, m_check->IsChecked(0));
|
||||||
CPPUNIT_ASSERT_EQUAL(false, m_check->IsChecked(1));
|
CPPUNIT_ASSERT_EQUAL(false, m_check->IsChecked(1));
|
||||||
|
|
||||||
|
@@ -129,17 +129,14 @@ void ComboBoxTestCase::Size()
|
|||||||
void ComboBoxTestCase::PopDismiss()
|
void ComboBoxTestCase::PopDismiss()
|
||||||
{
|
{
|
||||||
#if defined(__WXMSW__) || defined(__WXGTK210__)
|
#if defined(__WXMSW__) || defined(__WXGTK210__)
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter drop(m_combo, wxEVT_COMMAND_COMBOBOX_DROPDOWN);
|
||||||
wxTestableFrame);
|
EventCounter close(m_combo, wxEVT_COMMAND_COMBOBOX_CLOSEUP);
|
||||||
|
|
||||||
EventCounter count(m_combo, wxEVT_COMMAND_COMBOBOX_DROPDOWN);
|
|
||||||
EventCounter count1(m_combo, wxEVT_COMMAND_COMBOBOX_CLOSEUP);
|
|
||||||
|
|
||||||
m_combo->Popup();
|
m_combo->Popup();
|
||||||
m_combo->Dismiss();
|
m_combo->Dismiss();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_COMBOBOX_DROPDOWN));
|
CPPUNIT_ASSERT_EQUAL(1, drop.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_COMBOBOX_CLOSEUP));
|
CPPUNIT_ASSERT_EQUAL(1, close.GetCount());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -62,26 +62,20 @@ void FrameTestCase::tearDown()
|
|||||||
void FrameTestCase::Iconize()
|
void FrameTestCase::Iconize()
|
||||||
{
|
{
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
wxTestableFrame* testframe = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter iconize(m_frame, wxEVT_ICONIZE);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count(m_frame, wxEVT_ICONIZE);
|
|
||||||
|
|
||||||
m_frame->Iconize();
|
m_frame->Iconize();
|
||||||
m_frame->Iconize(false);
|
m_frame->Iconize(false);
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(2, testframe->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(2, iconize.GetCount());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameTestCase::Close()
|
void FrameTestCase::Close()
|
||||||
{
|
{
|
||||||
wxTestableFrame* testframe = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter close(m_frame, wxEVT_CLOSE_WINDOW);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count(m_frame, wxEVT_CLOSE_WINDOW);
|
|
||||||
|
|
||||||
m_frame->Close();
|
m_frame->Close();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, testframe->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(1, close.GetCount());
|
||||||
}
|
}
|
||||||
|
@@ -126,12 +126,9 @@ void GridTestCase::tearDown()
|
|||||||
void GridTestCase::CellEdit()
|
void GridTestCase::CellEdit()
|
||||||
{
|
{
|
||||||
#if wxUSE_UIACTIONSIMULATOR
|
#if wxUSE_UIACTIONSIMULATOR
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter changing(m_grid, wxEVT_GRID_CELL_CHANGING);
|
||||||
wxTestableFrame);
|
EventCounter changed(m_grid, wxEVT_GRID_CELL_CHANGED);
|
||||||
|
EventCounter created(m_grid, wxEVT_GRID_EDITOR_CREATED);
|
||||||
EventCounter count(m_grid, wxEVT_GRID_CELL_CHANGING);
|
|
||||||
EventCounter count1(m_grid, wxEVT_GRID_CELL_CHANGED);
|
|
||||||
EventCounter count2(m_grid, wxEVT_GRID_EDITOR_CREATED);
|
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -144,31 +141,28 @@ void GridTestCase::CellEdit()
|
|||||||
|
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_EDITOR_CREATED));
|
CPPUNIT_ASSERT_EQUAL(1, created.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_CELL_CHANGING));
|
CPPUNIT_ASSERT_EQUAL(1, changing.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_CELL_CHANGED));
|
CPPUNIT_ASSERT_EQUAL(1, changed.GetCount());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void GridTestCase::CellClick()
|
void GridTestCase::CellClick()
|
||||||
{
|
{
|
||||||
#if wxUSE_UIACTIONSIMULATOR
|
#if wxUSE_UIACTIONSIMULATOR
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter lclick(m_grid, wxEVT_GRID_CELL_LEFT_CLICK);
|
||||||
wxTestableFrame);
|
EventCounter ldclick(m_grid, wxEVT_GRID_CELL_LEFT_DCLICK);
|
||||||
|
EventCounter rclick(m_grid, wxEVT_GRID_CELL_RIGHT_CLICK);
|
||||||
EventCounter count(m_grid, wxEVT_GRID_CELL_LEFT_CLICK);
|
EventCounter rdclick(m_grid, wxEVT_GRID_CELL_RIGHT_DCLICK);
|
||||||
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);
|
|
||||||
|
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
wxRect rect = m_grid->CellToRect(0, 0);
|
wxRect rect = m_grid->CellToRect(0, 0);
|
||||||
wxPoint point = m_grid->CalcScrolledPosition(rect.GetPosition());
|
wxPoint point = m_grid->CalcScrolledPosition(rect.GetPosition());
|
||||||
point = frame->ClientToScreen(point + wxPoint(m_grid->GetRowLabelSize(),
|
point = m_grid->ClientToScreen(point + wxPoint(m_grid->GetRowLabelSize(),
|
||||||
m_grid->GetColLabelSize())
|
m_grid->GetColLabelSize())
|
||||||
+ wxPoint(2, 2));
|
+ wxPoint(2, 2));
|
||||||
|
|
||||||
sim.MouseMove(point);
|
sim.MouseMove(point);
|
||||||
wxYield();
|
wxYield();
|
||||||
@@ -176,44 +170,43 @@ void GridTestCase::CellClick()
|
|||||||
sim.MouseClick();
|
sim.MouseClick();
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_CELL_LEFT_CLICK));
|
CPPUNIT_ASSERT_EQUAL(1, lclick.GetCount());
|
||||||
|
lclick.Clear();
|
||||||
|
|
||||||
sim.MouseDblClick();
|
sim.MouseDblClick();
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
//A double click event sends a single click event first
|
//A double click event sends a single click event first
|
||||||
//test to ensure this still happens in the future
|
//test to ensure this still happens in the future
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_CELL_LEFT_CLICK));
|
CPPUNIT_ASSERT_EQUAL(1, lclick.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_CELL_LEFT_DCLICK));
|
CPPUNIT_ASSERT_EQUAL(1, ldclick.GetCount());
|
||||||
|
|
||||||
sim.MouseClick(wxMOUSE_BTN_RIGHT);
|
sim.MouseClick(wxMOUSE_BTN_RIGHT);
|
||||||
wxYield();
|
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);
|
sim.MouseDblClick(wxMOUSE_BTN_RIGHT);
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_CELL_RIGHT_CLICK));
|
CPPUNIT_ASSERT_EQUAL(1, rclick.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_CELL_RIGHT_DCLICK));
|
CPPUNIT_ASSERT_EQUAL(1, rdclick.GetCount());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void GridTestCase::CellSelect()
|
void GridTestCase::CellSelect()
|
||||||
{
|
{
|
||||||
#if wxUSE_UIACTIONSIMULATOR
|
#if wxUSE_UIACTIONSIMULATOR
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter cell(m_grid, wxEVT_GRID_SELECT_CELL);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count(m_grid, wxEVT_GRID_SELECT_CELL);
|
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
wxRect rect = m_grid->CellToRect(0, 0);
|
wxRect rect = m_grid->CellToRect(0, 0);
|
||||||
wxPoint point = m_grid->CalcScrolledPosition(rect.GetPosition());
|
wxPoint point = m_grid->CalcScrolledPosition(rect.GetPosition());
|
||||||
point = frame->ClientToScreen(point + wxPoint(m_grid->GetRowLabelSize(),
|
point = m_grid->ClientToScreen(point + wxPoint(m_grid->GetRowLabelSize(),
|
||||||
m_grid->GetColLabelSize())
|
m_grid->GetColLabelSize())
|
||||||
+ wxPoint(4, 4));
|
+ wxPoint(4, 4));
|
||||||
|
|
||||||
sim.MouseMove(point);
|
sim.MouseMove(point);
|
||||||
wxYield();
|
wxYield();
|
||||||
@@ -221,7 +214,9 @@ void GridTestCase::CellSelect()
|
|||||||
sim.MouseClick();
|
sim.MouseClick();
|
||||||
wxYield();
|
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->SetGridCursor(1, 1);
|
||||||
m_grid->GoToCell(1, 0);
|
m_grid->GoToCell(1, 0);
|
||||||
@@ -232,20 +227,17 @@ void GridTestCase::CellSelect()
|
|||||||
sim.MouseDblClick();
|
sim.MouseDblClick();
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(3, frame->GetEventCount(wxEVT_GRID_SELECT_CELL));
|
CPPUNIT_ASSERT_EQUAL(3, cell.GetCount());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void GridTestCase::LabelClick()
|
void GridTestCase::LabelClick()
|
||||||
{
|
{
|
||||||
#if wxUSE_UIACTIONSIMULATOR
|
#if wxUSE_UIACTIONSIMULATOR
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter lclick(m_grid, wxEVT_GRID_LABEL_LEFT_CLICK);
|
||||||
wxTestableFrame);
|
EventCounter ldclick(m_grid, wxEVT_GRID_LABEL_LEFT_DCLICK);
|
||||||
|
EventCounter rclick(m_grid, wxEVT_GRID_LABEL_RIGHT_CLICK);
|
||||||
EventCounter count(m_grid, wxEVT_GRID_LABEL_LEFT_CLICK);
|
EventCounter rdclick(m_grid, wxEVT_GRID_LABEL_RIGHT_DCLICK);
|
||||||
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);
|
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -258,17 +250,18 @@ void GridTestCase::LabelClick()
|
|||||||
sim.MouseClick();
|
sim.MouseClick();
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_LABEL_LEFT_CLICK));
|
CPPUNIT_ASSERT_EQUAL(1, lclick.GetCount());
|
||||||
|
|
||||||
sim.MouseDblClick();
|
sim.MouseDblClick();
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_LABEL_LEFT_DCLICK));
|
CPPUNIT_ASSERT_EQUAL(1, ldclick.GetCount());
|
||||||
|
|
||||||
sim.MouseClick(wxMOUSE_BTN_RIGHT);
|
sim.MouseClick(wxMOUSE_BTN_RIGHT);
|
||||||
wxYield();
|
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);
|
sim.MouseDblClick(wxMOUSE_BTN_RIGHT);
|
||||||
wxYield();
|
wxYield();
|
||||||
@@ -277,12 +270,12 @@ void GridTestCase::LabelClick()
|
|||||||
{
|
{
|
||||||
//Right double click not supported with native headers so we get two
|
//Right double click not supported with native headers so we get two
|
||||||
//right click events
|
//right click events
|
||||||
CPPUNIT_ASSERT_EQUAL(2, frame->GetEventCount(wxEVT_GRID_LABEL_RIGHT_CLICK));
|
CPPUNIT_ASSERT_EQUAL(2, rclick.GetCount());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_LABEL_RIGHT_CLICK));
|
CPPUNIT_ASSERT_EQUAL(1, rclick.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_LABEL_RIGHT_DCLICK));
|
CPPUNIT_ASSERT_EQUAL(1, rdclick.GetCount());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -292,10 +285,7 @@ void GridTestCase::SortClick()
|
|||||||
#if wxUSE_UIACTIONSIMULATOR
|
#if wxUSE_UIACTIONSIMULATOR
|
||||||
m_grid->SetSortingColumn(0);
|
m_grid->SetSortingColumn(0);
|
||||||
|
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter sort(m_grid, wxEVT_GRID_COL_SORT);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count(m_grid, wxEVT_GRID_COL_SORT);
|
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -308,18 +298,15 @@ void GridTestCase::SortClick()
|
|||||||
sim.MouseClick();
|
sim.MouseClick();
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(1, sort.GetCount());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void GridTestCase::Size()
|
void GridTestCase::Size()
|
||||||
{
|
{
|
||||||
#if wxUSE_UIACTIONSIMULATOR && !defined(__WXGTK__)
|
#if wxUSE_UIACTIONSIMULATOR && !defined(__WXGTK__)
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter colsize(m_grid, wxEVT_GRID_COL_SIZE);
|
||||||
wxTestableFrame);
|
EventCounter rowsize(m_grid, wxEVT_GRID_ROW_SIZE);
|
||||||
|
|
||||||
EventCounter count(m_grid, wxEVT_GRID_COL_SIZE);
|
|
||||||
EventCounter count1(m_grid, wxEVT_GRID_ROW_SIZE);
|
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -338,7 +325,7 @@ void GridTestCase::Size()
|
|||||||
sim.MouseUp();
|
sim.MouseUp();
|
||||||
wxYield();
|
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() +
|
pt = m_grid->ClientToScreen(wxPoint(5, m_grid->GetColLabelSize() +
|
||||||
m_grid->GetRowSize(0)));
|
m_grid->GetRowSize(0)));
|
||||||
@@ -346,17 +333,14 @@ void GridTestCase::Size()
|
|||||||
sim.MouseDragDrop(pt.x, pt.y, pt.x, pt.y + 50);
|
sim.MouseDragDrop(pt.x, pt.y, pt.x, pt.y + 50);
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_ROW_SIZE));
|
CPPUNIT_ASSERT_EQUAL(1, rowsize.GetCount());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void GridTestCase::RangeSelect()
|
void GridTestCase::RangeSelect()
|
||||||
{
|
{
|
||||||
#if wxUSE_UIACTIONSIMULATOR
|
#if wxUSE_UIACTIONSIMULATOR
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter select(m_grid, wxEVT_GRID_RANGE_SELECT);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count(m_grid, wxEVT_GRID_RANGE_SELECT);
|
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -377,7 +361,7 @@ void GridTestCase::RangeSelect()
|
|||||||
sim.MouseUp();
|
sim.MouseUp();
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_GRID_RANGE_SELECT));
|
CPPUNIT_ASSERT_EQUAL(1, select.GetCount());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -656,11 +640,8 @@ void GridTestCase::CellFormatting()
|
|||||||
void GridTestCase::Editable()
|
void GridTestCase::Editable()
|
||||||
{
|
{
|
||||||
#if wxUSE_UIACTIONSIMULATOR
|
#if wxUSE_UIACTIONSIMULATOR
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
//As the grid is not editable we shouldn't create an editor
|
//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;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -680,18 +661,15 @@ void GridTestCase::Editable()
|
|||||||
sim.Char(WXK_RETURN);
|
sim.Char(WXK_RETURN);
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(0, created.GetCount());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void GridTestCase::ReadOnly()
|
void GridTestCase::ReadOnly()
|
||||||
{
|
{
|
||||||
#if wxUSE_UIACTIONSIMULATOR
|
#if wxUSE_UIACTIONSIMULATOR
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
//As the cell is readonly we shouldn't create an editor
|
//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;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -714,7 +692,7 @@ void GridTestCase::ReadOnly()
|
|||||||
sim.Char(WXK_RETURN);
|
sim.Char(WXK_RETURN);
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(0, created.GetCount());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -94,10 +94,7 @@ void HyperlinkCtrlTestCase::Url()
|
|||||||
void HyperlinkCtrlTestCase::Click()
|
void HyperlinkCtrlTestCase::Click()
|
||||||
{
|
{
|
||||||
#if wxUSE_UIACTIONSIMULATOR && !defined(__WXGTK__)
|
#if wxUSE_UIACTIONSIMULATOR && !defined(__WXGTK__)
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter hyperlink(m_hyperlink, wxEVT_COMMAND_HYPERLINK);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count(m_hyperlink, wxEVT_COMMAND_HYPERLINK);
|
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -107,7 +104,7 @@ void HyperlinkCtrlTestCase::Click()
|
|||||||
sim.MouseClick();
|
sim.MouseClick();
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(1, hyperlink.GetCount());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -187,9 +187,6 @@ void ListBaseTestCase::ItemClick()
|
|||||||
if ( wxGetUserId().Lower().Matches("buildslave*") )
|
if ( wxGetUserId().Lower().Matches("buildslave*") )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
wxListCtrl* const list = GetList();
|
wxListCtrl* const list = GetList();
|
||||||
|
|
||||||
list->InsertColumn(0, "Column 0", wxLIST_FORMAT_LEFT, 60);
|
list->InsertColumn(0, "Column 0", wxLIST_FORMAT_LEFT, 60);
|
||||||
@@ -200,10 +197,10 @@ void ListBaseTestCase::ItemClick()
|
|||||||
list->SetItem(0, 1, "first column");
|
list->SetItem(0, 1, "first column");
|
||||||
list->SetItem(0, 2, "second column");
|
list->SetItem(0, 2, "second column");
|
||||||
|
|
||||||
EventCounter count(list, wxEVT_COMMAND_LIST_ITEM_SELECTED);
|
EventCounter selected(list, wxEVT_COMMAND_LIST_ITEM_SELECTED);
|
||||||
EventCounter count1(list, wxEVT_COMMAND_LIST_ITEM_FOCUSED);
|
EventCounter focused(list, wxEVT_COMMAND_LIST_ITEM_FOCUSED);
|
||||||
EventCounter count2(list, wxEVT_COMMAND_LIST_ITEM_ACTIVATED);
|
EventCounter activated(list, wxEVT_COMMAND_LIST_ITEM_ACTIVATED);
|
||||||
EventCounter count3(list, wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK);
|
EventCounter rclick(list, wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK);
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -227,10 +224,10 @@ void ListBaseTestCase::ItemClick()
|
|||||||
|
|
||||||
// when the first item was selected the focus changes to it, but not
|
// when the first item was selected the focus changes to it, but not
|
||||||
// on subsequent clicks
|
// on subsequent clicks
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_LIST_ITEM_FOCUSED));
|
CPPUNIT_ASSERT_EQUAL(1, focused.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_LIST_ITEM_SELECTED));
|
CPPUNIT_ASSERT_EQUAL(1, selected.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_LIST_ITEM_ACTIVATED));
|
CPPUNIT_ASSERT_EQUAL(1, activated.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK));
|
CPPUNIT_ASSERT_EQUAL(1, rclick.GetCount());
|
||||||
|
|
||||||
//tidy up when we are finished
|
//tidy up when we are finished
|
||||||
list->ClearAll();
|
list->ClearAll();
|
||||||
@@ -240,12 +237,9 @@ void ListBaseTestCase::ItemClick()
|
|||||||
void ListBaseTestCase::KeyDown()
|
void ListBaseTestCase::KeyDown()
|
||||||
{
|
{
|
||||||
#if wxUSE_UIACTIONSIMULATOR
|
#if wxUSE_UIACTIONSIMULATOR
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
wxListCtrl* const list = GetList();
|
wxListCtrl* const list = GetList();
|
||||||
|
|
||||||
EventCounter count(list, wxEVT_COMMAND_LIST_KEY_DOWN);
|
EventCounter keydown(list, wxEVT_COMMAND_LIST_KEY_DOWN);
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -253,20 +247,17 @@ void ListBaseTestCase::KeyDown()
|
|||||||
sim.Text("aAbB");
|
sim.Text("aAbB");
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(6, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(6, keydown.GetCount());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListBaseTestCase::DeleteItems()
|
void ListBaseTestCase::DeleteItems()
|
||||||
{
|
{
|
||||||
#ifndef __WXOSX__
|
#ifndef __WXOSX__
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
wxListCtrl* const list = GetList();
|
wxListCtrl* const list = GetList();
|
||||||
|
|
||||||
EventCounter count(list, wxEVT_COMMAND_LIST_DELETE_ITEM);
|
EventCounter deleteitem(list, wxEVT_COMMAND_LIST_DELETE_ITEM);
|
||||||
EventCounter count1(list, wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS);
|
EventCounter deleteall(list, wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS);
|
||||||
|
|
||||||
|
|
||||||
list->InsertColumn(0, "Column 0", wxLIST_FORMAT_LEFT, 60);
|
list->InsertColumn(0, "Column 0", wxLIST_FORMAT_LEFT, 60);
|
||||||
@@ -294,19 +285,16 @@ void ListBaseTestCase::DeleteItems()
|
|||||||
list->ClearAll();
|
list->ClearAll();
|
||||||
list->DeleteAllItems();
|
list->DeleteAllItems();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(2, frame->GetEventCount(wxEVT_COMMAND_LIST_DELETE_ITEM));
|
CPPUNIT_ASSERT_EQUAL(2, deleteitem.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(2, frame->GetEventCount(wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS));
|
CPPUNIT_ASSERT_EQUAL(2, deleteall.GetCount());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListBaseTestCase::InsertItem()
|
void ListBaseTestCase::InsertItem()
|
||||||
{
|
{
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
wxListCtrl* const list = GetList();
|
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->InsertColumn(0, "Column 0", wxLIST_FORMAT_LEFT, 60);
|
||||||
|
|
||||||
@@ -317,7 +305,7 @@ void ListBaseTestCase::InsertItem()
|
|||||||
list->InsertItem(item);
|
list->InsertItem(item);
|
||||||
list->InsertItem(1, "more text");
|
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()
|
void ListBaseTestCase::Find()
|
||||||
@@ -401,11 +389,8 @@ void ListBaseTestCase::EditLabel()
|
|||||||
list->InsertItem(0, "Item 0");
|
list->InsertItem(0, "Item 0");
|
||||||
list->InsertItem(1, "Item 1");
|
list->InsertItem(1, "Item 1");
|
||||||
|
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter beginedit(list, wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT);
|
||||||
wxTestableFrame);
|
EventCounter endedit(list, wxEVT_COMMAND_LIST_END_LABEL_EDIT);
|
||||||
|
|
||||||
EventCounter count(list, wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT);
|
|
||||||
EventCounter count1(list, wxEVT_COMMAND_LIST_END_LABEL_EDIT);
|
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -416,8 +401,8 @@ void ListBaseTestCase::EditLabel()
|
|||||||
|
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT));
|
CPPUNIT_ASSERT_EQUAL(1, beginedit.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_LIST_END_LABEL_EDIT));
|
CPPUNIT_ASSERT_EQUAL(1, endedit.GetCount());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -184,8 +184,8 @@ void ListBoxTestCase::ClickEvents()
|
|||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
||||||
wxTestableFrame);
|
wxTestableFrame);
|
||||||
|
|
||||||
EventCounter count(frame, wxEVT_COMMAND_LISTBOX_SELECTED);
|
EventCounter selected(frame, wxEVT_COMMAND_LISTBOX_SELECTED);
|
||||||
EventCounter count1(frame, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED);
|
EventCounter dclicked(frame, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED);
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -205,12 +205,12 @@ void ListBoxTestCase::ClickEvents()
|
|||||||
sim.MouseClick();
|
sim.MouseClick();
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(1, selected.GetCount());
|
||||||
|
|
||||||
sim.MouseDblClick();
|
sim.MouseDblClick();
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(1, dclicked.GetCount());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,8 +220,8 @@ void ListBoxTestCase::ClickNotOnItem()
|
|||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
||||||
wxTestableFrame);
|
wxTestableFrame);
|
||||||
|
|
||||||
EventCounter count(frame, wxEVT_COMMAND_LISTBOX_SELECTED);
|
EventCounter selected(frame, wxEVT_COMMAND_LISTBOX_SELECTED);
|
||||||
EventCounter count1(frame, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED);
|
EventCounter dclicked(frame, wxEVT_COMMAND_LISTBOX_DOUBLECLICKED);
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -252,7 +252,8 @@ void ListBoxTestCase::ClickNotOnItem()
|
|||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
//If we are not clicking on an item we shouldn't have any events
|
//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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -97,12 +97,9 @@ void ListCtrlTestCase::EditLabel()
|
|||||||
#if wxUSE_UIACTIONSIMULATOR
|
#if wxUSE_UIACTIONSIMULATOR
|
||||||
void ListCtrlTestCase::ColumnDrag()
|
void ListCtrlTestCase::ColumnDrag()
|
||||||
{
|
{
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter begindrag(m_list, wxEVT_COMMAND_LIST_COL_BEGIN_DRAG);
|
||||||
wxTestableFrame);
|
EventCounter dragging(m_list, wxEVT_COMMAND_LIST_COL_DRAGGING);
|
||||||
|
EventCounter enddrag(m_list, wxEVT_COMMAND_LIST_COL_END_DRAG);
|
||||||
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);
|
|
||||||
|
|
||||||
m_list->InsertColumn(0, "Column 0");
|
m_list->InsertColumn(0, "Column 0");
|
||||||
m_list->InsertColumn(1, "Column 1");
|
m_list->InsertColumn(1, "Column 1");
|
||||||
@@ -126,20 +123,17 @@ void ListCtrlTestCase::ColumnDrag()
|
|||||||
sim.MouseUp();
|
sim.MouseUp();
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_LIST_COL_BEGIN_DRAG));
|
CPPUNIT_ASSERT_EQUAL(1, begindrag.GetCount());
|
||||||
CPPUNIT_ASSERT(frame->GetEventCount(wxEVT_COMMAND_LIST_COL_DRAGGING) > 0);
|
CPPUNIT_ASSERT(dragging.GetCount() > 0);
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_LIST_COL_END_DRAG));
|
CPPUNIT_ASSERT_EQUAL(1, enddrag.GetCount());
|
||||||
|
|
||||||
m_list->ClearAll();
|
m_list->ClearAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ListCtrlTestCase::ColumnClick()
|
void ListCtrlTestCase::ColumnClick()
|
||||||
{
|
{
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter colclick(m_list, wxEVT_COMMAND_LIST_COL_CLICK);
|
||||||
wxTestableFrame);
|
EventCounter colrclick(m_list, wxEVT_COMMAND_LIST_COL_RIGHT_CLICK);
|
||||||
|
|
||||||
EventCounter count(m_list, wxEVT_COMMAND_LIST_COL_CLICK);
|
|
||||||
EventCounter count1(m_list, wxEVT_COMMAND_LIST_COL_RIGHT_CLICK);
|
|
||||||
|
|
||||||
|
|
||||||
m_list->InsertColumn(0, "Column 0", wxLIST_FORMAT_LEFT, 60);
|
m_list->InsertColumn(0, "Column 0", wxLIST_FORMAT_LEFT, 60);
|
||||||
@@ -153,8 +147,8 @@ void ListCtrlTestCase::ColumnClick()
|
|||||||
sim.MouseClick(wxMOUSE_BTN_RIGHT);
|
sim.MouseClick(wxMOUSE_BTN_RIGHT);
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_LIST_COL_CLICK));
|
CPPUNIT_ASSERT_EQUAL(1, colclick.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_LIST_COL_RIGHT_CLICK));
|
CPPUNIT_ASSERT_EQUAL(1, colrclick.GetCount());
|
||||||
|
|
||||||
m_list->ClearAll();
|
m_list->ClearAll();
|
||||||
}
|
}
|
||||||
|
@@ -129,17 +129,14 @@ void OwnerDrawnComboBoxTestCase::Size()
|
|||||||
|
|
||||||
void OwnerDrawnComboBoxTestCase::PopDismiss()
|
void OwnerDrawnComboBoxTestCase::PopDismiss()
|
||||||
{
|
{
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter drop(m_combo, wxEVT_COMMAND_COMBOBOX_DROPDOWN);
|
||||||
wxTestableFrame);
|
EventCounter close(m_combo, wxEVT_COMMAND_COMBOBOX_CLOSEUP);
|
||||||
|
|
||||||
EventCounter count(m_combo, wxEVT_COMMAND_COMBOBOX_DROPDOWN);
|
|
||||||
EventCounter count1(m_combo, wxEVT_COMMAND_COMBOBOX_CLOSEUP);
|
|
||||||
|
|
||||||
m_combo->Popup();
|
m_combo->Popup();
|
||||||
m_combo->Dismiss();
|
m_combo->Dismiss();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_COMBOBOX_DROPDOWN));
|
CPPUNIT_ASSERT_EQUAL(1, drop.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_COMBOBOX_CLOSEUP));
|
CPPUNIT_ASSERT_EQUAL(1, close.GetCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
void OwnerDrawnComboBoxTestCase::Sort()
|
void OwnerDrawnComboBoxTestCase::Sort()
|
||||||
|
@@ -71,10 +71,7 @@ void RadioButtonTestCase::Click()
|
|||||||
{
|
{
|
||||||
// GTK does not support selecting a single radio button
|
// GTK does not support selecting a single radio button
|
||||||
#if wxUSE_UIACTIONSIMULATOR && !defined(__WXGTK__)
|
#if wxUSE_UIACTIONSIMULATOR && !defined(__WXGTK__)
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter selected(m_radio, wxEVT_COMMAND_RADIOBUTTON_SELECTED);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count(m_radio, wxEVT_COMMAND_RADIOBUTTON_SELECTED);
|
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -83,17 +80,14 @@ void RadioButtonTestCase::Click()
|
|||||||
|
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL( 1, frame->GetEventCount() );
|
CPPUNIT_ASSERT_EQUAL( 1, selected.GetCount() );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void RadioButtonTestCase::Value()
|
void RadioButtonTestCase::Value()
|
||||||
{
|
{
|
||||||
#ifndef __WXGTK__
|
#ifndef __WXGTK__
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter selected(m_radio, wxEVT_COMMAND_RADIOBUTTON_SELECTED);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count(m_radio, wxEVT_COMMAND_RADIOBUTTON_SELECTED);
|
|
||||||
|
|
||||||
m_radio->SetValue(true);
|
m_radio->SetValue(true);
|
||||||
|
|
||||||
@@ -103,7 +97,7 @@ void RadioButtonTestCase::Value()
|
|||||||
|
|
||||||
CPPUNIT_ASSERT(!m_radio->GetValue());
|
CPPUNIT_ASSERT(!m_radio->GetValue());
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(0, selected.GetCount());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -121,11 +121,8 @@ void RichTextCtrlTestCase::CharacterEvent()
|
|||||||
// There seems to be an event sequence problem on GTK+ that causes the events
|
// There seems to be an event sequence problem on GTK+ that causes the events
|
||||||
// to be disconnected before they're processed, generating spurious errors.
|
// to be disconnected before they're processed, generating spurious errors.
|
||||||
#if !defined(__WXGTK__)
|
#if !defined(__WXGTK__)
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter character(m_rich, wxEVT_COMMAND_RICHTEXT_CHARACTER);
|
||||||
wxTestableFrame);
|
EventCounter content(m_rich, wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED);
|
||||||
|
|
||||||
EventCounter count(m_rich, wxEVT_COMMAND_RICHTEXT_CHARACTER);
|
|
||||||
EventCounter count1(m_rich, wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED);
|
|
||||||
|
|
||||||
m_rich->SetFocus();
|
m_rich->SetFocus();
|
||||||
|
|
||||||
@@ -133,16 +130,19 @@ void RichTextCtrlTestCase::CharacterEvent()
|
|||||||
sim.Text("abcdef");
|
sim.Text("abcdef");
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(6, frame->GetEventCount(wxEVT_COMMAND_RICHTEXT_CHARACTER));
|
CPPUNIT_ASSERT_EQUAL(6, character.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(6, frame->GetEventCount(wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED));
|
CPPUNIT_ASSERT_EQUAL(6, content.GetCount());
|
||||||
|
|
||||||
|
character.Clear();
|
||||||
|
content.Clear();
|
||||||
|
|
||||||
//As these are not characters they shouldn't count
|
//As these are not characters they shouldn't count
|
||||||
sim.Char(WXK_RETURN);
|
sim.Char(WXK_RETURN);
|
||||||
sim.Char(WXK_SHIFT);
|
sim.Char(WXK_SHIFT);
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount(wxEVT_COMMAND_RICHTEXT_CHARACTER));
|
CPPUNIT_ASSERT_EQUAL(0, character.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_RICHTEXT_CONTENT_INSERTED));
|
CPPUNIT_ASSERT_EQUAL(1, content.GetCount());
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -153,11 +153,8 @@ void RichTextCtrlTestCase::DeleteEvent()
|
|||||||
// There seems to be an event sequence problem on GTK+ that causes the events
|
// There seems to be an event sequence problem on GTK+ that causes the events
|
||||||
// to be disconnected before they're processed, generating spurious errors.
|
// to be disconnected before they're processed, generating spurious errors.
|
||||||
#if !defined(__WXGTK__)
|
#if !defined(__WXGTK__)
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter deleteevent(m_rich, wxEVT_COMMAND_RICHTEXT_DELETE);
|
||||||
wxTestableFrame);
|
EventCounter contentdelete(m_rich, wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED);
|
||||||
|
|
||||||
EventCounter count(m_rich, wxEVT_COMMAND_RICHTEXT_DELETE);
|
|
||||||
EventCounter count1(m_rich, wxEVT_COMMAND_RICHTEXT_CONTENT_DELETED);
|
|
||||||
|
|
||||||
m_rich->SetFocus();
|
m_rich->SetFocus();
|
||||||
|
|
||||||
@@ -167,9 +164,9 @@ void RichTextCtrlTestCase::DeleteEvent()
|
|||||||
sim.Char(WXK_DELETE);
|
sim.Char(WXK_DELETE);
|
||||||
wxYield();
|
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
|
//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
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -180,10 +177,7 @@ void RichTextCtrlTestCase::ReturnEvent()
|
|||||||
// There seems to be an event sequence problem on GTK+ that causes the events
|
// There seems to be an event sequence problem on GTK+ that causes the events
|
||||||
// to be disconnected before they're processed, generating spurious errors.
|
// to be disconnected before they're processed, generating spurious errors.
|
||||||
#if !defined(__WXGTK__)
|
#if !defined(__WXGTK__)
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter returnevent(m_rich, wxEVT_COMMAND_RICHTEXT_RETURN);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count(m_rich, wxEVT_COMMAND_RICHTEXT_RETURN);
|
|
||||||
|
|
||||||
m_rich->SetFocus();
|
m_rich->SetFocus();
|
||||||
|
|
||||||
@@ -191,44 +185,41 @@ void RichTextCtrlTestCase::ReturnEvent()
|
|||||||
sim.Char(WXK_RETURN);
|
sim.Char(WXK_RETURN);
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(1, returnevent.GetCount());
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void RichTextCtrlTestCase::StyleEvent()
|
void RichTextCtrlTestCase::StyleEvent()
|
||||||
{
|
{
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter stylechanged(m_rich, wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count(m_rich, wxEVT_COMMAND_RICHTEXT_STYLE_CHANGED);
|
|
||||||
|
|
||||||
m_rich->SetValue("Sometext");
|
m_rich->SetValue("Sometext");
|
||||||
m_rich->SetStyle(0, 8, wxTextAttr(*wxRED, *wxWHITE));
|
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()
|
void RichTextCtrlTestCase::BufferResetEvent()
|
||||||
{
|
{
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter reset(m_rich, wxEVT_COMMAND_RICHTEXT_BUFFER_RESET);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count(m_rich, wxEVT_COMMAND_RICHTEXT_BUFFER_RESET);
|
|
||||||
|
|
||||||
m_rich->AppendText("more text!");
|
m_rich->AppendText("more text!");
|
||||||
m_rich->SetValue("");
|
m_rich->SetValue("");
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(1, reset.GetCount());
|
||||||
|
|
||||||
|
reset.Clear();
|
||||||
m_rich->AppendText("more text!");
|
m_rich->AppendText("more text!");
|
||||||
m_rich->Clear();
|
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
|
//We expect a buffer reset here as setvalue clears the existing text
|
||||||
m_rich->SetValue("replace");
|
m_rich->SetValue("replace");
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(1, reset.GetCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
void RichTextCtrlTestCase::UrlEvent()
|
void RichTextCtrlTestCase::UrlEvent()
|
||||||
@@ -236,10 +227,7 @@ void RichTextCtrlTestCase::UrlEvent()
|
|||||||
#if wxUSE_UIACTIONSIMULATOR
|
#if wxUSE_UIACTIONSIMULATOR
|
||||||
// Mouse up event not being caught on GTK+
|
// Mouse up event not being caught on GTK+
|
||||||
#if !defined(__WXGTK__)
|
#if !defined(__WXGTK__)
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter url(m_rich, wxEVT_COMMAND_TEXT_URL);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count(m_rich, wxEVT_COMMAND_TEXT_URL);
|
|
||||||
|
|
||||||
m_rich->BeginURL("http://www.wxwidgets.org");
|
m_rich->BeginURL("http://www.wxwidgets.org");
|
||||||
m_rich->WriteText("http://www.wxwidgets.org");
|
m_rich->WriteText("http://www.wxwidgets.org");
|
||||||
@@ -252,7 +240,7 @@ void RichTextCtrlTestCase::UrlEvent()
|
|||||||
sim.MouseClick();
|
sim.MouseClick();
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(1, url.GetCount());
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -261,10 +249,7 @@ void RichTextCtrlTestCase::TextEvent()
|
|||||||
{
|
{
|
||||||
#if wxUSE_UIACTIONSIMULATOR
|
#if wxUSE_UIACTIONSIMULATOR
|
||||||
#if !defined(__WXGTK__)
|
#if !defined(__WXGTK__)
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter updated(m_rich, wxEVT_COMMAND_TEXT_UPDATED);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count(m_rich, wxEVT_COMMAND_TEXT_UPDATED);
|
|
||||||
|
|
||||||
m_rich->SetFocus();
|
m_rich->SetFocus();
|
||||||
|
|
||||||
@@ -273,7 +258,7 @@ void RichTextCtrlTestCase::TextEvent()
|
|||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL("abcdef", m_rich->GetValue());
|
CPPUNIT_ASSERT_EQUAL("abcdef", m_rich->GetValue());
|
||||||
CPPUNIT_ASSERT_EQUAL(6, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(6, updated.GetCount());
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -424,10 +409,7 @@ void RichTextCtrlTestCase::Editable()
|
|||||||
{
|
{
|
||||||
#if wxUSE_UIACTIONSIMULATOR
|
#if wxUSE_UIACTIONSIMULATOR
|
||||||
#if !defined(__WXGTK__)
|
#if !defined(__WXGTK__)
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter updated(m_rich, wxEVT_COMMAND_TEXT_UPDATED);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count(m_rich, wxEVT_COMMAND_TEXT_UPDATED);
|
|
||||||
|
|
||||||
m_rich->SetFocus();
|
m_rich->SetFocus();
|
||||||
|
|
||||||
@@ -436,14 +418,15 @@ void RichTextCtrlTestCase::Editable()
|
|||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL("abcdef", m_rich->GetValue());
|
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);
|
m_rich->SetEditable(false);
|
||||||
sim.Text("gh");
|
sim.Text("gh");
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL("abcdef", m_rich->GetValue());
|
CPPUNIT_ASSERT_EQUAL("abcdef", m_rich->GetValue());
|
||||||
CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(0, updated.GetCount());
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@@ -87,11 +87,8 @@ void SliderTestCase::tearDown()
|
|||||||
void SliderTestCase::PageUpDown()
|
void SliderTestCase::PageUpDown()
|
||||||
{
|
{
|
||||||
#if wxUSE_UIACTIONSIMULATOR
|
#if wxUSE_UIACTIONSIMULATOR
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter pageup(m_slider, wxEVT_SCROLL_PAGEUP);
|
||||||
wxTestableFrame);
|
EventCounter pagedown(m_slider, wxEVT_SCROLL_PAGEDOWN);
|
||||||
|
|
||||||
EventCounter count(m_slider, wxEVT_SCROLL_PAGEUP);
|
|
||||||
EventCounter count1(m_slider, wxEVT_SCROLL_PAGEDOWN);
|
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -102,19 +99,16 @@ void SliderTestCase::PageUpDown()
|
|||||||
|
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_SCROLL_PAGEUP));
|
CPPUNIT_ASSERT_EQUAL(1, pageup.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_SCROLL_PAGEDOWN));
|
CPPUNIT_ASSERT_EQUAL(1, pagedown.GetCount());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SliderTestCase::LineUpDown()
|
void SliderTestCase::LineUpDown()
|
||||||
{
|
{
|
||||||
#if wxUSE_UIACTIONSIMULATOR
|
#if wxUSE_UIACTIONSIMULATOR
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter lineup(m_slider, wxEVT_SCROLL_LINEUP);
|
||||||
wxTestableFrame);
|
EventCounter linedown(m_slider, wxEVT_SCROLL_LINEDOWN);
|
||||||
|
|
||||||
EventCounter count(m_slider, wxEVT_SCROLL_LINEUP);
|
|
||||||
EventCounter count1(m_slider, wxEVT_SCROLL_LINEDOWN);
|
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -125,8 +119,8 @@ void SliderTestCase::LineUpDown()
|
|||||||
|
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_SCROLL_LINEUP));
|
CPPUNIT_ASSERT_EQUAL(1, lineup.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_SCROLL_LINEDOWN));
|
CPPUNIT_ASSERT_EQUAL(1, linedown.GetCount());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,12 +187,9 @@ void SliderTestCase::Range()
|
|||||||
void SliderTestCase::Thumb()
|
void SliderTestCase::Thumb()
|
||||||
{
|
{
|
||||||
#if wxUSE_UIACTIONSIMULATOR && !defined(__WXGTK__)
|
#if wxUSE_UIACTIONSIMULATOR && !defined(__WXGTK__)
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter track(m_slider, wxEVT_SCROLL_THUMBTRACK);
|
||||||
wxTestableFrame);
|
EventCounter release(m_slider, wxEVT_SCROLL_THUMBRELEASE);
|
||||||
|
EventCounter changed(m_slider, wxEVT_SCROLL_CHANGED);
|
||||||
EventCounter count(m_slider, wxEVT_SCROLL_THUMBTRACK);
|
|
||||||
EventCounter count1(m_slider, wxEVT_SCROLL_THUMBRELEASE);
|
|
||||||
EventCounter count2(m_slider, wxEVT_SCROLL_CHANGED);
|
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -216,10 +207,10 @@ void SliderTestCase::Thumb()
|
|||||||
sim.MouseUp();
|
sim.MouseUp();
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT(frame->GetEventCount(wxEVT_SCROLL_THUMBTRACK) != 0);
|
CPPUNIT_ASSERT(track.GetCount() != 0);
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_SCROLL_THUMBRELEASE));
|
CPPUNIT_ASSERT_EQUAL(1, release.GetCount());
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_SCROLL_CHANGED));
|
CPPUNIT_ASSERT_EQUAL(1, changed.GetCount());
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@@ -70,10 +70,7 @@ void SpinCtrlDoubleTestCase::tearDown()
|
|||||||
void SpinCtrlDoubleTestCase::Arrows()
|
void SpinCtrlDoubleTestCase::Arrows()
|
||||||
{
|
{
|
||||||
#ifndef __WXGTK__
|
#ifndef __WXGTK__
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter updated(m_spin, wxEVT_COMMAND_SPINCTRLDOUBLE_UPDATED);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count(m_spin, wxEVT_COMMAND_SPINCTRLDOUBLE_UPDATED);
|
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -83,13 +80,14 @@ void SpinCtrlDoubleTestCase::Arrows()
|
|||||||
sim.Char(WXK_UP);
|
sim.Char(WXK_UP);
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(1, updated.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(1.0, m_spin->GetValue());
|
CPPUNIT_ASSERT_EQUAL(1.0, m_spin->GetValue());
|
||||||
|
updated.Clear();
|
||||||
|
|
||||||
sim.Char(WXK_DOWN);
|
sim.Char(WXK_DOWN);
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(1, updated.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(0.0, m_spin->GetValue());
|
CPPUNIT_ASSERT_EQUAL(0.0, m_spin->GetValue());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@@ -68,10 +68,7 @@ void SpinCtrlTestCase::tearDown()
|
|||||||
void SpinCtrlTestCase::Arrows()
|
void SpinCtrlTestCase::Arrows()
|
||||||
{
|
{
|
||||||
#if wxUSE_UIACTIONSIMULATOR
|
#if wxUSE_UIACTIONSIMULATOR
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter updated(m_spin, wxEVT_COMMAND_SPINCTRL_UPDATED);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count(m_spin, wxEVT_COMMAND_SPINCTRL_UPDATED);
|
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -81,14 +78,15 @@ void SpinCtrlTestCase::Arrows()
|
|||||||
|
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(1, updated.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(1, m_spin->GetValue());
|
CPPUNIT_ASSERT_EQUAL(1, m_spin->GetValue());
|
||||||
|
updated.Clear();
|
||||||
|
|
||||||
sim.Char(WXK_DOWN);
|
sim.Char(WXK_DOWN);
|
||||||
|
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(1, updated.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(0, m_spin->GetValue());
|
CPPUNIT_ASSERT_EQUAL(0, m_spin->GetValue());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@@ -147,10 +147,7 @@ void TextCtrlTestCase::ReadOnly()
|
|||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
wxTE_READONLY);
|
wxTE_READONLY);
|
||||||
|
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter updated(m_text, wxEVT_COMMAND_TEXT_UPDATED);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count(m_text, wxEVT_COMMAND_TEXT_UPDATED);
|
|
||||||
|
|
||||||
m_text->SetFocus();
|
m_text->SetFocus();
|
||||||
|
|
||||||
@@ -159,7 +156,7 @@ void TextCtrlTestCase::ReadOnly()
|
|||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL("", m_text->GetValue());
|
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
|
// SetEditable() is supposed to override wxTE_READONLY
|
||||||
m_text->SetEditable(true);
|
m_text->SetEditable(true);
|
||||||
@@ -168,7 +165,7 @@ void TextCtrlTestCase::ReadOnly()
|
|||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL("abcdef", m_text->GetValue());
|
CPPUNIT_ASSERT_EQUAL("abcdef", m_text->GetValue());
|
||||||
CPPUNIT_ASSERT_EQUAL(6, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(6, updated.GetCount());
|
||||||
|
|
||||||
delete m_text;
|
delete m_text;
|
||||||
m_text = new wxTextCtrl(wxTheApp->GetTopWindow(), wxID_ANY);
|
m_text = new wxTextCtrl(wxTheApp->GetTopWindow(), wxID_ANY);
|
||||||
@@ -178,11 +175,8 @@ void TextCtrlTestCase::ReadOnly()
|
|||||||
void TextCtrlTestCase::MaxLength()
|
void TextCtrlTestCase::MaxLength()
|
||||||
{
|
{
|
||||||
#if wxUSE_UIACTIONSIMULATOR
|
#if wxUSE_UIACTIONSIMULATOR
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter updated(m_text, wxEVT_COMMAND_TEXT_UPDATED);
|
||||||
wxTestableFrame);
|
EventCounter maxlen(m_text, wxEVT_COMMAND_TEXT_MAXLEN);
|
||||||
|
|
||||||
EventCounter count(m_text, wxEVT_COMMAND_TEXT_UPDATED);
|
|
||||||
EventCounter count1(m_text, wxEVT_COMMAND_TEXT_MAXLEN);
|
|
||||||
|
|
||||||
m_text->SetFocus();
|
m_text->SetFocus();
|
||||||
m_text->SetMaxLength(10);
|
m_text->SetMaxLength(10);
|
||||||
@@ -191,27 +185,33 @@ void TextCtrlTestCase::MaxLength()
|
|||||||
sim.Text("abcdef");
|
sim.Text("abcdef");
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount(wxEVT_COMMAND_TEXT_MAXLEN));
|
CPPUNIT_ASSERT_EQUAL(0, maxlen.GetCount());
|
||||||
|
|
||||||
sim.Text("ghij");
|
sim.Text("ghij");
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount(wxEVT_COMMAND_TEXT_MAXLEN));
|
CPPUNIT_ASSERT_EQUAL(0, maxlen.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(10, frame->GetEventCount(wxEVT_COMMAND_TEXT_UPDATED));
|
CPPUNIT_ASSERT_EQUAL(10, updated.GetCount());
|
||||||
|
|
||||||
|
maxlen.Clear();
|
||||||
|
updated.Clear();
|
||||||
|
|
||||||
sim.Text("k");
|
sim.Text("k");
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_TEXT_MAXLEN));
|
CPPUNIT_ASSERT_EQUAL(1, maxlen.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount(wxEVT_COMMAND_TEXT_UPDATED));
|
CPPUNIT_ASSERT_EQUAL(0, updated.GetCount());
|
||||||
|
|
||||||
|
maxlen.Clear();
|
||||||
|
updated.Clear();
|
||||||
|
|
||||||
m_text->SetMaxLength(0);
|
m_text->SetMaxLength(0);
|
||||||
|
|
||||||
sim.Text("k");
|
sim.Text("k");
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount(wxEVT_COMMAND_TEXT_MAXLEN));
|
CPPUNIT_ASSERT_EQUAL(0, maxlen.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_TEXT_UPDATED));
|
CPPUNIT_ASSERT_EQUAL(1, updated.GetCount());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,10 +315,7 @@ void TextCtrlTestCase::Url()
|
|||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
wxTE_MULTILINE | wxTE_RICH | wxTE_AUTO_URL);
|
wxTE_MULTILINE | wxTE_RICH | wxTE_AUTO_URL);
|
||||||
|
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter url(m_text, wxEVT_COMMAND_TEXT_URL);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count(m_text, wxEVT_COMMAND_TEXT_URL);
|
|
||||||
|
|
||||||
m_text->AppendText("http://www.wxwidgets.org");
|
m_text->AppendText("http://www.wxwidgets.org");
|
||||||
|
|
||||||
@@ -327,7 +324,7 @@ void TextCtrlTestCase::Url()
|
|||||||
sim.MouseClick();
|
sim.MouseClick();
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(1, url.GetCount());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -41,40 +41,45 @@ void TextEntryTestCase::SetValue()
|
|||||||
|
|
||||||
void TextEntryTestCase::TextChangeEvents()
|
void TextEntryTestCase::TextChangeEvents()
|
||||||
{
|
{
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter updated(GetTestWindow(), wxEVT_COMMAND_TEXT_UPDATED);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count(GetTestWindow(), wxEVT_COMMAND_TEXT_UPDATED);
|
|
||||||
|
|
||||||
wxTextEntry * const entry = GetTestEntry();
|
wxTextEntry * const entry = GetTestEntry();
|
||||||
|
|
||||||
// notice that SetValue() generates an event even if the text didn't change
|
// notice that SetValue() generates an event even if the text didn't change
|
||||||
entry->SetValue("");
|
entry->SetValue("");
|
||||||
CPPUNIT_ASSERT_EQUAL( 1, frame->GetEventCount() );
|
CPPUNIT_ASSERT_EQUAL( 1, updated.GetCount() );
|
||||||
|
updated.Clear();
|
||||||
|
|
||||||
entry->SetValue("foo");
|
entry->SetValue("foo");
|
||||||
CPPUNIT_ASSERT_EQUAL( 1, frame->GetEventCount() );
|
CPPUNIT_ASSERT_EQUAL( 1, updated.GetCount() );
|
||||||
|
updated.Clear();
|
||||||
|
|
||||||
entry->SetValue("foo");
|
entry->SetValue("foo");
|
||||||
CPPUNIT_ASSERT_EQUAL( 1, frame->GetEventCount() );
|
CPPUNIT_ASSERT_EQUAL( 1, updated.GetCount() );
|
||||||
|
updated.Clear();
|
||||||
|
|
||||||
entry->ChangeValue("bar");
|
entry->ChangeValue("bar");
|
||||||
CPPUNIT_ASSERT_EQUAL( 0, frame->GetEventCount() );
|
CPPUNIT_ASSERT_EQUAL( 0, updated.GetCount() );
|
||||||
|
|
||||||
entry->AppendText("bar");
|
entry->AppendText("bar");
|
||||||
CPPUNIT_ASSERT_EQUAL( 1, frame->GetEventCount() );
|
CPPUNIT_ASSERT_EQUAL( 1, updated.GetCount() );
|
||||||
|
updated.Clear();
|
||||||
|
|
||||||
entry->Replace(3, 6, "baz");
|
entry->Replace(3, 6, "baz");
|
||||||
CPPUNIT_ASSERT_EQUAL( 1, frame->GetEventCount() );
|
CPPUNIT_ASSERT_EQUAL( 1, updated.GetCount() );
|
||||||
|
updated.Clear();
|
||||||
|
|
||||||
entry->Remove(0, 3);
|
entry->Remove(0, 3);
|
||||||
CPPUNIT_ASSERT_EQUAL( 1, frame->GetEventCount() );
|
CPPUNIT_ASSERT_EQUAL( 1, updated.GetCount() );
|
||||||
|
updated.Clear();
|
||||||
|
|
||||||
entry->WriteText("foo");
|
entry->WriteText("foo");
|
||||||
CPPUNIT_ASSERT_EQUAL( 1, frame->GetEventCount() );
|
CPPUNIT_ASSERT_EQUAL( 1, updated.GetCount() );
|
||||||
|
updated.Clear();
|
||||||
|
|
||||||
entry->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::CheckStringSelection(const char *sel)
|
||||||
@@ -176,13 +181,10 @@ void TextEntryTestCase::Replace()
|
|||||||
void TextEntryTestCase::Editable()
|
void TextEntryTestCase::Editable()
|
||||||
{
|
{
|
||||||
#if wxUSE_UIACTIONSIMULATOR
|
#if wxUSE_UIACTIONSIMULATOR
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
wxTextEntry * const entry = GetTestEntry();
|
wxTextEntry * const entry = GetTestEntry();
|
||||||
wxWindow * const window = GetTestWindow();
|
wxWindow * const window = GetTestWindow();
|
||||||
|
|
||||||
EventCounter count(window, wxEVT_COMMAND_TEXT_UPDATED);
|
EventCounter updated(window, wxEVT_COMMAND_TEXT_UPDATED);
|
||||||
|
|
||||||
window->SetFocus();
|
window->SetFocus();
|
||||||
wxYield();
|
wxYield();
|
||||||
@@ -192,14 +194,16 @@ void TextEntryTestCase::Editable()
|
|||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL("abcdef", entry->GetValue());
|
CPPUNIT_ASSERT_EQUAL("abcdef", entry->GetValue());
|
||||||
CPPUNIT_ASSERT_EQUAL(6, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(6, updated.GetCount());
|
||||||
|
|
||||||
|
updated.Clear();
|
||||||
|
|
||||||
entry->SetEditable(false);
|
entry->SetEditable(false);
|
||||||
sim.Text("gh");
|
sim.Text("gh");
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL("abcdef", entry->GetValue());
|
CPPUNIT_ASSERT_EQUAL("abcdef", entry->GetValue());
|
||||||
CPPUNIT_ASSERT_EQUAL(0, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(0, updated.GetCount());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -64,10 +64,7 @@ void ToggleButtonTestCase::tearDown()
|
|||||||
void ToggleButtonTestCase::Click()
|
void ToggleButtonTestCase::Click()
|
||||||
{
|
{
|
||||||
#if wxUSE_UIACTIONSIMULATOR
|
#if wxUSE_UIACTIONSIMULATOR
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter clicked(m_button, wxEVT_COMMAND_TOGGLEBUTTON_CLICKED);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count(m_button, wxEVT_COMMAND_TOGGLEBUTTON_CLICKED);
|
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -78,23 +75,21 @@ void ToggleButtonTestCase::Click()
|
|||||||
sim.MouseClick();
|
sim.MouseClick();
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(1, clicked.GetCount());
|
||||||
CPPUNIT_ASSERT(m_button->GetValue());
|
CPPUNIT_ASSERT(m_button->GetValue());
|
||||||
|
clicked.Clear();
|
||||||
|
|
||||||
sim.MouseClick();
|
sim.MouseClick();
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(1, clicked.GetCount());
|
||||||
CPPUNIT_ASSERT(!m_button->GetValue());
|
CPPUNIT_ASSERT(!m_button->GetValue());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToggleButtonTestCase::Value()
|
void ToggleButtonTestCase::Value()
|
||||||
{
|
{
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter clicked(m_button, wxEVT_COMMAND_BUTTON_CLICKED);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count(m_button, wxEVT_COMMAND_BUTTON_CLICKED);
|
|
||||||
|
|
||||||
m_button->SetValue(true);
|
m_button->SetValue(true);
|
||||||
|
|
||||||
@@ -104,7 +99,7 @@ void ToggleButtonTestCase::Value()
|
|||||||
|
|
||||||
CPPUNIT_ASSERT(!m_button->GetValue());
|
CPPUNIT_ASSERT(!m_button->GetValue());
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL( 0, frame->GetEventCount() );
|
CPPUNIT_ASSERT_EQUAL( 0, clicked.GetCount() );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif //wxUSE_TOGGLEBTN
|
#endif //wxUSE_TOGGLEBTN
|
||||||
|
@@ -239,11 +239,8 @@ void TreeCtrlTestCase::SelectItemMulti()
|
|||||||
void TreeCtrlTestCase::ItemClick()
|
void TreeCtrlTestCase::ItemClick()
|
||||||
{
|
{
|
||||||
#if wxUSE_UIACTIONSIMULATOR
|
#if wxUSE_UIACTIONSIMULATOR
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter activated(m_tree, wxEVT_COMMAND_TREE_ITEM_ACTIVATED);
|
||||||
wxTestableFrame);
|
EventCounter rclick(m_tree, wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK);
|
||||||
|
|
||||||
EventCounter count(m_tree, wxEVT_COMMAND_TREE_ITEM_ACTIVATED);
|
|
||||||
EventCounter count1(m_tree, wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK);
|
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -262,35 +259,29 @@ void TreeCtrlTestCase::ItemClick()
|
|||||||
sim.MouseClick(wxMOUSE_BTN_RIGHT);
|
sim.MouseClick(wxMOUSE_BTN_RIGHT);
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_TREE_ITEM_ACTIVATED));
|
CPPUNIT_ASSERT_EQUAL(1, activated.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK));
|
CPPUNIT_ASSERT_EQUAL(1, rclick.GetCount());
|
||||||
#endif // wxUSE_UIACTIONSIMULATOR
|
#endif // wxUSE_UIACTIONSIMULATOR
|
||||||
}
|
}
|
||||||
|
|
||||||
void TreeCtrlTestCase::DeleteItem()
|
void TreeCtrlTestCase::DeleteItem()
|
||||||
{
|
{
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter deleteitem(m_tree, wxEVT_COMMAND_TREE_DELETE_ITEM);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count(m_tree, wxEVT_COMMAND_TREE_DELETE_ITEM);
|
|
||||||
|
|
||||||
wxTreeItemId todelete = m_tree->AppendItem(m_root, "deleteme");
|
wxTreeItemId todelete = m_tree->AppendItem(m_root, "deleteme");
|
||||||
m_tree->Delete(todelete);
|
m_tree->Delete(todelete);
|
||||||
// We do not test DeleteAllItems() as under some versions of Windows events
|
// We do not test DeleteAllItems() as under some versions of Windows events
|
||||||
// are not generated.
|
// are not generated.
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(1, deleteitem.GetCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_UIACTIONSIMULATOR
|
#if wxUSE_UIACTIONSIMULATOR
|
||||||
|
|
||||||
void TreeCtrlTestCase::LabelEdit()
|
void TreeCtrlTestCase::LabelEdit()
|
||||||
{
|
{
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter beginedit(m_tree, wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT);
|
||||||
wxTestableFrame);
|
EventCounter endedit(m_tree, wxEVT_COMMAND_TREE_END_LABEL_EDIT);
|
||||||
|
|
||||||
EventCounter count(m_tree, wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT);
|
|
||||||
EventCounter count1(m_tree, wxEVT_COMMAND_TREE_END_LABEL_EDIT);
|
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -300,20 +291,17 @@ void TreeCtrlTestCase::LabelEdit()
|
|||||||
sim.Text("newroottext");
|
sim.Text("newroottext");
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(1, beginedit.GetCount());
|
||||||
|
|
||||||
sim.Char(WXK_RETURN);
|
sim.Char(WXK_RETURN);
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(1, endedit.GetCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TreeCtrlTestCase::KeyDown()
|
void TreeCtrlTestCase::KeyDown()
|
||||||
{
|
{
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter keydown(m_tree, wxEVT_COMMAND_TREE_KEY_DOWN);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count(m_tree, wxEVT_COMMAND_TREE_KEY_DOWN);
|
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -321,22 +309,19 @@ void TreeCtrlTestCase::KeyDown()
|
|||||||
sim.Text("aAbB");
|
sim.Text("aAbB");
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(6, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(6, keydown.GetCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(__WXGTK__)
|
#if !defined(__WXGTK__)
|
||||||
|
|
||||||
void TreeCtrlTestCase::CollapseExpandEvents()
|
void TreeCtrlTestCase::CollapseExpandEvents()
|
||||||
{
|
{
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
m_tree->CollapseAll();
|
m_tree->CollapseAll();
|
||||||
|
|
||||||
EventCounter count(m_tree, wxEVT_COMMAND_TREE_ITEM_COLLAPSED);
|
EventCounter collapsed(m_tree, wxEVT_COMMAND_TREE_ITEM_COLLAPSED);
|
||||||
EventCounter count1(m_tree, wxEVT_COMMAND_TREE_ITEM_COLLAPSING);
|
EventCounter collapsing(m_tree, wxEVT_COMMAND_TREE_ITEM_COLLAPSING);
|
||||||
EventCounter count2(m_tree, wxEVT_COMMAND_TREE_ITEM_EXPANDED);
|
EventCounter expanded(m_tree, wxEVT_COMMAND_TREE_ITEM_EXPANDED);
|
||||||
EventCounter count3(m_tree, wxEVT_COMMAND_TREE_ITEM_EXPANDING);
|
EventCounter expanding(m_tree, wxEVT_COMMAND_TREE_ITEM_EXPANDING);
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -352,26 +337,23 @@ void TreeCtrlTestCase::CollapseExpandEvents()
|
|||||||
sim.MouseDblClick();
|
sim.MouseDblClick();
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_TREE_ITEM_EXPANDING));
|
CPPUNIT_ASSERT_EQUAL(1, expanding.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_TREE_ITEM_EXPANDED));
|
CPPUNIT_ASSERT_EQUAL(1, expanded.GetCount());
|
||||||
|
|
||||||
sim.MouseDblClick();
|
sim.MouseDblClick();
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_TREE_ITEM_COLLAPSING));
|
CPPUNIT_ASSERT_EQUAL(1, collapsing.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_TREE_ITEM_COLLAPSED));
|
CPPUNIT_ASSERT_EQUAL(1, collapsed.GetCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TreeCtrlTestCase::SelectionChange()
|
void TreeCtrlTestCase::SelectionChange()
|
||||||
{
|
{
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
m_tree->ExpandAll();
|
m_tree->ExpandAll();
|
||||||
m_tree->UnselectAll();
|
m_tree->UnselectAll();
|
||||||
|
|
||||||
EventCounter count(m_tree, wxEVT_COMMAND_TREE_SEL_CHANGED);
|
EventCounter changed(m_tree, wxEVT_COMMAND_TREE_SEL_CHANGED);
|
||||||
EventCounter count1(m_tree, wxEVT_COMMAND_TREE_SEL_CHANGING);
|
EventCounter changing(m_tree, wxEVT_COMMAND_TREE_SEL_CHANGING);
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -395,18 +377,15 @@ void TreeCtrlTestCase::SelectionChange()
|
|||||||
sim.MouseClick();
|
sim.MouseClick();
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(2, frame->GetEventCount(wxEVT_COMMAND_TREE_SEL_CHANGED));
|
CPPUNIT_ASSERT_EQUAL(2, changed.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(2, frame->GetEventCount(wxEVT_COMMAND_TREE_SEL_CHANGING));
|
CPPUNIT_ASSERT_EQUAL(2, changing.GetCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // !__WXGTK__
|
#endif // !__WXGTK__
|
||||||
|
|
||||||
void TreeCtrlTestCase::Menu()
|
void TreeCtrlTestCase::Menu()
|
||||||
{
|
{
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter menu(m_tree, wxEVT_COMMAND_TREE_ITEM_MENU);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count(m_tree, wxEVT_COMMAND_TREE_ITEM_MENU);
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
wxRect pos;
|
wxRect pos;
|
||||||
@@ -421,7 +400,7 @@ void TreeCtrlTestCase::Menu()
|
|||||||
sim.MouseClick(wxMOUSE_BTN_RIGHT);
|
sim.MouseClick(wxMOUSE_BTN_RIGHT);
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_COMMAND_TREE_ITEM_MENU));
|
CPPUNIT_ASSERT_EQUAL(1, menu.GetCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_UIACTIONSIMULATOR
|
#endif // wxUSE_UIACTIONSIMULATOR
|
||||||
|
@@ -97,10 +97,7 @@ void WindowTestCase::tearDown()
|
|||||||
void WindowTestCase::ShowHideEvent()
|
void WindowTestCase::ShowHideEvent()
|
||||||
{
|
{
|
||||||
#if defined(__WXMSW__) || defined (__WXPM__)
|
#if defined(__WXMSW__) || defined (__WXPM__)
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter show(m_window, wxEVT_SHOW);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count(m_window, wxEVT_SHOW);
|
|
||||||
|
|
||||||
CPPUNIT_ASSERT(m_window->IsShown());
|
CPPUNIT_ASSERT(m_window->IsShown());
|
||||||
|
|
||||||
@@ -112,19 +109,16 @@ void WindowTestCase::ShowHideEvent()
|
|||||||
|
|
||||||
CPPUNIT_ASSERT(m_window->IsShown());
|
CPPUNIT_ASSERT(m_window->IsShown());
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(2, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(2, show.GetCount());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowTestCase::KeyEvent()
|
void WindowTestCase::KeyEvent()
|
||||||
{
|
{
|
||||||
#if wxUSE_UIACTIONSIMULATOR
|
#if wxUSE_UIACTIONSIMULATOR
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter keydown(m_window, wxEVT_KEY_DOWN);
|
||||||
wxTestableFrame);
|
EventCounter keyup(m_window, wxEVT_KEY_UP);
|
||||||
|
EventCounter keychar(m_window, wxEVT_CHAR);
|
||||||
EventCounter count(m_window, wxEVT_KEY_DOWN);
|
|
||||||
EventCounter count1(m_window, wxEVT_KEY_UP);
|
|
||||||
EventCounter count2(m_window, wxEVT_CHAR);
|
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -134,31 +128,28 @@ void WindowTestCase::KeyEvent()
|
|||||||
sim.Char(WXK_SHIFT);
|
sim.Char(WXK_SHIFT);
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(5, frame->GetEventCount(wxEVT_KEY_DOWN));
|
CPPUNIT_ASSERT_EQUAL(5, keydown.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(5, frame->GetEventCount(wxEVT_KEY_UP));
|
CPPUNIT_ASSERT_EQUAL(5, keyup.GetCount());
|
||||||
CPPUNIT_ASSERT_EQUAL(4, frame->GetEventCount(wxEVT_CHAR));
|
CPPUNIT_ASSERT_EQUAL(4, keychar.GetCount());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowTestCase::FocusEvent()
|
void WindowTestCase::FocusEvent()
|
||||||
{
|
{
|
||||||
#ifndef __WXOSX__
|
#ifndef __WXOSX__
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter setfocus(m_window, wxEVT_SET_FOCUS);
|
||||||
wxTestableFrame);
|
EventCounter killfocus(m_window, wxEVT_KILL_FOCUS);
|
||||||
|
|
||||||
EventCounter count(m_window, wxEVT_SET_FOCUS);
|
|
||||||
EventCounter count1(m_window, wxEVT_KILL_FOCUS);
|
|
||||||
|
|
||||||
m_window->SetFocus();
|
m_window->SetFocus();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_SET_FOCUS));
|
CPPUNIT_ASSERT_EQUAL(1, setfocus.GetCount());
|
||||||
CPPUNIT_ASSERT(m_window->HasFocus());
|
CPPUNIT_ASSERT(m_window->HasFocus());
|
||||||
|
|
||||||
wxButton* button = new wxButton(wxTheApp->GetTopWindow(), wxID_ANY);
|
wxButton* button = new wxButton(wxTheApp->GetTopWindow(), wxID_ANY);
|
||||||
|
|
||||||
button->SetFocus();
|
button->SetFocus();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount(wxEVT_KILL_FOCUS));
|
CPPUNIT_ASSERT_EQUAL(1, killfocus.GetCount());
|
||||||
CPPUNIT_ASSERT(!m_window->HasFocus());
|
CPPUNIT_ASSERT(!m_window->HasFocus());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@@ -120,10 +120,7 @@ void HtmlWindowTestCase::Title()
|
|||||||
#if wxUSE_UIACTIONSIMULATOR
|
#if wxUSE_UIACTIONSIMULATOR
|
||||||
void HtmlWindowTestCase::CellClick()
|
void HtmlWindowTestCase::CellClick()
|
||||||
{
|
{
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter clicked(m_win, wxEVT_COMMAND_HTML_CELL_CLICKED);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count1(m_win, wxEVT_COMMAND_HTML_CELL_CLICKED);
|
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -137,15 +134,12 @@ void HtmlWindowTestCase::CellClick()
|
|||||||
sim.MouseClick();
|
sim.MouseClick();
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(1, clicked.GetCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
void HtmlWindowTestCase::LinkClick()
|
void HtmlWindowTestCase::LinkClick()
|
||||||
{
|
{
|
||||||
wxTestableFrame* frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
EventCounter clicked(m_win, wxEVT_COMMAND_HTML_LINK_CLICKED);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
EventCounter count1(m_win, wxEVT_COMMAND_HTML_LINK_CLICKED);
|
|
||||||
|
|
||||||
wxUIActionSimulator sim;
|
wxUIActionSimulator sim;
|
||||||
|
|
||||||
@@ -159,7 +153,7 @@ void HtmlWindowTestCase::LinkClick()
|
|||||||
sim.MouseClick();
|
sim.MouseClick();
|
||||||
wxYield();
|
wxYield();
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, frame->GetEventCount());
|
CPPUNIT_ASSERT_EQUAL(1, clicked.GetCount());
|
||||||
}
|
}
|
||||||
#endif // wxUSE_UIACTIONSIMULATOR
|
#endif // wxUSE_UIACTIONSIMULATOR
|
||||||
|
|
||||||
|
@@ -31,27 +31,7 @@ void wxTestableFrame::OnEvent(wxEvent& evt)
|
|||||||
|
|
||||||
int wxTestableFrame::GetEventCount(wxEventType type)
|
int wxTestableFrame::GetEventCount(wxEventType type)
|
||||||
{
|
{
|
||||||
if (type == wxEVT_ANY)
|
return m_count[type];
|
||||||
{
|
|
||||||
//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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTestableFrame::ClearEventCount(wxEventType type)
|
void wxTestableFrame::ClearEventCount(wxEventType type)
|
||||||
@@ -63,24 +43,19 @@ EventCounter::EventCounter(wxWindow* win, wxEventType type) : m_type(type),
|
|||||||
m_win(win)
|
m_win(win)
|
||||||
|
|
||||||
{
|
{
|
||||||
m_frame = wxStaticCast(wxTheApp->GetTopWindow(),
|
m_frame = wxStaticCast(wxTheApp->GetTopWindow(), wxTestableFrame);
|
||||||
wxTestableFrame);
|
|
||||||
|
|
||||||
m_win->Connect(m_type,
|
m_win->Connect(m_type, wxEventHandler(wxTestableFrame::OnEvent),
|
||||||
wxEventHandler(wxTestableFrame::OnEvent),
|
NULL, m_frame);
|
||||||
NULL,
|
|
||||||
m_frame);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EventCounter::~EventCounter()
|
EventCounter::~EventCounter()
|
||||||
{
|
{
|
||||||
m_win->Disconnect(m_type,
|
m_win->Disconnect(m_type, wxEventHandler(wxTestableFrame::OnEvent),
|
||||||
wxEventHandler(wxTestableFrame::OnEvent),
|
NULL, m_frame);
|
||||||
NULL,
|
|
||||||
m_frame);
|
|
||||||
|
|
||||||
//This stops spurious counts from previous tests
|
//This stops spurious counts from previous tests
|
||||||
m_frame->ClearEventCount(m_type);
|
Clear();
|
||||||
|
|
||||||
m_frame = NULL;
|
m_frame = NULL;
|
||||||
m_win = NULL;
|
m_win = NULL;
|
||||||
|
@@ -18,13 +18,12 @@ public:
|
|||||||
|
|
||||||
void OnEvent(wxEvent& evt);
|
void OnEvent(wxEvent& evt);
|
||||||
|
|
||||||
//wxEVT_ANY get the count for all events or a type can be specified
|
private:
|
||||||
int GetEventCount(wxEventType type = wxEVT_ANY);
|
friend class EventCounter;
|
||||||
|
|
||||||
//Used to clear an event count, after disconnecting a counter for example
|
int GetEventCount(wxEventType type);
|
||||||
void ClearEventCount(wxEventType type);
|
void ClearEventCount(wxEventType type);
|
||||||
|
|
||||||
private:
|
|
||||||
wxLongToLongHashMap m_count;
|
wxLongToLongHashMap m_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -34,6 +33,9 @@ public:
|
|||||||
EventCounter(wxWindow* win, wxEventType type);
|
EventCounter(wxWindow* win, wxEventType type);
|
||||||
~EventCounter();
|
~EventCounter();
|
||||||
|
|
||||||
|
int GetCount() { return m_frame->GetEventCount(m_type); }
|
||||||
|
void Clear() { m_frame->ClearEventCount(m_type); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxEventType m_type;
|
wxEventType m_type;
|
||||||
wxTestableFrame* m_frame;
|
wxTestableFrame* m_frame;
|
||||||
|
Reference in New Issue
Block a user