From 80e13ad372653fd58e1b01db9479c65e8095d1a3 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 16 Nov 2010 22:38:26 +0000 Subject: [PATCH] Avoid asserts due to not overriding OnGetItemText() in VirtListCtrlTestCase. A virtual list control must override wxListCtrl::OnGetItemText() method and wxMSW native implementation asserts if this is not the case (the generic one should arguably do it as well). Avoid the asserts by providing a dummy implementation of OnGetItemText() in the unit test. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66171 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- tests/controls/virtlistctrltest.cpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/tests/controls/virtlistctrltest.cpp b/tests/controls/virtlistctrltest.cpp index ea049042f4..1d52ce5df5 100644 --- a/tests/controls/virtlistctrltest.cpp +++ b/tests/controls/virtlistctrltest.cpp @@ -61,9 +61,26 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( VirtListCtrlTestCase, "VirtListCtrlTestCa void VirtListCtrlTestCase::setUp() { - m_list = new wxListCtrl(wxTheApp->GetTopWindow(), wxID_ANY, - wxPoint(0, 0), wxSize(400, 200), - wxLC_REPORT | wxLC_VIRTUAL); + // Define a class overriding OnGetItemText() which must be overridden for + // any virtual list control. + class VirtListCtrl : public wxListCtrl + { + public: + VirtListCtrl() + : wxListCtrl(wxTheApp->GetTopWindow(), wxID_ANY, + wxPoint(0, 0), wxSize(400, 200), + wxLC_REPORT | wxLC_VIRTUAL) + { + } + + protected: + virtual wxString OnGetItemText(long item, long column) const + { + return wxString::Format("Row %ld, col %ld", item, column); + } + }; + + m_list = new VirtListCtrl; } void VirtListCtrlTestCase::tearDown() -- 2.45.2