2007-11-30 00:09:28 +00:00
|
|
|
INT
|
|
|
|
Test_NtGdiSelectPen(PTESTINFO pti)
|
|
|
|
{
|
|
|
|
HDC hDC;
|
|
|
|
HPEN hPen, hOldPen;
|
Add tests for NtGdiCombineRgn (14), NtGdiCreateCompatibleDC (4), NtGdiDoPalette (1), NtGdiFlushUserBatch (10), NtGdiPolyPolyDraw (60), NtGdiselectBitmap (4), NtGdiSelectPen (6), NtGdiSetDIBitsToDeviceInternal (2), NtUserEnumDisplayMonitors (7), NtUserGetClassInfo (15), NtUserProcessConnect (1), NtUserSelectPalette (13), NtUserSystemParametersInfo (1) (= 138 new tests)
svn path=/trunk/; revision=38044
2008-12-13 16:48:01 +00:00
|
|
|
LOGBRUSH logbrush;
|
2007-11-30 00:09:28 +00:00
|
|
|
|
Add tests for NtGdiCombineRgn (14), NtGdiCreateCompatibleDC (4), NtGdiDoPalette (1), NtGdiFlushUserBatch (10), NtGdiPolyPolyDraw (60), NtGdiselectBitmap (4), NtGdiSelectPen (6), NtGdiSetDIBitsToDeviceInternal (2), NtUserEnumDisplayMonitors (7), NtUserGetClassInfo (15), NtUserProcessConnect (1), NtUserSelectPalette (13), NtUserSystemParametersInfo (1) (= 138 new tests)
svn path=/trunk/; revision=38044
2008-12-13 16:48:01 +00:00
|
|
|
hDC = GetDC(NULL);
|
|
|
|
ASSERT(hDC);
|
2007-11-30 00:09:28 +00:00
|
|
|
|
|
|
|
hPen = GetStockObject(WHITE_PEN);
|
|
|
|
|
|
|
|
/* Test NULL DC */
|
|
|
|
SetLastError(ERROR_SUCCESS);
|
|
|
|
hOldPen = NtGdiSelectPen(NULL, hPen);
|
|
|
|
TEST(hOldPen == NULL);
|
|
|
|
TEST(GetLastError() == ERROR_SUCCESS);
|
|
|
|
|
|
|
|
/* Test invalid DC */
|
|
|
|
SetLastError(ERROR_SUCCESS);
|
|
|
|
hOldPen = NtGdiSelectPen((HDC)((ULONG_PTR)hDC & 0x0000ffff), hPen);
|
|
|
|
TEST(hOldPen == NULL);
|
|
|
|
TEST(GetLastError() == ERROR_SUCCESS);
|
|
|
|
|
|
|
|
/* Test NULL pen */
|
|
|
|
SetLastError(ERROR_SUCCESS);
|
|
|
|
hOldPen = NtGdiSelectPen(hDC, NULL);
|
|
|
|
TEST(hOldPen == NULL);
|
|
|
|
TEST(GetLastError() == ERROR_SUCCESS);
|
|
|
|
|
Add tests for NtGdiCombineRgn (14), NtGdiCreateCompatibleDC (4), NtGdiDoPalette (1), NtGdiFlushUserBatch (10), NtGdiPolyPolyDraw (60), NtGdiselectBitmap (4), NtGdiSelectPen (6), NtGdiSetDIBitsToDeviceInternal (2), NtUserEnumDisplayMonitors (7), NtUserGetClassInfo (15), NtUserProcessConnect (1), NtUserSelectPalette (13), NtUserSystemParametersInfo (1) (= 138 new tests)
svn path=/trunk/; revision=38044
2008-12-13 16:48:01 +00:00
|
|
|
/* Test invalid pen */
|
2007-11-30 00:09:28 +00:00
|
|
|
SetLastError(ERROR_SUCCESS);
|
|
|
|
hOldPen = NtGdiSelectPen(hDC, (HPEN)((ULONG_PTR)hPen & 0x0000ffff));
|
|
|
|
TEST(hOldPen == NULL);
|
|
|
|
TEST(GetLastError() == ERROR_SUCCESS);
|
|
|
|
|
Add tests for NtGdiCombineRgn (14), NtGdiCreateCompatibleDC (4), NtGdiDoPalette (1), NtGdiFlushUserBatch (10), NtGdiPolyPolyDraw (60), NtGdiselectBitmap (4), NtGdiSelectPen (6), NtGdiSetDIBitsToDeviceInternal (2), NtUserEnumDisplayMonitors (7), NtUserGetClassInfo (15), NtUserProcessConnect (1), NtUserSelectPalette (13), NtUserSystemParametersInfo (1) (= 138 new tests)
svn path=/trunk/; revision=38044
2008-12-13 16:48:01 +00:00
|
|
|
/* Test valid pen */
|
|
|
|
SelectObject(hDC, GetStockObject(BLACK_PEN));
|
|
|
|
SetLastError(ERROR_SUCCESS);
|
|
|
|
hOldPen = NtGdiSelectPen(hDC, hPen);
|
|
|
|
TEST(hOldPen == GetStockObject(BLACK_PEN));
|
|
|
|
hOldPen = NtGdiSelectPen(hDC, hOldPen);
|
|
|
|
TEST(hOldPen == hPen);
|
|
|
|
TEST(GetLastError() == ERROR_SUCCESS);
|
|
|
|
|
|
|
|
/* Test extpen */
|
2007-11-30 00:09:28 +00:00
|
|
|
SetLastError(ERROR_SUCCESS);
|
Add tests for NtGdiCombineRgn (14), NtGdiCreateCompatibleDC (4), NtGdiDoPalette (1), NtGdiFlushUserBatch (10), NtGdiPolyPolyDraw (60), NtGdiselectBitmap (4), NtGdiSelectPen (6), NtGdiSetDIBitsToDeviceInternal (2), NtUserEnumDisplayMonitors (7), NtUserGetClassInfo (15), NtUserProcessConnect (1), NtUserSelectPalette (13), NtUserSystemParametersInfo (1) (= 138 new tests)
svn path=/trunk/; revision=38044
2008-12-13 16:48:01 +00:00
|
|
|
logbrush.lbStyle = BS_SOLID;
|
|
|
|
logbrush.lbColor = RGB(0x12,0x34,0x56);
|
|
|
|
hPen = ExtCreatePen(PS_COSMETIC|PS_ALTERNATE, 1, &logbrush, 0, NULL);
|
|
|
|
ASSERT(hPen);
|
2007-11-30 00:09:28 +00:00
|
|
|
hOldPen = NtGdiSelectPen(hDC, hPen);
|
|
|
|
TEST(hOldPen != NULL);
|
|
|
|
hOldPen = NtGdiSelectPen(hDC, hOldPen);
|
|
|
|
TEST(hOldPen == hPen);
|
|
|
|
TEST(GetLastError() == ERROR_SUCCESS);
|
|
|
|
|
Add tests for NtGdiCombineRgn (14), NtGdiCreateCompatibleDC (4), NtGdiDoPalette (1), NtGdiFlushUserBatch (10), NtGdiPolyPolyDraw (60), NtGdiselectBitmap (4), NtGdiSelectPen (6), NtGdiSetDIBitsToDeviceInternal (2), NtUserEnumDisplayMonitors (7), NtUserGetClassInfo (15), NtUserProcessConnect (1), NtUserSelectPalette (13), NtUserSystemParametersInfo (1) (= 138 new tests)
svn path=/trunk/; revision=38044
2008-12-13 16:48:01 +00:00
|
|
|
/* Test deleting pen */
|
|
|
|
SetLastError(ERROR_SUCCESS);
|
|
|
|
hOldPen = NtGdiSelectPen(hDC, hPen);
|
|
|
|
TEST(DeleteObject(hPen) == 1);
|
|
|
|
hOldPen = NtGdiSelectPen(hDC, hOldPen);
|
|
|
|
TEST(hOldPen == hPen);
|
|
|
|
TEST(GetLastError() == ERROR_SUCCESS);
|
|
|
|
|
|
|
|
/* Test that fallback pen is BLACK_PEN */
|
2007-11-30 00:09:28 +00:00
|
|
|
|
|
|
|
DeleteDC(hDC);
|
|
|
|
|
|
|
|
return APISTATUS_NORMAL;
|
|
|
|
}
|