Fix Window::Refresh test: skip child-not-painted check on Wayland

GTK3 with a native Wayland backend doesn't support partial redraws at
all: any invalidation anywhere ends up repainting every window with
its own full bounds, so the check that a non-intersecting child stays
unpainted can never hold there. Skip it in that case, based on the
actual X11-vs-Wayland backend rather than the platform, since e.g. a
plain X11/XWayland session with a compositor does support this.
This commit is contained in:
Scott Talbert
2026-08-31 20:01:37 -04:00
parent 224a8d396a
commit 54c2d9df83
+12 -2
View File
@@ -30,6 +30,10 @@
#include "wx/tooltip.h"
#include "wx/wupdlock.h"
#ifdef __WXGTK__
#include "wx/gtk/private/backend.h"
#endif // __WXGTK__
class WindowTestCase
{
@@ -627,9 +631,15 @@ TEST_CASE_METHOD(WindowTestCase, "Window::Refresh", "[window]")
WaitFor("parent repaint", [&]() { return isParentPainted; }, 100);
// child1 should be the only window not to receive the wxEVT_PAINT event
// because it does not intersect with the refreshed rectangle.
// because it does not intersect with the refreshed rectangle. However,
// GTK3 with a native Wayland backend doesn't support partial redraws at
// all: any invalidation anywhere ends up repainting every window with
// its own full bounds, so don't check this there.
#ifdef __WXGTK3__
if ( wxGTKImpl::IsX11(nullptr) )
#endif // __WXGTK3__
CHECK(isChild1Painted == false);
CHECK(isParentPainted == true);
CHECK(isChild1Painted == false);
CHECK(isChild2Painted == true);
CHECK(isChild3Painted == true);
}