win32knapi: More / improved tests for NtUserSystemParametersInfo, NtGdiSelectBrush...
[reactos.git] / rostests / apitests / w32knapi / ntgdi / NtGdiSelectBrush.c
index d332e9a..ba39232 100644 (file)
@@ -3,6 +3,7 @@ Test_NtGdiSelectBrush(PTESTINFO pti)
 {
        HDC hDC;
        HBRUSH hBrush, hOldBrush;
+       DC_ATTR *pdcattr;
 
        hDC = CreateDCW(L"DISPLAY", NULL, NULL, NULL);
 
@@ -39,6 +40,25 @@ Test_NtGdiSelectBrush(PTESTINFO pti)
        TEST(hOldBrush == hBrush);
        TEST(GetLastError() == ERROR_SUCCESS);
 
+       /* Begin with a white brush */
+       NtGdiSelectBrush(hDC, GetStockObject(WHITE_BRUSH));
+       /* Select a brush in user mode */
+       SelectObject(hDC, GetStockObject(BLACK_BRUSH));
+       /* See what we get returned */
+       hOldBrush = NtGdiSelectBrush(hDC, GetStockObject(WHITE_BRUSH));
+       TEST(hOldBrush == GetStockObject(BLACK_BRUSH));
+
+
+       /* Begin with a white brush */
+       NtGdiSelectBrush(hDC, GetStockObject(WHITE_BRUSH));
+
+       pdcattr = GetHandleUserData(hDC);
+       /* Change the brush in user mode, without setting flags */
+       pdcattr->hbrush = (HBRUSH)12345;
+
+       hOldBrush = NtGdiSelectBrush(hDC, GetStockObject(BLACK_BRUSH));
+       TEST(hOldBrush == (HBRUSH)12345);
+
 
        DeleteDC(hDC);