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:
@@ -1046,7 +1046,12 @@ void wxTextCtrl::WriteText( const wxString &text )
|
|||||||
wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") );
|
wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") );
|
||||||
|
|
||||||
if ( text.empty() )
|
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;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// we're changing the text programmatically
|
// we're changing the text programmatically
|
||||||
DontMarkDirtyOnNextChange();
|
DontMarkDirtyOnNextChange();
|
||||||
|
@@ -57,6 +57,10 @@ void TextEntryTestCase::TextChangeEvents()
|
|||||||
CPPUNIT_ASSERT_EQUAL( 1, updated.GetCount() );
|
CPPUNIT_ASSERT_EQUAL( 1, updated.GetCount() );
|
||||||
updated.Clear();
|
updated.Clear();
|
||||||
|
|
||||||
|
entry->SetValue("");
|
||||||
|
CPPUNIT_ASSERT_EQUAL( 1, updated.GetCount() );
|
||||||
|
updated.Clear();
|
||||||
|
|
||||||
entry->ChangeValue("bar");
|
entry->ChangeValue("bar");
|
||||||
CPPUNIT_ASSERT_EQUAL( 0, updated.GetCount() );
|
CPPUNIT_ASSERT_EQUAL( 0, updated.GetCount() );
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user