From ec207536850b325cfb6967cafcc386466f659bb5 Mon Sep 17 00:00:00 2001 From: ali kettab Date: Mon, 22 Feb 2021 14:31:20 +0100 Subject: [PATCH] Add tests showing transferring data (to, from) self (window) works correctly --- tests/validators/valtext.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/validators/valtext.cpp b/tests/validators/valtext.cpp index fcd2d8adaf..893577ea05 100644 --- a/tests/validators/valtext.cpp +++ b/tests/validators/valtext.cpp @@ -184,4 +184,30 @@ TEXT_VALIDATOR_TEST_CASE("wxTextValidator::IsValid", "[wxTextValidator][filters] } } +TEXT_VALIDATOR_TEST_CASE("wxTextValidator::TransferToWindow", "[wxTextValidator][transferdata]") +{ + wxString value = "wxwidgets"; + wxTextValidator val(wxFILTER_ALPHA, &value); + m_text->SetValidator(val); + + CHECK( m_text->IsEmpty() ); + + REQUIRE( m_text->TransferDataToWindow() ); + + CHECK( m_text->GetValue() == "wxwidgets" ); +} + +TEXT_VALIDATOR_TEST_CASE("wxTextValidator::TransferFromWindow", "[wxTextValidator][transferdata]") +{ + wxString value; + wxTextValidator val(wxFILTER_ALPHA, &value); + m_text->SetValidator(val); + + m_text->ChangeValue("wxwidgets"); + + REQUIRE( m_text->TransferDataFromWindow() ); + + CHECK( value == "wxwidgets" ); +} + #endif // wxUSE_VALIDATORS && wxUSE_UIACTIONSIMULATOR