From: Vadim Zeitlin Date: Fri, 22 Oct 2010 16:33:43 +0000 (+0000) Subject: Enable ListBoxTestCase::HitTest() for wxGTK. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/3b5c96639b9214ff748b80bc54157535e76f3020?ds=inline Enable ListBoxTestCase::HitTest() for wxGTK. wxListBox::HitTest() does work in wxGTK but we need to realize the control before using it. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65867 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/tests/controls/listboxtest.cpp b/tests/controls/listboxtest.cpp index 22e9230fd7..2accf43119 100644 --- a/tests/controls/listboxtest.cpp +++ b/tests/controls/listboxtest.cpp @@ -245,7 +245,6 @@ void ListBoxTestCase::ClickNotOnItem() void ListBoxTestCase::HitTest() { -#if defined(__WXMSW__) || defined(__WXOSX__) wxArrayString testitems; testitems.Add("item 0"); testitems.Add("item 1"); @@ -253,12 +252,14 @@ void ListBoxTestCase::HitTest() m_list->Append(testitems); - CPPUNIT_ASSERT(m_list->HitTest(wxPoint(10, 10)) != wxNOT_FOUND); - CPPUNIT_ASSERT(m_list->HitTest(10, 10) != wxNOT_FOUND); - - CPPUNIT_ASSERT(m_list->HitTest(wxPoint(290, 190)) == wxNOT_FOUND); - CPPUNIT_ASSERT(m_list->HitTest(290, 190) == wxNOT_FOUND); +#ifdef __WXGTK__ + // The control needs to be realized for HitTest() to work. + wxYield(); #endif + + CPPUNIT_ASSERT_EQUAL( 0, m_list->HitTest(5, 5) ); + + CPPUNIT_ASSERT_EQUAL( wxNOT_FOUND, m_list->HitTest(290, 190) ); } #endif //wxUSE_LISTBOX