This behavior goes back to at least Windows XP. But Wine depends on MoveToEx() returning the old point and changing Wine does not seem necessary. So expect the documented behavior and mark the current Windows behavior as broken.
Signed-off-by: Francois Gouget fgouget@codeweavers.com ---
v3: Accept the documented behavior. Wine no longer needs a todo. Better document the Windows behavior.
dlls/gdi32/painting.c | 3 +++ dlls/gdi32/tests/metafile.c | 16 ++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/dlls/gdi32/painting.c b/dlls/gdi32/painting.c index 81937b8bbb4..f0aee5b8d8c 100644 --- a/dlls/gdi32/painting.c +++ b/dlls/gdi32/painting.c @@ -257,6 +257,9 @@ BOOL WINAPI LineTo( HDC hdc, INT x, INT y )
/*********************************************************************** * MoveToEx (GDI32.@) + * + * Wine returns the previous position in pt as per the documentation. + * However note that no Windows version does since at least XP. */ BOOL WINAPI MoveToEx( HDC hdc, INT x, INT y, LPPOINT pt ) { diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c index ca433b33c03..84fefb305f4 100644 --- a/dlls/gdi32/tests/metafile.c +++ b/dlls/gdi32/tests/metafile.c @@ -2259,16 +2259,16 @@ static void test_mf_Graphics(void) ok( ret, "MoveToEx error %d.\n", GetLastError()); ret = LineTo(hdcMetafile, 2, 2); ok( ret, "LineTo error %d.\n", GetLastError()); + oldpoint.x = oldpoint.y = 11235; ret = MoveToEx(hdcMetafile, 1, 1, &oldpoint); ok( ret, "MoveToEx error %d.\n", GetLastError()); - -/* oldpoint gets garbage under Win XP, so the following test would - * work under Wine but fails under Windows: - * - * ok((oldpoint.x == 2) && (oldpoint.y == 2), - * "MoveToEx: (x, y) = (%ld, %ld), should be (2, 2).\n", - * oldpoint.x, oldpoint.y); - */ + /* We want Wine to return the old position as per the documentation. + * But Windows since at least XP does not. + */ + ok((oldpoint.x == 2 && oldpoint.y == 2) || + broken(oldpoint.x == 11235 && oldpoint.y == 11235), + "MoveToEx: oldpoint = (%d, %d), should be (11235, 11235).\n", + oldpoint.x, oldpoint.y);
ret = Ellipse(hdcMetafile, 0, 0, 2, 2); ok( ret, "Ellipse error %d.\n", GetLastError());
On Thu, Nov 28, 2019 at 01:08:34PM +0100, Francois Gouget wrote:
This behavior goes back to at least Windows XP. But Wine depends on MoveToEx() returning the old point and changing Wine does not seem necessary. So expect the documented behavior and mark the current Windows behavior as broken.
Signed-off-by: Francois Gouget fgouget@codeweavers.com
v3: Accept the documented behavior. Wine no longer needs a todo. Better document the Windows behavior.
dlls/gdi32/painting.c | 3 +++ dlls/gdi32/tests/metafile.c | 16 ++++++++-------- 2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/dlls/gdi32/painting.c b/dlls/gdi32/painting.c index 81937b8bbb4..f0aee5b8d8c 100644 --- a/dlls/gdi32/painting.c +++ b/dlls/gdi32/painting.c @@ -257,6 +257,9 @@ BOOL WINAPI LineTo( HDC hdc, INT x, INT y )
/***********************************************************************
MoveToEx (GDI32.@)
- Wine returns the previous position in pt as per the documentation.
*/
- However note that no Windows version does since at least XP.
I'm pretty sure Windows does return the previous position on dcs that aren't metafile dcs, so this really doesn't belong here.
Huw.
On Thu, 28 Nov 2019, Huw Davies wrote: [...]
/***********************************************************************
MoveToEx (GDI32.@)
- Wine returns the previous position in pt as per the documentation.
*/
- However note that no Windows version does since at least XP.
I'm pretty sure Windows does return the previous position on dcs that aren't metafile dcs, so this really doesn't belong here.
Ah. On to v4 then.
On Thu, Nov 28, 2019 at 01:43:31PM +0100, Francois Gouget wrote:
On Thu, 28 Nov 2019, Huw Davies wrote: [...]
/***********************************************************************
MoveToEx (GDI32.@)
- Wine returns the previous position in pt as per the documentation.
*/
- However note that no Windows version does since at least XP.
I'm pretty sure Windows does return the previous position on dcs that aren't metafile dcs, so this really doesn't belong here.
Ah. On to v4 then.
If you'd like to add some tests for MoveToEx() on regular dcs then that might actually make this patch useful (rather than just adding a test for an obscure corner case that nobody should care about...)
Huw.