From 6530323f31de7a852acdff45afe00aa27e982720 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 27 Oct 2019 01:31:21 +0200 Subject: [PATCH] Add unit test for wxWindow::IsThisEnabled() Check that the child IsEnabled() returns false if its parent is disabled, but its IsThisEnabled() still returns true in this case. --- tests/controls/windowtest.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/controls/windowtest.cpp b/tests/controls/windowtest.cpp index a9ff914f5d..1c3fcc1b81 100644 --- a/tests/controls/windowtest.cpp +++ b/tests/controls/windowtest.cpp @@ -364,6 +364,28 @@ TEST_CASE_METHOD(WindowTestCase, "Window::Enable", "[window]") m_window->Enable(false); CHECK(!m_window->IsEnabled()); + m_window->Enable(); + + + wxWindow* const child = new wxWindow(m_window, wxID_ANY); + CHECK(child->IsEnabled()); + CHECK(child->IsThisEnabled()); + + m_window->Disable(); + CHECK(!child->IsEnabled()); + CHECK(child->IsThisEnabled()); + + child->Disable(); + CHECK(!child->IsEnabled()); + CHECK(!child->IsThisEnabled()); + + m_window->Enable(); + CHECK(!child->IsEnabled()); + CHECK(!child->IsThisEnabled()); + + child->Enable(); + CHECK(child->IsEnabled()); + CHECK(child->IsThisEnabled()); } TEST_CASE_METHOD(WindowTestCase, "Window::FindWindowBy", "[window]")