Add unit test for wxTextCtrl::EmptyUndoBuffer()
Check that calling it results in CanUndo() returning false and really prevents Undo() from working.
This commit is contained in:
parent
adacb5c07e
commit
64f7c23272
@ -1472,4 +1472,35 @@ TEST_CASE("wxTextCtrl::InitialCanUndo", "[wxTextCtrl][undo]")
|
||||
}
|
||||
}
|
||||
|
||||
// This test would always fail with MinGW-32 for the same reason as described
|
||||
// above.
|
||||
#ifndef __MINGW32_TOOLCHAIN__
|
||||
|
||||
TEST_CASE("wxTextCtrl::EmptyUndoBuffer", "[wxTextCtrl][undo]")
|
||||
{
|
||||
wxScopedPtr<wxTextCtrl> text(new wxTextCtrl(wxTheApp->GetTopWindow(),
|
||||
wxID_ANY, "",
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
wxTE_MULTILINE | wxTE_RICH2));
|
||||
|
||||
text->AppendText("foo");
|
||||
|
||||
if ( !text->CanUndo() )
|
||||
{
|
||||
WARN("Skipping test as Undo() is not supported on this platform.");
|
||||
return;
|
||||
}
|
||||
|
||||
text->EmptyUndoBuffer();
|
||||
|
||||
CHECK_FALSE( text->CanUndo() );
|
||||
|
||||
CHECK_NOTHROW( text->Undo() );
|
||||
|
||||
CHECK( text->GetValue() == "foo" );
|
||||
}
|
||||
|
||||
#endif // __MINGW32_TOOLCHAIN__
|
||||
|
||||
#endif //wxUSE_TEXTCTRL
|
||||
|
Loading…
Reference in New Issue
Block a user