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.
This commit is contained in:
Vadim Zeitlin
2018-06-22 02:43:23 +02:00
parent c6523f016e
commit a8c1ae7058

View File

@@ -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
}