https://git.reactos.org/?p=reactos.git;a=commitdiff;h=45bbb11a50867ae6ba7267...
commit 45bbb11a50867ae6ba7267866f273e27774a004e Author: Katayama Hirofumi MZ katayama.hirofumi.mz@gmail.com AuthorDate: Mon Apr 29 09:13:22 2019 +0900 Commit: GitHub noreply@github.com CommitDate: Mon Apr 29 09:13:22 2019 +0900
[APITESTS] Add NtGdiTransformPoints testcase (#1542)
Add a testcase for NtGdiTransformPoints function. set_module_type(win32u... win32dll) CORE-15983 --- modules/rostests/apitests/win32nt/CMakeLists.txt | 1 + .../apitests/win32nt/ntgdi/NtGdiTransformPoints.c | 364 +++++++++++++++++++++ modules/rostests/apitests/win32nt/testlist.c | 2 + .../apitests/win32u/win32u_2k3sp2/CMakeLists.txt | 2 +- .../apitests/win32u/win32u_2ksp4/CMakeLists.txt | 2 +- .../apitests/win32u/win32u_ros/CMakeLists.txt | 2 +- .../apitests/win32u/win32u_vista/CMakeLists.txt | 2 +- .../apitests/win32u/win32u_xpsp2/CMakeLists.txt | 2 +- 8 files changed, 372 insertions(+), 5 deletions(-)
diff --git a/modules/rostests/apitests/win32nt/CMakeLists.txt b/modules/rostests/apitests/win32nt/CMakeLists.txt index 516e940dd3..918903b872 100644 --- a/modules/rostests/apitests/win32nt/CMakeLists.txt +++ b/modules/rostests/apitests/win32nt/CMakeLists.txt @@ -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 index 0000000000..33b4dfd442 --- /dev/null +++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiTransformPoints.c @@ -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); +} diff --git a/modules/rostests/apitests/win32nt/testlist.c b/modules/rostests/apitests/win32nt/testlist.c index b262191be6..70f5611497 100644 --- a/modules/rostests/apitests/win32nt/testlist.c +++ b/modules/rostests/apitests/win32nt/testlist.c @@ -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 }, diff --git a/modules/rostests/apitests/win32u/win32u_2k3sp2/CMakeLists.txt b/modules/rostests/apitests/win32u/win32u_2k3sp2/CMakeLists.txt index 021fba309c..d40ba116c0 100644 --- a/modules/rostests/apitests/win32u/win32u_2k3sp2/CMakeLists.txt +++ b/modules/rostests/apitests/win32u/win32u_2k3sp2/CMakeLists.txt @@ -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) diff --git a/modules/rostests/apitests/win32u/win32u_2ksp4/CMakeLists.txt b/modules/rostests/apitests/win32u/win32u_2ksp4/CMakeLists.txt index 99f1c534ed..ca8dc375af 100644 --- a/modules/rostests/apitests/win32u/win32u_2ksp4/CMakeLists.txt +++ b/modules/rostests/apitests/win32u/win32u_2ksp4/CMakeLists.txt @@ -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) diff --git a/modules/rostests/apitests/win32u/win32u_ros/CMakeLists.txt b/modules/rostests/apitests/win32u/win32u_ros/CMakeLists.txt index e8a8c03cf2..86b760a70d 100644 --- a/modules/rostests/apitests/win32u/win32u_ros/CMakeLists.txt +++ b/modules/rostests/apitests/win32u/win32u_ros/CMakeLists.txt @@ -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) diff --git a/modules/rostests/apitests/win32u/win32u_vista/CMakeLists.txt b/modules/rostests/apitests/win32u/win32u_vista/CMakeLists.txt index 38737886d0..4ee130196f 100644 --- a/modules/rostests/apitests/win32u/win32u_vista/CMakeLists.txt +++ b/modules/rostests/apitests/win32u/win32u_vista/CMakeLists.txt @@ -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) diff --git a/modules/rostests/apitests/win32u/win32u_xpsp2/CMakeLists.txt b/modules/rostests/apitests/win32u/win32u_xpsp2/CMakeLists.txt index 6a84838435..7da15784c7 100644 --- a/modules/rostests/apitests/win32u/win32u_xpsp2/CMakeLists.txt +++ b/modules/rostests/apitests/win32u/win32u_xpsp2/CMakeLists.txt @@ -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)