[APITESTS] Add NtGdiTransformPoints testcase (#1542)

Add a testcase for NtGdiTransformPoints function. set_module_type(win32u... win32dll) CORE-15983
This commit is contained in:
Katayama Hirofumi MZ 2019-04-29 09:13:22 +09:00 committed by GitHub
parent f21f750467
commit 45bbb11a50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 372 additions and 5 deletions

View 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

View file

@ -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);
}

View 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 },

View 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)

View 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)

View 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)

View 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)

View 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)