Test that wxTreeCtrl::DeleteAllItems() does send events
This seems to be the case under all still supported MSW versions, so remove the note saying that the events might not be sent from the documentation and add a unit test verifying that they are indeed sent.
This commit is contained in:
parent
d9d05bc221
commit
3c8b9589d8
@ -310,9 +310,11 @@ public:
|
|||||||
virtual void Delete(const wxTreeItemId& item);
|
virtual void Delete(const wxTreeItemId& item);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Deletes all items in the control. Note that this may not generate
|
Deletes all items in the control.
|
||||||
@c EVT_TREE_DELETE_ITEM events under some Windows versions although
|
|
||||||
normally such event is generated for each removed item.
|
This function generates @c wxEVT_TREE_DELETE_ITEM events for each item
|
||||||
|
being deleted, including the root one if it is shown, i.e. unless
|
||||||
|
wxTR_HIDE_ROOT style is used.
|
||||||
*/
|
*/
|
||||||
virtual void DeleteAllItems();
|
virtual void DeleteAllItems();
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ private:
|
|||||||
WXUISIM_TEST( ItemClick );
|
WXUISIM_TEST( ItemClick );
|
||||||
CPPUNIT_TEST( DeleteItem );
|
CPPUNIT_TEST( DeleteItem );
|
||||||
CPPUNIT_TEST( DeleteChildren );
|
CPPUNIT_TEST( DeleteChildren );
|
||||||
|
CPPUNIT_TEST( DeleteAllItems );
|
||||||
WXUISIM_TEST( LabelEdit );
|
WXUISIM_TEST( LabelEdit );
|
||||||
WXUISIM_TEST( KeyDown );
|
WXUISIM_TEST( KeyDown );
|
||||||
#ifndef __WXGTK__
|
#ifndef __WXGTK__
|
||||||
@ -74,6 +75,7 @@ private:
|
|||||||
void ItemClick();
|
void ItemClick();
|
||||||
void DeleteItem();
|
void DeleteItem();
|
||||||
void DeleteChildren();
|
void DeleteChildren();
|
||||||
|
void DeleteAllItems();
|
||||||
void LabelEdit();
|
void LabelEdit();
|
||||||
void KeyDown();
|
void KeyDown();
|
||||||
#ifndef __WXGTK__
|
#ifndef __WXGTK__
|
||||||
@ -271,8 +273,6 @@ void TreeCtrlTestCase::DeleteItem()
|
|||||||
|
|
||||||
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
|
|
||||||
// are not generated.
|
|
||||||
|
|
||||||
CPPUNIT_ASSERT_EQUAL(1, deleteitem.GetCount());
|
CPPUNIT_ASSERT_EQUAL(1, deleteitem.GetCount());
|
||||||
}
|
}
|
||||||
@ -287,6 +287,15 @@ void TreeCtrlTestCase::DeleteChildren()
|
|||||||
CHECK( deletechildren.GetCount() == 2 );
|
CHECK( deletechildren.GetCount() == 2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TreeCtrlTestCase::DeleteAllItems()
|
||||||
|
{
|
||||||
|
EventCounter deleteall(m_tree, wxEVT_TREE_DELETE_ITEM);
|
||||||
|
|
||||||
|
m_tree->DeleteAllItems();
|
||||||
|
|
||||||
|
CHECK( deleteall.GetCount() == 4 );
|
||||||
|
}
|
||||||
|
|
||||||
#if wxUSE_UIACTIONSIMULATOR
|
#if wxUSE_UIACTIONSIMULATOR
|
||||||
|
|
||||||
void TreeCtrlTestCase::LabelEdit()
|
void TreeCtrlTestCase::LabelEdit()
|
||||||
|
Loading…
Reference in New Issue
Block a user