Adjust point to be tested in wxListBox::HitTest for macOS 11

On macOS >= 11 wxListBox has a new layout because underlying
NSTableView has a new style with padding so we need to move
the point to be tested to another position.
This commit is contained in:
Artur Wieczorek
2021-09-21 20:56:28 +02:00
committed by AW
parent ce9f8d065a
commit 37ad7bb30e

View File

@@ -265,7 +265,17 @@ void ListBoxTestCase::HitTest()
wxYield();
#endif
CPPUNIT_ASSERT_EQUAL( 0, m_list->HitTest(5, 5) );
wxPoint p(5, 5);
#ifdef __WXOSX__
// On macOS >= 11 wxListBox has a new layout because underlying
// NSTableView has a new style with padding so we need to move
// the point to be tested to another position.
if ( wxCheckOsVersion(11, 0) )
{
p = wxPoint(10, 10);
}
#endif
CPPUNIT_ASSERT_EQUAL( 0, m_list->HitTest(p) );
CPPUNIT_ASSERT_EQUAL( wxNOT_FOUND, m_list->HitTest(290, 190) );
}