some more tests for NtUserScrollDC and NtGdiBitBlt
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Sun, 11 Nov 2007 00:19:42 +0000 (00:19 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Sun, 11 Nov 2007 00:19:42 +0000 (00:19 +0000)
svn path=/trunk/; revision=30343

rostests/apitests/w32knapi/ntgdi/NtGdiBitBlt.c [new file with mode: 0644]
rostests/apitests/w32knapi/ntuser/NtUserScrollDC.c
rostests/apitests/w32knapi/testlist.c

diff --git a/rostests/apitests/w32knapi/ntgdi/NtGdiBitBlt.c b/rostests/apitests/w32knapi/ntgdi/NtGdiBitBlt.c
new file mode 100644 (file)
index 0000000..6ce74bf
--- /dev/null
@@ -0,0 +1,14 @@
+
+INT
+Test_NtGdiBitBlt(PTESTINFO pti)
+{
+       BOOL bRet;
+
+       /* Test invalid dc */
+       SetLastError(ERROR_SUCCESS);
+       bRet = NtGdiBitBlt((HDC)0x123456, 0, 0, 10, 10, (HDC)0x123456, 10, 10, SRCCOPY, 0, 0);
+       TEST(bRet == FALSE);
+       TEST(GetLastError() == ERROR_SUCCESS);
+
+       return APISTATUS_NORMAL;
+}
index af49f6e..1a2cc23 100644 (file)
@@ -29,35 +29,79 @@ Test_NtUserScrollDC(PTESTINFO pti)
 
        hRgn = CreateRectRgn(0,0,10,10);
 
+
+       /* Test inverted clip rect */
        rcScroll.left = 0;
        rcScroll.top = 25;
        rcScroll.right = 100;
        rcScroll.bottom = 40;
+       rcClip.left = 0;
+       rcClip.top = 35;
+       rcClip.right = -70;
+       rcClip.bottom = -1000;
+       SetLastError(ERROR_SUCCESS);
+       Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate);
+       RTEST(Result == 1);
+       RTEST(GetLastError() == ERROR_SUCCESS);
 
+       /* Test inverted scroll rect */
+       rcScroll.left = 0;
+       rcScroll.top = 25;
+       rcScroll.right = -100;
+       rcScroll.bottom = -40;
        rcClip.left = 0;
        rcClip.top = 35;
        rcClip.right = 70;
        rcClip.bottom = 1000;
+       SetLastError(ERROR_SUCCESS);
+       Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate);
+       RTEST(Result == 1);
+       RTEST(GetLastError() == ERROR_SUCCESS);
+
+       rcScroll.left = 0;
+       rcScroll.top = 25;
+       rcScroll.right = 100;
+       rcScroll.bottom = 40;
+
+       /* Test invalid update region */
+       SetLastError(ERROR_SUCCESS);
+       Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, (HRGN)0x123456, &rcUpdate);
+       RTEST(Result == 0);
+       TEST(GetLastError() == ERROR_INVALID_HANDLE);
+
+       /* Test invalid dc */
+       SetLastError(ERROR_SUCCESS);
+       Result = NtUserScrollDC((HDC)0x123456, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate);
+       RTEST(Result == 0);
+       RTEST(GetLastError() == ERROR_SUCCESS);
+       printf("%ld\n", GetLastError());
+
+       /* Test invalid update rect */
+       SetLastError(ERROR_SUCCESS);
+       Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, (PVOID)0x80001000);
+       RTEST(Result == 0);
+       RTEST(GetLastError() == ERROR_NOACCESS);
 
        Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate);
 
-       TEST(Result == TRUE);
-       TEST(rcUpdate.left == 0);
-       TEST(rcUpdate.top == 35);
-       TEST(rcUpdate.right == 70);
-       TEST(rcUpdate.bottom == 55);
+       RTEST(Result == TRUE);
+       RTEST(rcUpdate.left == 0);
+       RTEST(rcUpdate.top == 35);
+       RTEST(rcUpdate.right == 70);
+       RTEST(rcUpdate.bottom == 55);
 
        hTmpRgn = CreateRectRgn(10,45,70,55);
        Result = CombineRgn(hRgn, hRgn, hTmpRgn, RGN_XOR);
-       TEST(Result == SIMPLEREGION);
+       RTEST(Result == SIMPLEREGION);
 
        SetRectRgn(hTmpRgn,0,35,70,40);
        Result = CombineRgn(hRgn, hRgn, hTmpRgn, RGN_XOR);
-       TEST(Result == NULLREGION);
+       RTEST(Result == NULLREGION);
 
        DeleteObject(hTmpRgn);
 
        /* TODO: Test with another window in front */
+       /* TODO: Test with different viewport extension */
 
        ReleaseDC(hWnd, hDC);
        DestroyWindow(hWnd);
index a7a47c5..f05ac37 100644 (file)
@@ -7,6 +7,7 @@
 #include "ntdd/NtGdiDdQueryDirectDrawObject.c"\r
 \r
 #include "ntgdi/NtGdiArcInternal.c"\r
+#include "ntgdi/NtGdiBitBlt.c"\r
 #include "ntgdi/NtGdiCreateBitmap.c"\r
 #include "ntgdi/NtGdiCreateCompatibleBitmap.c"\r
 #include "ntgdi/NtGdiDoPalette.c"\r
@@ -35,6 +36,7 @@ TESTENTRY TestList[] =
 \r
        /* ntgdi */\r
        { L"NtGdiArcInternal", Test_NtGdiArcInternal },\r
+       { L"NtGdiBitBlt", Test_NtGdiBitBlt },\r
        { L"NtGdiCreateBitmap", Test_NtGdiCreateBitmap },\r
        { L"NtGdiCreateCompatibleBitmap", Test_NtGdiCreateCompatibleBitmap },\r
        { L"NtGdiDoPalette", Test_NtGdiDoPalette },\r