Fix wxShowEvent not being received for maximized frames on MSW
Send wxEVT_SHOW explicitly when showing a maximized TLW under MSW as the system doesn't send WM_SHOW in this case (as documented in the MSDN and also confirmed by testing). Closes https://github.com/wxWidgets/wxWidgets/pull/1153
This commit is contained in:
committed by
Vadim Zeitlin
parent
f10939862a
commit
63432e5ef5
@@ -24,6 +24,8 @@
|
||||
#include "wx/toplevel.h"
|
||||
#endif // WX_PRECOMP
|
||||
|
||||
#include "testableframe.h"
|
||||
|
||||
static void TopLevelWindowShowTest(wxTopLevelWindow* tlw)
|
||||
{
|
||||
CHECK(!tlw->IsShown());
|
||||
@@ -75,3 +77,30 @@ TEST_CASE("wxTopLevel::Show", "[tlw][show]")
|
||||
frame->Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
// Check that we receive the expected event when showing the TLW.
|
||||
TEST_CASE("wxTopLevel::ShowEvent", "[tlw][show][event]")
|
||||
{
|
||||
wxFrame* const frame = new wxFrame(NULL, wxID_ANY, "Maximized frame");
|
||||
|
||||
EventCounter countShow(frame, wxEVT_SHOW);
|
||||
|
||||
frame->Maximize();
|
||||
frame->Show();
|
||||
|
||||
// Wait for the event to be received for the maximum of 2 seconds.
|
||||
int showCount = 0;
|
||||
for ( int i = 0; i < 40; i++ )
|
||||
{
|
||||
wxYield();
|
||||
|
||||
showCount = countShow.GetCount();
|
||||
|
||||
if ( showCount )
|
||||
break;
|
||||
|
||||
wxMilliSleep(50);
|
||||
}
|
||||
|
||||
CHECK( showCount == 1 );
|
||||
}
|
||||
|
Reference in New Issue
Block a user