Send event when clearing wxTextCtrl in wxGTK again

This was broken by 1c946a469a and resulted
in test failures in OwnerDrawnComboBoxTestCase::TextChangeEvents() unit
test because wxOwnerDrawnComboBox::Clear() used SetValue("") and didn't
generate any events any more.

Fix this regression by explicitly sending an event if we're returning
early and add a unit test explicitly checking that SetValue("") does
generate an event.
This commit is contained in:
Vadim Zeitlin
2017-11-07 03:06:03 +01:00
parent 3069167dd4
commit 13163fb315
2 changed files with 9 additions and 0 deletions

View File

@@ -1046,7 +1046,12 @@ void wxTextCtrl::WriteText( const wxString &text )
wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") );
if ( text.empty() )
{
// We don't need to actually do anything, but we still need to generate
// an event expected from this call.
SendTextUpdatedEvent(this);
return;
}
// we're changing the text programmatically
DontMarkDirtyOnNextChange();