I think we also need a test to prove that "return MapWindowPoints( hwnd,
0, lppnt, 1 ) != 0;" is wrong. I'd probably split the changes to
ScreenToClient/ClientToScreen and MapWindowPoints, because they are not
necessarily bound together.
What about something like:
wnd2 = CreateWindow("static", "wnd2", WS_POPUP, 0, 0, 150, 150, NULL,
NULL, NULL, NULL);
ok(wnd2 != NULL, "CreateWindow failed\n");
SetLastError(0xdeadbeef);
p.x = p.y = 0;
ret = ScreenToClient(wnd2, &p);
err = GetLastError();
ok(ret, "ScreenToClient() failed\n");
ok(p.x == 0 && p.y == 0, "Failed got(%d, %d), expected (%d, %d)\n", p.x,
p.y, 0, 0);
ok(err == 0xdeadbeef, "GetLastError failed, got %x, expected %x\n", err,
0xdeadbeef);
Also msdn says: "Do not use ScreenToClient when in a mirroring
situation, that is, when changing from left-to-right layout to
right-to-left layout. Instead, use MapWindowPoints. For more
information, see "Window Layout and Mirroring" in Window Features." We
may also check that case. So they may not share the exact same steps.
Cheers
Rico
On 20.10.2012 12:27, Christian Costa wrote:
> Based ont a patch of Rico Schuller.
>
> Try 2:
> - Test window handle in ClienToScreen and ScreenToClient instead of relying on GetLastError().
> - Don't rename params.
> ---
> dlls/user32/tests/win.c | 213 +++++++++++++++++++++++++++++++++++++++++++++++
> dlls/user32/winpos.c | 28 +++++-
> 2 files changed, 237 insertions(+), 4 deletions(-)