From 1ddf2ee303d8f35ce21677eed79acc18fcd4e2c8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 17 Jan 2021 00:09:11 +0100 Subject: [PATCH] Check that calling GetString() with invalid index asserts This is the behaviour that would be normally expected and now really happens for all the controls, including wxChoice. --- tests/controls/itemcontainertest.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/controls/itemcontainertest.cpp b/tests/controls/itemcontainertest.cpp index ffc49d0197..7c28b1a0f9 100644 --- a/tests/controls/itemcontainertest.cpp +++ b/tests/controls/itemcontainertest.cpp @@ -71,6 +71,7 @@ void ItemContainerTestCase::Count() wxItemContainer * const container = GetContainer(); CPPUNIT_ASSERT(container->IsEmpty()); + WX_ASSERT_FAILS_WITH_ASSERT( container->GetString(0) ); wxArrayString testitems; testitems.Add("item 0"); @@ -95,6 +96,7 @@ void ItemContainerTestCase::Count() container->Insert(testitems, 1); CPPUNIT_ASSERT_EQUAL(5, container->GetCount()); + WX_ASSERT_FAILS_WITH_ASSERT( container->GetString(10) ); } void ItemContainerTestCase::ItemSelection()