diff --git a/tests/controls/textentrytest.cpp b/tests/controls/textentrytest.cpp index e24db45622..ee689bad64 100644 --- a/tests/controls/textentrytest.cpp +++ b/tests/controls/textentrytest.cpp @@ -464,7 +464,21 @@ private: void SimulateEnter() { wxUIActionSimulator sim; + + // Calling SetFocus() is somehow not enough to give the focus to this + // window when running this test with wxGTK, apparently because the + // dialog itself needs to be raised to the front first, so simulate a + // click doing this. + sim.MouseMove(m_control->GetScreenPosition() + wxPoint(5, 5)); + wxYield(); + sim.MouseClick(); + wxYield(); + + // Note that clicking it is still not enough to give it focus with + // wxGTK neither, so we still need to call SetFocus() nevertheless: but + // now it works. m_control->SetFocus(); + sim.Char(WXK_RETURN); }