Make Window::Refresh test more robust under Mac

Fix CI test failure which started happening in this test after the
addition of Window::ContextHelpCaptureLost in e04e3260fc (Handle
context-help mouse capture loss, 2026-07-08) because the child window
that was not supposed to be repainted still was, as the entire window
needed a refresh.

Refresh and update it before starting the test to make it pass again
reliably.

See #26726.
This commit is contained in:
Vadim Zeitlin
2026-07-23 23:44:12 +02:00
parent 616675c0c8
commit 95a47a88a9
+9
View File
@@ -560,6 +560,15 @@ TEST_CASE_METHOD(WindowTestCase, "Window::SizerErrors", "[window][sizer][error]"
TEST_CASE_METHOD(WindowTestCase, "Window::Refresh", "[window]")
{
wxWindow* const parent = m_window;
// Ensure that the window doesn't need a redraw before starting this test:
// it could need one if some other window overlapping it created by a
// previously running test was destroyed but this window was not repainted
// after that yet. Without this, child1 could still get repainted even if
// we don't refresh it and this is exactly what happened under Mac.
parent->Refresh();
wxYield();
wxWindow* const child1 = new wxWindow(parent, wxID_ANY, wxPoint(10, 20), wxSize(80, 50));
wxWindow* const child2 = new wxWindow(parent, wxID_ANY, wxPoint(110, 20), wxSize(80, 50));
wxWindow* const child3 = new wxWindow(parent, wxID_ANY, wxPoint(210, 20), wxSize(80, 50));