From a8c1ae705818425435231498e7c729449418eb39 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 22 Jun 2018 02:43:23 +0200 Subject: [PATCH] Fix TLW activation unit test Ensure that another TLW is active before calling ShowWithoutActivating() as otherwise the newly shown window would be considered active, even if it actually isn't, because it contains the current focus. --- tests/toplevel/toplevel.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/toplevel/toplevel.cpp b/tests/toplevel/toplevel.cpp index 60722f0ce2..799f35fd10 100644 --- a/tests/toplevel/toplevel.cpp +++ b/tests/toplevel/toplevel.cpp @@ -17,6 +17,7 @@ #endif #ifndef WX_PRECOMP + #include "wx/app.h" #include "wx/dialog.h" #include "wx/frame.h" #include "wx/textctrl.h" @@ -32,6 +33,7 @@ static void TopLevelWindowShowTest(wxTopLevelWindow* tlw) // only run this test on platforms where ShowWithoutActivating is implemented. #if defined(__WXMSW__) || defined(__WXMAC__) + wxTheApp->GetTopWindow()->SetFocus(); tlw->ShowWithoutActivating(); CHECK(tlw->IsShown()); CHECK(!tlw->IsActive()); @@ -53,7 +55,7 @@ static void TopLevelWindowShowTest(wxTopLevelWindow* tlw) tlw->Hide(); CHECK(!tlw->IsShown()); #ifndef __WXGTK__ - CHECK(tlw->IsActive()); + CHECK(!tlw->IsActive()); #endif }