Fix ProcessEnter unit tests when running it on its own with wxGTK
Apparently setting focus doesn't work until a mouse click is simulated to bring up the main test window to the front. This happened implicitly when running the full test suite, due to e.g. doing it in wxButton unit tests, which come before wxComboBox::ProcessEnter test, but not when running just this test (or wxTextCtrl::ProcessEnter) on its own. Make the test self-contained by simulating a mouse click before simulating pressing "Enter".
This commit is contained in:
parent
e6bac095ca
commit
9dbf063a75
@ -464,7 +464,21 @@ private:
|
|||||||
void SimulateEnter()
|
void SimulateEnter()
|
||||||
{
|
{
|
||||||
wxUIActionSimulator sim;
|
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();
|
m_control->SetFocus();
|
||||||
|
|
||||||
sim.Char(WXK_RETURN);
|
sim.Char(WXK_RETURN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user