From 8064d9420fce8b9a4b34134281b2c12ea426d33e Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 17 Oct 2019 22:26:37 +0200 Subject: [PATCH] Fix the just added wxDataViewCtrl::DeleteAllItems() test Using GetTopItem() was wrong, we actually need to use the invalid item, which corresponds to the "virtual root" of wxDataViewTreeStore. --- tests/controls/dataviewctrltest.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/controls/dataviewctrltest.cpp b/tests/controls/dataviewctrltest.cpp index a2fd853698..654e886248 100644 --- a/tests/controls/dataviewctrltest.cpp +++ b/tests/controls/dataviewctrltest.cpp @@ -266,12 +266,14 @@ TEST_CASE_METHOD(SingleSelectDataViewCtrlTestCase, "wxDVC::DeleteAllItems", "[wxDataViewCtrl][delete]") { - const wxDataViewItem top = m_dvc->GetTopItem(); - CHECK( m_dvc->GetChildCount(top) == 1 ); + // The invalid item corresponds to the root of tree store model, so it + // should have a single item (our m_root) initially. + CHECK( m_dvc->GetChildCount(wxDataViewItem()) == 1 ); m_dvc->DeleteAllItems(); - CHECK( m_dvc->GetChildCount(top) == 0 ); + // And none at all after deleting all the items. + CHECK( m_dvc->GetChildCount(wxDataViewItem()) == 0 ); } #endif //wxUSE_DATAVIEWCTRL