https://git.reactos.org/?p=reactos.git;a=commitdiff;h=25198d5cbd0213387c221f7778f942cad70b980b

commit 25198d5cbd0213387c221f7778f942cad70b980b
Author:     jimtabor <[email protected]>
AuthorDate: Wed May 8 12:31:17 2019 -0500
Commit:     jimtabor <[email protected]>
CommitDate: Wed May 8 12:31:17 2019 -0500

    [Win32nt|ApiTests] Add ExtSelectClipRgn test
    
    For CORE-13817 and CORE-15906
---
 modules/rostests/apitests/win32nt/CMakeLists.txt   |  2 +-
 .../apitests/win32nt/ntgdi/NtGdiExtSelectClipRgn.c | 57 ++++++++++++++++++++++
 modules/rostests/apitests/win32nt/testlist.c       |  4 +-
 3 files changed, 60 insertions(+), 3 deletions(-)

diff --git a/modules/rostests/apitests/win32nt/CMakeLists.txt 
b/modules/rostests/apitests/win32nt/CMakeLists.txt
index 31e649e0c1..666f823a38 100644
--- a/modules/rostests/apitests/win32nt/CMakeLists.txt
+++ b/modules/rostests/apitests/win32nt/CMakeLists.txt
@@ -18,7 +18,7 @@ list(APPEND SOURCE
     ntgdi/NtGdiDoPalette.c
     ntgdi/NtGdiEngCreatePalette.c
     ntgdi/NtGdiEnumFontOpen.c
-    #ntgdi/NtGdiExtSelectClipRgn.c
+    ntgdi/NtGdiExtSelectClipRgn.c
     ntgdi/NtGdiExtTextOutW.c
     #ntgdi/NtGdiFlushUserBatch.c
     ntgdi/NtGdiGetBitmapBits.c
diff --git a/modules/rostests/apitests/win32nt/ntgdi/NtGdiExtSelectClipRgn.c 
b/modules/rostests/apitests/win32nt/ntgdi/NtGdiExtSelectClipRgn.c
new file mode 100644
index 0000000000..03cd12d161
--- /dev/null
+++ b/modules/rostests/apitests/win32nt/ntgdi/NtGdiExtSelectClipRgn.c
@@ -0,0 +1,57 @@
+/*
+ * PROJECT:         ReactOS api tests
+ * LICENSE:         GPL - See COPYING in the top level directory
+ * PURPOSE:         Test for NtGdiCombineRgn
+ * PROGRAMMERS:
+ */
+
+#include <win32nt.h>
+
+START_TEST(NtGdiExtSelectClipRgn)
+{
+    HRGN hRgnDest, hRgn1, hRgn2;
+    HDC hdc;
+// test what params are accepted for what operations
+// 0? invalid? are params maybe ignored in some cases?
+// LastError
+
+    /* Preparation */
+    hRgnDest = CreateRectRgn(100, 100, 100, 100);
+    hRgn1 = CreateRectRgn(1,1,4,4);
+    hRgn2 = CreateRectRgn(2,2,6,3);
+
+    hdc = GetDC(NULL);
+
+    /* RGN_AND = 1, RGN_OR = 2, RGN_XOR = 3, RGN_DIFF = 4, RGN_COPY = 5 */
+
+    SetLastError(0xDEADFACE);
+    ok_int(NtGdiExtSelectClipRgn(NULL, NULL, RGN_AND-1), ERROR);
+    ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
+    SetLastError(0xDEADFACE);
+    ok_int(NtGdiExtSelectClipRgn(NULL, NULL, RGN_COPY+1), ERROR);
+    ok_long(GetLastError(), ERROR_INVALID_PARAMETER);
+    SetLastError(0xDEADFACE);
+    ok_int(NtGdiExtSelectClipRgn(NULL, NULL, RGN_COPY), ERROR);
+    ok_long(GetLastError(), ERROR_INVALID_HANDLE);
+    ok_int(NtGdiExtSelectClipRgn(hdc, hRgnDest, RGN_COPY), NULLREGION);
+    ok_int(NtGdiExtSelectClipRgn(hdc, NULL, RGN_COPY), SIMPLEREGION);
+    ok_int(NtGdiExtSelectClipRgn(hdc, hRgnDest, RGN_DIFF), SIMPLEREGION);
+    ok_int(NtGdiExtSelectClipRgn(hdc, hRgn1, RGN_COPY), SIMPLEREGION);
+    ok_int(NtGdiExtSelectClipRgn(hdc, hRgn2, RGN_DIFF), COMPLEXREGION);
+    ok_int(NtGdiExtSelectClipRgn(hdc, NULL, RGN_COPY), SIMPLEREGION);
+    ok_int(NtGdiExtSelectClipRgn(hdc, NULL, RGN_COPY), SIMPLEREGION);
+    ok_int(NtGdiExtSelectClipRgn(hdc, hRgnDest, RGN_COPY), NULLREGION);
+    ok_int(NtGdiExtSelectClipRgn(hdc, hRgn1, RGN_AND), NULLREGION);
+    ok_int(NtGdiExtSelectClipRgn(hdc, hRgn2, RGN_AND), NULLREGION);
+    ok_int(NtGdiExtSelectClipRgn(hdc, NULL, RGN_COPY), SIMPLEREGION);
+    ok_int(NtGdiExtSelectClipRgn(hdc, hRgn1, RGN_OR), SIMPLEREGION);
+    ok_int(NtGdiExtSelectClipRgn(hdc, hRgn2, RGN_OR), SIMPLEREGION);
+    ok_int(NtGdiExtSelectClipRgn(hdc, hRgn1, RGN_XOR), COMPLEXREGION);
+    SetLastError(0xDEADFACE);
+    ok_int(NtGdiExtSelectClipRgn(hdc, NULL, RGN_DIFF), ERROR);
+    ok_int(NtGdiExtSelectClipRgn(hdc, NULL, RGN_OR), ERROR);
+    ok_int(NtGdiExtSelectClipRgn(hdc, NULL, RGN_XOR), ERROR);
+    ok_int(NtGdiExtSelectClipRgn(hdc, NULL, RGN_AND), ERROR);
+    ok_long(GetLastError(), 0xDEADFACE);
+    ok_int(NtGdiExtSelectClipRgn(hdc, NULL, RGN_COPY), SIMPLEREGION);
+}
diff --git a/modules/rostests/apitests/win32nt/testlist.c 
b/modules/rostests/apitests/win32nt/testlist.c
index 70f5611497..186fd03e6c 100644
--- a/modules/rostests/apitests/win32nt/testlist.c
+++ b/modules/rostests/apitests/win32nt/testlist.c
@@ -19,7 +19,7 @@ extern void func_NtGdiDeleteObjectApp(void);
 extern void func_NtGdiDoPalette(void);
 extern void func_NtGdiEngCreatePalette(void);
 extern void func_NtGdiEnumFontOpen(void);
-//extern void func_NtGdiExtSelectClipRgn(void);
+extern void func_NtGdiExtSelectClipRgn(void);
 extern void func_NtGdiExtTextOutW(void);
 //extern void func_NtGdiFlushUserBatch(void);
 extern void func_NtGdiGetBitmapBits(void);
@@ -80,7 +80,7 @@ const struct test winetest_testlist[] =
     { "NtGdiDoPalette", func_NtGdiDoPalette },
     { "NtGdiEngCreatePalette", func_NtGdiEngCreatePalette },
     { "NtGdiEnumFontOpen", func_NtGdiEnumFontOpen },
-    //{ "NtGdiExtSelectClipRgn", func_NtGdiExtSelectClipRgn },
+    { "NtGdiExtSelectClipRgn", func_NtGdiExtSelectClipRgn },
     { "NtGdiExtTextOutW", func_NtGdiExtTextOutW },
     //{ "NtGdiFlushUserBatch", func_NtGdiFlushUserBatch },
     { "NtGdiGetBitmapBits", func_NtGdiGetBitmapBits },

Reply via email to