[PATCH v3] gdi32/tests: MoveToEx() does not return the old point.

Francois Gouget fgouget at codeweavers.com
Thu Nov 28 06:08:34 CST 2019


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 at 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());
-- 
2.20.1



More information about the wine-devel mailing list