From d7d8998d1e38080893ba7b95439b30efc5183b78 Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Fri, 28 Oct 2005 16:41:25 +0000 Subject: [PATCH] xform can be NULL when setting the identity. --- dlls/gdi/dc.c | 2 +- dlls/gdi/tests/.cvsignore | 1 + dlls/gdi/tests/Makefile.in | 1 + dlls/gdi/tests/mapping.c | 59 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 dlls/gdi/tests/mapping.c diff --git a/dlls/gdi/dc.c b/dlls/gdi/dc.c index 0fd62812095..8168a13ff36 100644 --- a/dlls/gdi/dc.c +++ b/dlls/gdi/dc.c @@ -1217,7 +1217,7 @@ BOOL WINAPI ModifyWorldTransform( HDC hdc, const XFORM *xform, /* Check for illegal parameters */ if (!dc) return FALSE; - if (!xform) goto done; + if (!xform && iMode != MWT_IDENTITY) goto done; /* Check that graphics mode is GM_ADVANCED */ if (dc->GraphicsMode!=GM_ADVANCED) goto done; diff --git a/dlls/gdi/tests/.cvsignore b/dlls/gdi/tests/.cvsignore index 47ec78485ec..38c8561ef32 100644 --- a/dlls/gdi/tests/.cvsignore +++ b/dlls/gdi/tests/.cvsignore @@ -4,6 +4,7 @@ brush.ok clipping.ok gdiobj.ok generated.ok +mapping.ok metafile.ok palette.ok testlist.c diff --git a/dlls/gdi/tests/Makefile.in b/dlls/gdi/tests/Makefile.in index ce36808a21e..6d2516d4ba0 100644 --- a/dlls/gdi/tests/Makefile.in +++ b/dlls/gdi/tests/Makefile.in @@ -11,6 +11,7 @@ CTESTS = \ clipping.c \ gdiobj.c \ generated.c \ + mapping.c \ metafile.c \ palette.c diff --git a/dlls/gdi/tests/mapping.c b/dlls/gdi/tests/mapping.c new file mode 100644 index 00000000000..a7fdda92e60 --- /dev/null +++ b/dlls/gdi/tests/mapping.c @@ -0,0 +1,59 @@ +/* + * Unit tests for mapping functions + * + * Copyright (c) 2005 Huw Davies + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include +#include + +#include "wine/test.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "winerror.h" + + +void test_modify_world_transform(void) +{ + HDC hdc = GetDC(0); + int ret; + + ret = SetGraphicsMode(hdc, GM_ADVANCED); + if(!ret) /* running in win9x so quit */ + { + ReleaseDC(0, hdc); + return; + } + + ret = ModifyWorldTransform(hdc, NULL, MWT_IDENTITY); + ok(ret, "ret = %d\n", ret); + + ret = ModifyWorldTransform(hdc, NULL, MWT_LEFTMULTIPLY); + ok(!ret, "ret = %d\n", ret); + + ret = ModifyWorldTransform(hdc, NULL, MWT_RIGHTMULTIPLY); + ok(!ret, "ret = %d\n", ret); + + ReleaseDC(0, hdc); +} + +START_TEST(mapping) +{ + test_modify_world_transform(); +}