[APITESTS] Add NtGdiTransformPoints testcase (#1542)
authorKatayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
Mon, 29 Apr 2019 00:13:22 +0000 (09:13 +0900)
committerGitHub <noreply@github.com>
Mon, 29 Apr 2019 00:13:22 +0000 (09:13 +0900)
Add a testcase for NtGdiTransformPoints function. set_module_type(win32u... win32dll) CORE-15983

modules/rostests/apitests/win32nt/CMakeLists.txt
modules/rostests/apitests/win32nt/ntgdi/NtGdiTransformPoints.c [new file with mode: 0644]
modules/rostests/apitests/win32nt/testlist.c
modules/rostests/apitests/win32u/win32u_2k3sp2/CMakeLists.txt
modules/rostests/apitests/win32u/win32u_2ksp4/CMakeLists.txt
modules/rostests/apitests/win32u/win32u_ros/CMakeLists.txt
modules/rostests/apitests/win32u/win32u_vista/CMakeLists.txt
modules/rostests/apitests/win32u/win32u_xpsp2/CMakeLists.txt

index 516e940..918903b 100644 (file)
@@ -35,6 +35,7 @@ list(APPEND SOURCE
     ntgdi/NtGdiSelectPen.c
     ntgdi/NtGdiSetBitmapBits.c
     ntgdi/NtGdiSetDIBitsToDeviceInternal.c
+    ntgdi/NtGdiTransformPoints
 
 #    ntuser/NtUserCallHwnd.c
 #    ntuser/NtUserCallHwndLock.c
diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiTransformPoints.c b/modules/rostests/apitests/win32nt/ntgdi/NtGdiTransformPoints.c
new file mode 100644 (file)
index 0000000..33b4dfd
--- /dev/null
@@ -0,0 +1,364 @@
+/*
+ * PROJECT:     ReactOS api tests
+ * LICENSE:     LGPL-2.0-or-later (https://spdx.org/licenses/LGPL-2.0-or-later)
+ * PURPOSE:     Test for NtGdiTransformPoints
+ * COPYRIGHT:   Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
+ */
+
+#include <win32nt.h>
+
+START_TEST(NtGdiTransformPoints)
+{
+    HDC hDC;
+    POINT apt1[3], apt2[3];
+    BOOL ret;
+    SIZE siz;
+
+    /* NULL HDC */
+
+    SetLastError(0xDEADBEEF);
+    ret = NtGdiTransformPoints(NULL, NULL, NULL, 0, GdiDpToLp);
+    ok_int(ret, TRUE);
+    ok_err(0xDEADBEEF);
+
+    SetLastError(0xDEADBEEF);
+    ret = NtGdiTransformPoints(NULL, NULL, NULL, 1, GdiDpToLp);
+    ok_int(ret, FALSE);
+    ok_err(0xDEADBEEF);
+
+    SetLastError(0xDEADBEEF);
+    ret = NtGdiTransformPoints(NULL, apt1, NULL, 1, GdiDpToLp);
+    ok_int(ret, FALSE);
+    ok_err(0xDEADBEEF);
+
+    SetLastError(0xDEADBEEF);
+    ret = NtGdiTransformPoints(NULL, NULL, apt2, 1, GdiDpToLp);
+    ok_int(ret, FALSE);
+    ok_err(0xDEADBEEF);
+
+    SetLastError(0xDEADBEEF);
+    ret = NtGdiTransformPoints(NULL, apt1, apt1, 0, GdiDpToLp);
+    ok_int(ret, TRUE);
+    ok_err(0xDEADBEEF);
+
+    SetLastError(0xDEADBEEF);
+    ret = NtGdiTransformPoints(NULL, apt1, apt2, 0, GdiDpToLp);
+    ok_int(ret, TRUE);
+    ok_err(0xDEADBEEF);
+
+    SetLastError(0xDEADBEEF);
+    ret = NtGdiTransformPoints(NULL, apt1, apt2, 1, GdiDpToLp);
+    ok_int(ret, FALSE);
+    ok_err(0xDEADBEEF);
+
+    /* (HDC)1 */
+
+    SetLastError(0xDEADBEEF);
+    ret = NtGdiTransformPoints((HDC)1, NULL, NULL, 0, GdiDpToLp);
+    ok_int(ret, TRUE);
+    ok_err(0xDEADBEEF);
+
+    SetLastError(0xDEADBEEF);
+    ret = NtGdiTransformPoints((HDC)1, NULL, NULL, 1, GdiDpToLp);
+    ok_int(ret, FALSE);
+    ok_err(0xDEADBEEF);
+
+    SetLastError(0xDEADBEEF);
+    ret = NtGdiTransformPoints((HDC)1, apt1, NULL, 1, GdiDpToLp);
+    ok_int(ret, FALSE);
+    ok_err(0xDEADBEEF);
+
+    SetLastError(0xDEADBEEF);
+    ret = NtGdiTransformPoints((HDC)1, NULL, apt2, 1, GdiDpToLp);
+    ok_int(ret, FALSE);
+    ok_err(0xDEADBEEF);
+
+    SetLastError(0xDEADBEEF);
+    ret = NtGdiTransformPoints((HDC)1, apt1, apt1, 0, GdiDpToLp);
+    ok_int(ret, TRUE);
+    ok_err(0xDEADBEEF);
+
+    SetLastError(0xDEADBEEF);
+    ret = NtGdiTransformPoints((HDC)1, apt1, apt2, 0, GdiDpToLp);
+    ok_int(ret, TRUE);
+    ok_err(0xDEADBEEF);
+
+    SetLastError(0xDEADBEEF);
+    ret = NtGdiTransformPoints((HDC)1, apt1, apt2, 1, GdiDpToLp);
+    ok_int(ret, FALSE);
+    ok_err(0xDEADBEEF);
+
+    /* hDC */
+
+    hDC = CreateCompatibleDC(NULL);
+    ok(hDC != NULL, "hDC was NULL\n");
+
+    SetMapMode(hDC, MM_TEXT);
+
+    SetLastError(0xDEADBEEF);
+    ret = NtGdiTransformPoints(hDC, NULL, NULL, 0, GdiDpToLp);
+    ok_int(ret, TRUE);
+    ok_err(0xDEADBEEF);
+
+    SetLastError(0xDEADBEEF);
+    ret = NtGdiTransformPoints(hDC, NULL, NULL, 1, GdiDpToLp);
+    ok_int(ret, FALSE);
+    ok_err(0xDEADBEEF);
+
+    SetLastError(0xDEADBEEF);
+    ret = NtGdiTransformPoints(hDC, apt1, NULL, 1, GdiDpToLp);
+    ok_int(ret, FALSE);
+    ok_err(0xDEADBEEF);
+
+    SetLastError(0xDEADBEEF);
+    ret = NtGdiTransformPoints(hDC, NULL, apt2, 1, GdiDpToLp);
+    ok_int(ret, FALSE);
+    ok_err(0xDEADBEEF);
+
+    SetLastError(0xDEADBEEF);
+    ret = NtGdiTransformPoints(hDC, apt1, apt1, 0, GdiDpToLp);
+    ok_int(ret, TRUE);
+    ok_err(0xDEADBEEF);
+
+    SetLastError(0xDEADBEEF);
+    ret = NtGdiTransformPoints(hDC, apt1, apt2, 0, GdiDpToLp);
+    ok_int(ret, TRUE);
+    ok_err(0xDEADBEEF);
+
+    SetLastError(0xDEADBEEF);
+    apt1[0].x = apt1[0].y = 256;
+    ret = NtGdiTransformPoints(hDC, apt1, apt1, 1, GdiDpToLp);
+    ok_int(ret, TRUE);
+    ok_err(0xDEADBEEF);
+    ok_long(apt1[0].x, 256);
+    ok_long(apt1[0].y, 256);
+
+    SetLastError(0xDEADBEEF);
+    apt1[0].x = apt1[0].y = 256;
+    apt2[0].x = apt2[0].y = 0xBEEFDEAD;
+    ret = NtGdiTransformPoints(hDC, apt1, apt2, 0, GdiDpToLp);
+    ok_int(ret, TRUE);
+    ok_err(0xDEADBEEF);
+    ok_long(apt1[0].x, 256);
+    ok_long(apt1[0].y, 256);
+    ok_long(apt2[0].x, 0xBEEFDEAD);
+    ok_long(apt2[0].x, 0xBEEFDEAD);
+
+    SetLastError(0xDEADBEEF);
+    apt1[0].x = apt1[0].y = 256;
+    apt2[0].x = apt2[0].y = 0xBEEFDEAD;
+    ret = NtGdiTransformPoints(hDC, apt1, apt2, 1, GdiDpToLp);
+    ok_int(ret, TRUE);
+    ok_err(0xDEADBEEF);
+    ok_long(apt1[0].x, 256);
+    ok_long(apt1[0].y, 256);
+    ok_long(apt2[0].x, 256);
+    ok_long(apt2[0].x, 256);
+
+    /* MM_ISOTROPIC */
+
+    SetMapMode(hDC, MM_ISOTROPIC);
+    ok_int(SetWindowExtEx(hDC, 10, 10, NULL), TRUE);
+    ok_int(GetWindowExtEx(hDC, &siz), TRUE);
+    ok_long(siz.cx, 10);
+    ok_long(siz.cy, 10);
+    ok_int(SetViewportExtEx(hDC, 100, 100, NULL), TRUE);
+    ok_int(GetViewportExtEx(hDC, &siz), TRUE);
+    ok_long(siz.cx, 100);
+    ok_long(siz.cy, 100);
+    SetLastError(0xDEADBEEF);
+    apt1[0].x = apt1[0].y = 256;
+    apt2[0].x = apt2[0].y = 0xBEEFDEAD;
+    ret = NtGdiTransformPoints(hDC, apt1, apt2, 1, GdiDpToLp);
+    ok_int(ret, TRUE);
+    ok_err(0xDEADBEEF);
+    ok_long(apt1[0].x, 256);
+    ok_long(apt1[0].y, 256);
+    ok_long(apt2[0].x, 26);
+    ok_long(apt2[0].x, 26);
+
+    SetMapMode(hDC, MM_ISOTROPIC);
+    ok_int(SetWindowExtEx(hDC, 10, 10, NULL), TRUE);
+    ok_int(GetWindowExtEx(hDC, &siz), TRUE);
+    ok_long(siz.cx, 10);
+    ok_long(siz.cy, 10);
+    ok_int(SetViewportExtEx(hDC, 20, 100, NULL), TRUE);
+    ok_int(GetViewportExtEx(hDC, &siz), TRUE);
+    ok_long(siz.cx, 20);
+    ok_long(siz.cy, 20);
+    SetLastError(0xDEADBEEF);
+    apt1[0].x = apt1[0].y = 256;
+    apt2[0].x = apt2[0].y = 0xBEEFDEAD;
+    ret = NtGdiTransformPoints(hDC, apt1, apt2, 1, GdiDpToLp);
+    ok_int(ret, TRUE);
+    ok_err(0xDEADBEEF);
+    ok_long(apt1[0].x, 256);
+    ok_long(apt1[0].y, 256);
+    ok_long(apt2[0].x, 128);
+    ok_long(apt2[0].x, 128);
+
+    SetMapMode(hDC, MM_ISOTROPIC);
+    ok_int(SetWindowExtEx(hDC, 10, 10, NULL), TRUE);
+    ok_int(GetWindowExtEx(hDC, &siz), TRUE);
+    ok_long(siz.cx, 10);
+    ok_long(siz.cy, 10);
+    ok_int(SetViewportExtEx(hDC, 100, 0, NULL), TRUE);
+    ok_int(GetViewportExtEx(hDC, &siz), TRUE);
+    ok_long(siz.cx, 20);
+    ok_long(siz.cy, 20);
+    SetLastError(0xDEADBEEF);
+    apt1[0].x = apt1[0].y = 256;
+    apt2[0].x = apt2[0].y = 0xBEEFDEAD;
+    ret = NtGdiTransformPoints(hDC, apt1, apt2, 1, GdiDpToLp);
+    ok_int(ret, TRUE);
+    ok_err(0xDEADBEEF);
+    ok_long(apt1[0].x, 256);
+    ok_long(apt1[0].y, 256);
+    ok_long(apt2[0].x, 128);
+    ok_long(apt2[0].x, 128);
+
+    SetMapMode(hDC, MM_ISOTROPIC);
+    ok_int(SetWindowExtEx(hDC, 10, 10, NULL), TRUE);
+    ok_int(GetWindowExtEx(hDC, &siz), TRUE);
+    ok_long(siz.cx, 10);
+    ok_long(siz.cy, 10);
+    ok_int(SetViewportExtEx(hDC, 0, 100, NULL), TRUE);
+    ok_int(GetViewportExtEx(hDC, &siz), TRUE);
+    ok_long(siz.cx, 20);
+    ok_long(siz.cy, 20);
+    SetLastError(0xDEADBEEF);
+    apt1[0].x = apt1[0].y = 256;
+    apt2[0].x = apt2[0].y = 0xBEEFDEAD;
+    ret = NtGdiTransformPoints(hDC, apt1, apt2, 1, GdiDpToLp);
+    ok_int(ret, TRUE);
+    ok_err(0xDEADBEEF);
+    ok_long(apt1[0].x, 256);
+    ok_long(apt1[0].y, 256);
+    ok_long(apt2[0].x, 128);
+    ok_long(apt2[0].x, 128);
+
+    SetMapMode(hDC, MM_ISOTROPIC);
+    ok_int(SetWindowExtEx(hDC, 10, 10, NULL), TRUE);
+    ok_int(GetWindowExtEx(hDC, &siz), TRUE);
+    ok_long(siz.cx, 10);
+    ok_long(siz.cy, 10);
+    ok_int(SetViewportExtEx(hDC, 0, 0, NULL), TRUE);
+    ok_int(GetViewportExtEx(hDC, &siz), TRUE);
+    ok_long(siz.cx, 20);
+    ok_long(siz.cy, 20);
+    SetLastError(0xDEADBEEF);
+    apt1[0].x = apt1[0].y = 256;
+    apt2[0].x = apt2[0].y = 0xBEEFDEAD;
+    ret = NtGdiTransformPoints(hDC, apt1, apt2, 1, GdiDpToLp);
+    ok_int(ret, TRUE);
+    ok_err(0xDEADBEEF);
+    ok_long(apt1[0].x, 256);
+    ok_long(apt1[0].y, 256);
+    ok_long(apt2[0].x, 128);
+    ok_long(apt2[0].x, 128);
+
+    /* MM_ANISOTROPIC */
+
+    SetMapMode(hDC, MM_ANISOTROPIC);
+    ok_int(SetWindowExtEx(hDC, 10, 10, NULL), TRUE);
+    ok_int(GetWindowExtEx(hDC, &siz), TRUE);
+    ok_long(siz.cx, 10);
+    ok_long(siz.cy, 10);
+    ok_int(SetViewportExtEx(hDC, 100, 100, NULL), TRUE);
+    ok_int(GetViewportExtEx(hDC, &siz), TRUE);
+    ok_long(siz.cx, 100);
+    ok_long(siz.cy, 100);
+    SetLastError(0xDEADBEEF);
+    apt1[0].x = apt1[0].y = 256;
+    apt2[0].x = apt2[0].y = 0xBEEFDEAD;
+    ret = NtGdiTransformPoints(hDC, apt1, apt2, 1, GdiDpToLp);
+    ok_int(ret, TRUE);
+    ok_err(0xDEADBEEF);
+    ok_long(apt1[0].x, 256);
+    ok_long(apt1[0].y, 256);
+    ok_long(apt2[0].x, 26);
+    ok_long(apt2[0].x, 26);
+
+    SetMapMode(hDC, MM_ANISOTROPIC);
+    ok_int(SetWindowExtEx(hDC, 10, 10, NULL), TRUE);
+    ok_int(GetWindowExtEx(hDC, &siz), TRUE);
+    ok_long(siz.cx, 10);
+    ok_long(siz.cy, 10);
+    ok_int(SetViewportExtEx(hDC, 20, 100, NULL), TRUE);
+    ok_int(GetViewportExtEx(hDC, &siz), TRUE);
+    ok_long(siz.cx, 20);
+    ok_long(siz.cy, 100);
+    SetLastError(0xDEADBEEF);
+    apt1[0].x = apt1[0].y = 256;
+    apt2[0].x = apt2[0].y = 0xBEEFDEAD;
+    ret = NtGdiTransformPoints(hDC, apt1, apt2, 1, GdiDpToLp);
+    ok_int(ret, TRUE);
+    ok_err(0xDEADBEEF);
+    ok_long(apt1[0].x, 256);
+    ok_long(apt1[0].y, 256);
+    ok_long(apt2[0].x, 128);
+    ok_long(apt2[0].x, 128);
+
+    SetMapMode(hDC, MM_ANISOTROPIC);
+    ok_int(SetWindowExtEx(hDC, 10, 10, NULL), TRUE);
+    ok_int(GetWindowExtEx(hDC, &siz), TRUE);
+    ok_long(siz.cx, 10);
+    ok_long(siz.cy, 10);
+    ok_int(SetViewportExtEx(hDC, 100, 0, NULL), TRUE);
+    ok_int(GetViewportExtEx(hDC, &siz), TRUE);
+    ok_long(siz.cx, 20);
+    ok_long(siz.cy, 100);
+    SetLastError(0xDEADBEEF);
+    apt1[0].x = apt1[0].y = 256;
+    apt2[0].x = apt2[0].y = 0xBEEFDEAD;
+    ret = NtGdiTransformPoints(hDC, apt1, apt2, 1, GdiDpToLp);
+    ok_int(ret, TRUE);
+    ok_err(0xDEADBEEF);
+    ok_long(apt1[0].x, 256);
+    ok_long(apt1[0].y, 256);
+    ok_long(apt2[0].x, 128);
+    ok_long(apt2[0].x, 128);
+
+    SetMapMode(hDC, MM_ANISOTROPIC);
+    ok_int(SetWindowExtEx(hDC, 10, 10, NULL), TRUE);
+    ok_int(GetWindowExtEx(hDC, &siz), TRUE);
+    ok_long(siz.cx, 10);
+    ok_long(siz.cy, 10);
+    ok_int(SetViewportExtEx(hDC, 0, 100, NULL), TRUE);
+    ok_int(GetViewportExtEx(hDC, &siz), TRUE);
+    ok_long(siz.cx, 20);
+    ok_long(siz.cy, 100);
+    SetLastError(0xDEADBEEF);
+    apt1[0].x = apt1[0].y = 256;
+    apt2[0].x = apt2[0].y = 0xBEEFDEAD;
+    ret = NtGdiTransformPoints(hDC, apt1, apt2, 1, GdiDpToLp);
+    ok_int(ret, TRUE);
+    ok_err(0xDEADBEEF);
+    ok_long(apt1[0].x, 256);
+    ok_long(apt1[0].y, 256);
+    ok_long(apt2[0].x, 128);
+    ok_long(apt2[0].x, 128);
+
+    SetMapMode(hDC, MM_ANISOTROPIC);
+    ok_int(SetWindowExtEx(hDC, 10, 10, NULL), TRUE);
+    ok_int(GetWindowExtEx(hDC, &siz), TRUE);
+    ok_long(siz.cx, 10);
+    ok_long(siz.cy, 10);
+    ok_int(SetViewportExtEx(hDC, 0, 0, NULL), TRUE);
+    ok_int(GetViewportExtEx(hDC, &siz), TRUE);
+    ok_long(siz.cx, 20);
+    ok_long(siz.cy, 100);
+    SetLastError(0xDEADBEEF);
+    apt1[0].x = apt1[0].y = 256;
+    apt2[0].x = apt2[0].y = 0xBEEFDEAD;
+    ret = NtGdiTransformPoints(hDC, apt1, apt2, 1, GdiDpToLp);
+    ok_int(ret, TRUE);
+    ok_err(0xDEADBEEF);
+    ok_long(apt1[0].x, 256);
+    ok_long(apt1[0].y, 256);
+    ok_long(apt2[0].x, 128);
+    ok_long(apt2[0].x, 128);
+
+    ret = DeleteDC(hDC);
+    ok_int(ret, TRUE);
+}
index b262191..70f5611 100644 (file)
@@ -36,6 +36,7 @@ extern void func_NtGdiSelectFont(void);
 extern void func_NtGdiSelectPen(void);
 extern void func_NtGdiSetBitmapBits(void);
 extern void func_NtGdiSetDIBitsToDeviceInternal(void);
+extern void func_NtGdiTransformPoints(void);
 //extern void func_NtUserCallHwnd(void);
 //extern void func_NtUserCallHwndLock(void);
 //extern void func_NtUserCallHwndOpt(void);
@@ -96,6 +97,7 @@ const struct test winetest_testlist[] =
     { "NtGdiSelectPen", func_NtGdiSelectPen },
     { "NtGdiSetBitmapBits", func_NtGdiSetBitmapBits },
     { "NtGdiSetDIBitsToDeviceInternal", func_NtGdiSetDIBitsToDeviceInternal },
+    { "NtGdiTransformPoints", func_NtGdiTransformPoints },
 
     /* ntuser */
     //{ "NtUserCallHwnd", func_NtUserCallHwnd },
index 021fba3..d40ba11 100644 (file)
@@ -7,5 +7,5 @@ add_library(win32u_2k3sp2 MODULE
     ${win32u_2k3sp2_asm}
     ${CMAKE_CURRENT_BINARY_DIR}/win32u_2k3sp2.def)
 
-set_module_type(win32u_2k3sp2 module)
+set_module_type(win32u_2k3sp2 win32dll)
 add_dependencies(win32u_2k3sp2 psdk)
index 99f1c53..ca8dc37 100644 (file)
@@ -7,5 +7,5 @@ add_library(win32u_2ksp4 MODULE
     ${win32ku_2ksp4_asm}
     ${CMAKE_CURRENT_BINARY_DIR}/win32u_2ksp4.def)
 
-set_module_type(win32u_2ksp4 module)
+set_module_type(win32u_2ksp4 win32dll)
 add_dependencies(win32u_2ksp4 psdk)
index e8a8c03..86b760a 100644 (file)
@@ -9,6 +9,6 @@ add_library(win32u MODULE
     ${win32u_ros_asm}
     ${CMAKE_CURRENT_BINARY_DIR}/win32u.def)
 
-set_module_type(win32u module)
+set_module_type(win32u win32dll)
 add_dependencies(win32u psdk)
 add_rostests_file(TARGET win32u)
index 3873788..4ee1301 100644 (file)
@@ -7,5 +7,5 @@ add_library(win32u_vista MODULE
     ${win32u_vista_asm}
     ${CMAKE_CURRENT_BINARY_DIR}/win32u_vista.def)
 
-set_module_type(win32u_vista module)
+set_module_type(win32u_vista win32dll)
 add_dependencies(win32u_vista psdk)
index 6a84838..7da1578 100644 (file)
@@ -7,5 +7,5 @@ add_library(win32u_xpsp2 MODULE
     ${win32u_xpsp2_asm}
     ${CMAKE_CURRENT_BINARY_DIR}/win32u_xpsp2.def)
 
-set_module_type(win32u_xpsp2 module)
+set_module_type(win32u_xpsp2 win32dll)
 add_dependencies(win32u_xpsp2 psdk)