Add a hack to make wxGrid UI unit test pass

This is an ugly workaround for a mysterious problem occurring with the
simulated "Enter" presses under GTK, but it's worth it, as it allows all
grid tests, including the ones using wxUIActionSimulator, to pass now
under wxGTK2 (a couple of tests still fail under wxGTK3).
This commit is contained in:
Vadim Zeitlin
2019-10-15 03:18:28 +02:00
parent f65133a41f
commit ed783b95f8

View File

@@ -818,6 +818,16 @@ void GridTestCase::ReadOnly()
CPPUNIT_ASSERT(m_grid->IsReadOnly(1, 1)); CPPUNIT_ASSERT(m_grid->IsReadOnly(1, 1));
m_grid->SetFocus(); m_grid->SetFocus();
#ifdef __WXGTK__
// This is a mystery, but we somehow get WXK_RETURN generated by the
// previous test (Editable) in this one. In spite of wxYield() in that
// test, the key doesn't get dispatched there and we have to consume it
// here before setting the current grid cell, as getting WXK_RETURN later
// would move the selection down, to a non read-only cell.
wxYield();
#endif // __WXGTK__
m_grid->SetGridCursor(1, 1); m_grid->SetGridCursor(1, 1);
CPPUNIT_ASSERT(m_grid->IsCurrentCellReadOnly()); CPPUNIT_ASSERT(m_grid->IsCurrentCellReadOnly());