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:
@@ -17,6 +17,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/app.h"
|
||||||
#include "wx/dialog.h"
|
#include "wx/dialog.h"
|
||||||
#include "wx/frame.h"
|
#include "wx/frame.h"
|
||||||
#include "wx/textctrl.h"
|
#include "wx/textctrl.h"
|
||||||
@@ -32,6 +33,7 @@ static void TopLevelWindowShowTest(wxTopLevelWindow* tlw)
|
|||||||
|
|
||||||
// only run this test on platforms where ShowWithoutActivating is implemented.
|
// only run this test on platforms where ShowWithoutActivating is implemented.
|
||||||
#if defined(__WXMSW__) || defined(__WXMAC__)
|
#if defined(__WXMSW__) || defined(__WXMAC__)
|
||||||
|
wxTheApp->GetTopWindow()->SetFocus();
|
||||||
tlw->ShowWithoutActivating();
|
tlw->ShowWithoutActivating();
|
||||||
CHECK(tlw->IsShown());
|
CHECK(tlw->IsShown());
|
||||||
CHECK(!tlw->IsActive());
|
CHECK(!tlw->IsActive());
|
||||||
@@ -53,7 +55,7 @@ static void TopLevelWindowShowTest(wxTopLevelWindow* tlw)
|
|||||||
tlw->Hide();
|
tlw->Hide();
|
||||||
CHECK(!tlw->IsShown());
|
CHECK(!tlw->IsShown());
|
||||||
#ifndef __WXGTK__
|
#ifndef __WXGTK__
|
||||||
CHECK(tlw->IsActive());
|
CHECK(!tlw->IsActive());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user