diff --git a/tests/controls/textctrltest.cpp b/tests/controls/textctrltest.cpp index 7098df48f8..d2dbc53222 100644 --- a/tests/controls/textctrltest.cpp +++ b/tests/controls/textctrltest.cpp @@ -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 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