diff --git a/tests/controls/listboxtest.cpp b/tests/controls/listboxtest.cpp index 2accf43119..2a3121f0b4 100644 --- a/tests/controls/listboxtest.cpp +++ b/tests/controls/listboxtest.cpp @@ -226,6 +226,13 @@ void ListBoxTestCase::ClickNotOnItem() m_list->Append(testitems); + // It is important to set a valid selection: if the control doesn't have + // any, clicking anywhere in it, even outside of any item, selects the + // first item in the control under GTK resulting in a selection changed + // event. This is not a wx bug, just the native platform behaviour so + // simply avoid it by starting with a valid selection. + m_list->SetSelection(0); + m_list->Update(); m_list->Refresh();