Re: user32: Add tests and fix for the edit control parent notification
"Ilya Shpigor" <shpigor(a)etersoft.ru> wrote:
- /* why do we notify to es->hwndParent, and we send this one to GetParent()? */ - hbrush = (HBRUSH)SendMessageW(GetParent(es->hwndSelf), msg, (WPARAM)hdc, (LPARAM)es->hwndSelf); + /* We must send all notifies to es->hwndParent. + * If es->hwndParent don't response, we call + * DefWindowProcW of the current parent. + */ + + hbrush = (HBRUSH)SendMessageW(es->hwndParent, msg, (WPARAM)hdc, (LPARAM)es->hwndSelf); if (!hbrush) hbrush = (HBRUSH)DefWindowProcW(GetParent(es->hwndSelf), msg, (WPARAM)hdc, (LPARAM)es->hwndSelf); return hbrush;
If you have changed the target in the SendMessage call, shouldn't you do the same for DefWindowProc?
+ SendMessage( hwEdit, WM_PAINT, (WPARAM)GetDC( hwEdit ), 0 ); + syscolor = GetPixel( GetDC( hwEdit ), PIXEL_X, PIXEL_Y ); + + SetParent( hwEdit, hwParent2 ); + DestroyWindow( hwParent1 ); + + SendMessage( hwEdit, WM_PAINT, (WPARAM)GetDC( hwEdit ), 0 ); + editcolor = GetPixel( GetDC( hwEdit ), PIXEL_X, PIXEL_Y ); + + ok( editcolor == syscolor, "Child color is wrong, child = %04x\n", editcolor ); + + DestroyWindow( hwEdit ); + DestroyWindow( hwParent2 ); +}
You are leaking a DC in the test. From your fix it looks like you need to test the message sequences instead of the pixel color (which is not reliable). Same applies to your other patch. -- Dmitry.
participants (1)
-
Dmitry Timoshkov