mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 18:11:57 +00:00
Set svn:eol-style "native" for all apitest stuff
svn path=/trunk/; revision=33818
This commit is contained in:
parent
5367e27e3a
commit
d55028d26f
48 changed files with 3748 additions and 3748 deletions
|
@ -1,36 +1,36 @@
|
|||
INT
|
||||
Test_NtGdiArcInternal(PTESTINFO pti)
|
||||
{
|
||||
HDC hDC = CreateDCW(L"Display",NULL,NULL,NULL);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiArcInternal(0, 0, 0, 0, 0, 0, 0, 0, 0, 0) == FALSE);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiArcInternal(0, hDC, 0, 0, 0, 0, 0, 0, 0, 0) == TRUE);
|
||||
TEST(NtGdiArcInternal(1, hDC, 0, 0, 0, 0, 0, 0, 0, 0) == TRUE);
|
||||
TEST(NtGdiArcInternal(2, hDC, 0, 0, 0, 0, 0, 0, 0, 0) == TRUE);
|
||||
TEST(NtGdiArcInternal(3, hDC, 0, 0, 0, 0, 0, 0, 0, 0) == TRUE);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiArcInternal(4, hDC, 0, 0, 0, 0, 0, 0, 0, 0) == FALSE);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiArcInternal(4, (HDC)10, 0, 0, 0, 0, 0, 0, 0, 0) == FALSE);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiArcInternal(0, hDC, 10, 10, 0, 0, 0, 0, 0, 0) == TRUE);
|
||||
TEST(NtGdiArcInternal(0, hDC, 10, 10, -10, -10, 0, 0, 0, 0) == TRUE);
|
||||
TEST(NtGdiArcInternal(0, hDC, 0, 0, 0, 0, 10, 0, -10, 0) == TRUE);
|
||||
|
||||
// was passiert, wenn left > right ? einfach tauschen?
|
||||
|
||||
|
||||
DeleteDC(hDC);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
INT
|
||||
Test_NtGdiArcInternal(PTESTINFO pti)
|
||||
{
|
||||
HDC hDC = CreateDCW(L"Display",NULL,NULL,NULL);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiArcInternal(0, 0, 0, 0, 0, 0, 0, 0, 0, 0) == FALSE);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiArcInternal(0, hDC, 0, 0, 0, 0, 0, 0, 0, 0) == TRUE);
|
||||
TEST(NtGdiArcInternal(1, hDC, 0, 0, 0, 0, 0, 0, 0, 0) == TRUE);
|
||||
TEST(NtGdiArcInternal(2, hDC, 0, 0, 0, 0, 0, 0, 0, 0) == TRUE);
|
||||
TEST(NtGdiArcInternal(3, hDC, 0, 0, 0, 0, 0, 0, 0, 0) == TRUE);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiArcInternal(4, hDC, 0, 0, 0, 0, 0, 0, 0, 0) == FALSE);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiArcInternal(4, (HDC)10, 0, 0, 0, 0, 0, 0, 0, 0) == FALSE);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiArcInternal(0, hDC, 10, 10, 0, 0, 0, 0, 0, 0) == TRUE);
|
||||
TEST(NtGdiArcInternal(0, hDC, 10, 10, -10, -10, 0, 0, 0, 0) == TRUE);
|
||||
TEST(NtGdiArcInternal(0, hDC, 0, 0, 0, 0, 10, 0, -10, 0) == TRUE);
|
||||
|
||||
// was passiert, wenn left > right ? einfach tauschen?
|
||||
|
||||
|
||||
DeleteDC(hDC);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
|
|
@ -1,196 +1,196 @@
|
|||
INT
|
||||
Test_NtGdiCreateBitmap_Params(PTESTINFO pti)
|
||||
{
|
||||
HBITMAP hBmp;
|
||||
BITMAP bitmap;
|
||||
BYTE BitmapData[10] = {0x11, 0x22, 0x33};
|
||||
|
||||
/* Test simple params */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 1, NULL)) != NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
/* Test all zero */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(0, 0, 0, 0, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test cx == 0 */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(0, 1, 1, 1, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test negative cx */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(-10, 1, 1, 1, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test cy == 0 */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(1, 0, 1, 1, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test negative cy */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(1, -2, 1, 1, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test negative cy */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(1, -2, 1, 1, BitmapData) == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test huge size */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(100000, 100000, 1, 1, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_NOT_ENOUGH_MEMORY);
|
||||
|
||||
/* Test cPlanes == 0 */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 0, 1, NULL)) != NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmType == 0);
|
||||
TEST(bitmap.bmWidth == 1);
|
||||
TEST(bitmap.bmHeight == 1);
|
||||
TEST(bitmap.bmWidthBytes == 2);
|
||||
TEST(bitmap.bmPlanes == 1);
|
||||
TEST(bitmap.bmBitsPixel == 1);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
/* Test big cPlanes */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 32, 1, NULL)) != NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
TEST(NtGdiCreateBitmap(1, 1, 33, 1, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test cBPP == 0 */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 0, NULL)) != NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmType == 0);
|
||||
TEST(bitmap.bmWidth == 1);
|
||||
TEST(bitmap.bmHeight == 1);
|
||||
TEST(bitmap.bmWidthBytes == 2);
|
||||
TEST(bitmap.bmPlanes == 1);
|
||||
TEST(bitmap.bmBitsPixel == 1);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
/* Test negative cBPP */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(1, 1, 1, -1, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test bad cBPP */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 3, NULL)) != NULL);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmBitsPixel == 4);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 6, NULL)) != NULL);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmBitsPixel == 8);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 15, NULL)) != NULL);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmBitsPixel == 16);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 17, NULL)) != NULL);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmBitsPixel == 24);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 3, 7, NULL)) != NULL);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmBitsPixel == 24);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 25, NULL)) != NULL);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmBitsPixel == 32);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
TEST(NtGdiCreateBitmap(1, 1, 1, 33, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test bad pointer */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(1, 1, 1, 1, (BYTE*)0x80001234) == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test pointer alignment */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 1, &BitmapData[1])) != NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
/* Test normal params */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(5, 7, 2, 4, NULL)) != NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmType == 0);
|
||||
TEST(bitmap.bmWidth == 5);
|
||||
TEST(bitmap.bmHeight == 7);
|
||||
TEST(bitmap.bmWidthBytes == 6);
|
||||
TEST(bitmap.bmPlanes == 1);
|
||||
TEST(bitmap.bmBitsPixel == 8);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
|
||||
/* Test height 0 params */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 0, 1, 1, NULL)) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test height -1 params */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, -1, 1, 1, NULL)) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test witdth 0 params */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(0, 1, 1, 1, NULL)) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test witdth -1 params */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(-1, 0, 1, 1, NULL)) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
|
||||
/* Test witdth -1 params */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(0, 0, 1, 1, NULL)) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiCreateBitmap(PTESTINFO pti)
|
||||
{
|
||||
INT ret;
|
||||
|
||||
ret = Test_NtGdiCreateBitmap_Params(pti);
|
||||
if (ret != APISTATUS_NORMAL)
|
||||
return ret;
|
||||
|
||||
// ret = Test_NtGdiCreateBitmap_Pixel(pti);
|
||||
// if (ret != APISTATUS_NORMAL)
|
||||
// return ret;
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
|
||||
}
|
||||
INT
|
||||
Test_NtGdiCreateBitmap_Params(PTESTINFO pti)
|
||||
{
|
||||
HBITMAP hBmp;
|
||||
BITMAP bitmap;
|
||||
BYTE BitmapData[10] = {0x11, 0x22, 0x33};
|
||||
|
||||
/* Test simple params */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 1, NULL)) != NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
/* Test all zero */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(0, 0, 0, 0, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test cx == 0 */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(0, 1, 1, 1, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test negative cx */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(-10, 1, 1, 1, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test cy == 0 */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(1, 0, 1, 1, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test negative cy */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(1, -2, 1, 1, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test negative cy */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(1, -2, 1, 1, BitmapData) == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test huge size */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(100000, 100000, 1, 1, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_NOT_ENOUGH_MEMORY);
|
||||
|
||||
/* Test cPlanes == 0 */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 0, 1, NULL)) != NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmType == 0);
|
||||
TEST(bitmap.bmWidth == 1);
|
||||
TEST(bitmap.bmHeight == 1);
|
||||
TEST(bitmap.bmWidthBytes == 2);
|
||||
TEST(bitmap.bmPlanes == 1);
|
||||
TEST(bitmap.bmBitsPixel == 1);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
/* Test big cPlanes */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 32, 1, NULL)) != NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
TEST(NtGdiCreateBitmap(1, 1, 33, 1, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test cBPP == 0 */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 0, NULL)) != NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmType == 0);
|
||||
TEST(bitmap.bmWidth == 1);
|
||||
TEST(bitmap.bmHeight == 1);
|
||||
TEST(bitmap.bmWidthBytes == 2);
|
||||
TEST(bitmap.bmPlanes == 1);
|
||||
TEST(bitmap.bmBitsPixel == 1);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
/* Test negative cBPP */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(1, 1, 1, -1, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test bad cBPP */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 3, NULL)) != NULL);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmBitsPixel == 4);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 6, NULL)) != NULL);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmBitsPixel == 8);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 15, NULL)) != NULL);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmBitsPixel == 16);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 17, NULL)) != NULL);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmBitsPixel == 24);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 3, 7, NULL)) != NULL);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmBitsPixel == 24);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 25, NULL)) != NULL);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmBitsPixel == 32);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
TEST(NtGdiCreateBitmap(1, 1, 1, 33, NULL) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test bad pointer */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCreateBitmap(1, 1, 1, 1, (BYTE*)0x80001234) == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test pointer alignment */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 1, &BitmapData[1])) != NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
/* Test normal params */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(5, 7, 2, 4, NULL)) != NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
ASSERT(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
|
||||
TEST(bitmap.bmType == 0);
|
||||
TEST(bitmap.bmWidth == 5);
|
||||
TEST(bitmap.bmHeight == 7);
|
||||
TEST(bitmap.bmWidthBytes == 6);
|
||||
TEST(bitmap.bmPlanes == 1);
|
||||
TEST(bitmap.bmBitsPixel == 8);
|
||||
DeleteObject(hBmp);
|
||||
|
||||
|
||||
/* Test height 0 params */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, 0, 1, 1, NULL)) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test height -1 params */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(1, -1, 1, 1, NULL)) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test witdth 0 params */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(0, 1, 1, 1, NULL)) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
/* Test witdth -1 params */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(-1, 0, 1, 1, NULL)) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
|
||||
/* Test witdth -1 params */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST((hBmp = NtGdiCreateBitmap(0, 0, 1, 1, NULL)) == NULL);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiCreateBitmap(PTESTINFO pti)
|
||||
{
|
||||
INT ret;
|
||||
|
||||
ret = Test_NtGdiCreateBitmap_Params(pti);
|
||||
if (ret != APISTATUS_NORMAL)
|
||||
return ret;
|
||||
|
||||
// ret = Test_NtGdiCreateBitmap_Pixel(pti);
|
||||
// if (ret != APISTATUS_NORMAL)
|
||||
// return ret;
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
INT
|
||||
Test_NtGdiCreateCompatibleBitmap(PTESTINFO pti)
|
||||
{
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiCreateCompatibleBitmap(PTESTINFO pti)
|
||||
{
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
|
|
@ -1,247 +1,247 @@
|
|||
HPALETTE
|
||||
CreateTestPalette()
|
||||
{
|
||||
struct
|
||||
{
|
||||
LOGPALETTE logpal;
|
||||
PALETTEENTRY entry[5];
|
||||
} palstruct =
|
||||
{ {0x300,5,
|
||||
{ {1,2,3,0} }},
|
||||
{ {22,33,44,PC_RESERVED},
|
||||
{11,55,77,PC_EXPLICIT},
|
||||
{00,77,66,PC_RESERVED | PC_NOCOLLAPSE},
|
||||
{12,34,56,78}} };
|
||||
|
||||
return CreatePalette((LOGPALETTE*)&palstruct);
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiDoPalette_GdiPalAnimate(PTESTINFO pti)
|
||||
{
|
||||
HPALETTE hPal;
|
||||
PALETTEENTRY palEntries[5] = {
|
||||
{0,0,0,0},
|
||||
{0xff,0xff,0xff,0},
|
||||
{0x33,0x66,0x99,0},
|
||||
{0x25,0x84,0x14,0},
|
||||
{0x12,0x34,0x56,0x11}};
|
||||
PALETTEENTRY palEntries2[5];
|
||||
|
||||
/* Test stock palette */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiDoPalette(GetStockObject(DEFAULT_PALETTE), 0, 1, palEntries, GdiPalAnimate, FALSE) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
|
||||
/* Test pEntries = NULL */
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalAnimate, TRUE) == 0);
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalAnimate, FALSE) == 0);
|
||||
DeleteObject(hPal);
|
||||
|
||||
/* Test PC_RESERVED */
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, TRUE) == 2);
|
||||
DeleteObject(hPal);
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 1, 5, palEntries, GdiPalAnimate, TRUE) == 2);
|
||||
DeleteObject(hPal);
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 2, 5, palEntries, GdiPalAnimate, TRUE) == 1);
|
||||
DeleteObject(hPal);
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 3, 5, palEntries, GdiPalAnimate, TRUE) == 1);
|
||||
DeleteObject(hPal);
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 4, 5, palEntries, GdiPalAnimate, TRUE) == 0);
|
||||
DeleteObject(hPal);
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 5, 5, palEntries, GdiPalAnimate, TRUE) == 0);
|
||||
DeleteObject(hPal);
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, FALSE) == 2);
|
||||
DeleteObject(hPal);
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 3, 5, palEntries, GdiPalAnimate, FALSE) == 1);
|
||||
DeleteObject(hPal);
|
||||
|
||||
/* Test if entries are set correctly */
|
||||
hPal = CreateTestPalette();
|
||||
NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, TRUE);
|
||||
NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE);
|
||||
RTEST(palEntries2[0].peRed == 1);
|
||||
RTEST(palEntries2[0].peGreen == 2);
|
||||
RTEST(palEntries2[0].peBlue == 3);
|
||||
RTEST(palEntries2[0].peFlags == 0);
|
||||
RTEST(palEntries2[1].peRed == palEntries[1].peRed);
|
||||
RTEST(palEntries2[1].peGreen == palEntries[1].peGreen);
|
||||
RTEST(palEntries2[1].peBlue == palEntries[1].peBlue);
|
||||
RTEST(palEntries2[1].peFlags == palEntries[1].peFlags);
|
||||
RTEST(palEntries2[2].peRed == 11);
|
||||
RTEST(palEntries2[2].peGreen == 55);
|
||||
RTEST(palEntries2[2].peBlue == 77);
|
||||
TEST(palEntries2[2].peFlags == PC_EXPLICIT);
|
||||
RTEST(palEntries2[3].peRed == palEntries[3].peRed);
|
||||
RTEST(palEntries2[3].peGreen == palEntries[3].peGreen);
|
||||
RTEST(palEntries2[3].peBlue == palEntries[3].peBlue);
|
||||
RTEST(palEntries2[3].peFlags == palEntries[3].peFlags);
|
||||
DeleteObject(hPal);
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiDoPalette_GdiPalSetEntries(PTESTINFO pti)
|
||||
{
|
||||
HPALETTE hPal;
|
||||
PALETTEENTRY palEntries[5] = {
|
||||
{0,0,0,0},
|
||||
{0xff,0xff,0xff,0},
|
||||
{0x33,0x66,0x99,0},
|
||||
{0x25,0x84,0x14,0},
|
||||
{0x12,0x34,0x56,0x11}};
|
||||
PALETTEENTRY palEntries2[5];
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
|
||||
/* Test invalid handle */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiDoPalette((HPALETTE)23, 0, 1, palEntries, GdiPalSetEntries, TRUE) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test system palette */
|
||||
RTEST(NtGdiDoPalette(GetStockObject(DEFAULT_PALETTE), 0, 1, palEntries, GdiPalSetEntries, TRUE) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 1, palEntries, GdiPalSetEntries, TRUE) == 1);
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 2, palEntries, GdiPalSetEntries, TRUE) == 2);
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 3, palEntries, GdiPalSetEntries, TRUE) == 3);
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE) == 5);
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 6, palEntries, GdiPalSetEntries, TRUE) == 5);
|
||||
RTEST(NtGdiDoPalette(hPal, 3, 6, palEntries, GdiPalSetEntries, TRUE) == 2);
|
||||
// TEST(NtGdiDoPalette(hPal, 4, 23247, palEntries, GdiPalSetEntries, TRUE) == 0);
|
||||
|
||||
/* Test bInbound == FALSE */
|
||||
NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE);
|
||||
ZeroMemory(palEntries2, sizeof(palEntries2));
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalSetEntries, FALSE) == 5);
|
||||
/* we should get the old values returned in our buffer! */
|
||||
TEST(memcmp(palEntries2, palEntries, sizeof(palEntries)) == 0);
|
||||
|
||||
/* check what we have in our palette now */
|
||||
ZeroMemory(palEntries2, sizeof(palEntries2));
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE) == 5);
|
||||
TEST(memcmp(palEntries2, palEntries, sizeof(palEntries)) == 0);
|
||||
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 4, palEntries2, GdiPalSetEntries, TRUE) == 4);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test if entries are set correctly */
|
||||
hPal = CreateTestPalette();
|
||||
NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE);
|
||||
NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE);
|
||||
RTEST(palEntries2[0].peRed == 0);
|
||||
RTEST(palEntries2[0].peGreen == 0);
|
||||
RTEST(palEntries2[0].peBlue == 0);
|
||||
RTEST(palEntries2[0].peFlags == 0);
|
||||
|
||||
/* Test that the buffer was not changed */
|
||||
|
||||
/* Test pEntries = NULL */
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, TRUE) == 0);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiDoPalette_GdiPalGetEntries(PTESTINFO pti)
|
||||
{
|
||||
HPALETTE hPal;
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
|
||||
/* Test pEntries = NULL */
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, TRUE) == 0);
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, FALSE) == 5);
|
||||
RTEST(NtGdiDoPalette(hPal, 2, 1, NULL, GdiPalGetEntries, FALSE) == 5);
|
||||
RTEST(NtGdiDoPalette(hPal, 20, 1, NULL, GdiPalGetEntries, FALSE) == 5);
|
||||
RTEST(NtGdiDoPalette(hPal, -20, 1, NULL, GdiPalGetEntries, FALSE) == 5);
|
||||
RTEST(NtGdiDoPalette(hPal, 2, 0, NULL, GdiPalGetEntries, FALSE) == 5);
|
||||
|
||||
|
||||
// Test flags 0xf0
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiDoPalette_GetSystemPalette(PTESTINFO pti)
|
||||
{
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiDoPalette_GetBIBColorTable(PTESTINFO pti)
|
||||
{
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiDoPalette_SetDIBColorTable(PTESTINFO pti)
|
||||
{
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
INT
|
||||
Test_NtGdiDoPalette(PTESTINFO pti)
|
||||
{
|
||||
INT ret;
|
||||
|
||||
ret = Test_NtGdiDoPalette_GdiPalAnimate(pti);
|
||||
if (ret != APISTATUS_NORMAL)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = Test_NtGdiDoPalette_GdiPalSetEntries(pti);
|
||||
if (ret != APISTATUS_NORMAL)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = Test_NtGdiDoPalette_GdiPalGetEntries(pti);
|
||||
if (ret != APISTATUS_NORMAL)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = Test_NtGdiDoPalette_GetSystemPalette(pti);
|
||||
if (ret != APISTATUS_NORMAL)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = Test_NtGdiDoPalette_GetBIBColorTable(pti);
|
||||
if (ret != APISTATUS_NORMAL)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = Test_NtGdiDoPalette_SetDIBColorTable(pti);
|
||||
if (ret != APISTATUS_NORMAL)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
HPALETTE
|
||||
CreateTestPalette()
|
||||
{
|
||||
struct
|
||||
{
|
||||
LOGPALETTE logpal;
|
||||
PALETTEENTRY entry[5];
|
||||
} palstruct =
|
||||
{ {0x300,5,
|
||||
{ {1,2,3,0} }},
|
||||
{ {22,33,44,PC_RESERVED},
|
||||
{11,55,77,PC_EXPLICIT},
|
||||
{00,77,66,PC_RESERVED | PC_NOCOLLAPSE},
|
||||
{12,34,56,78}} };
|
||||
|
||||
return CreatePalette((LOGPALETTE*)&palstruct);
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiDoPalette_GdiPalAnimate(PTESTINFO pti)
|
||||
{
|
||||
HPALETTE hPal;
|
||||
PALETTEENTRY palEntries[5] = {
|
||||
{0,0,0,0},
|
||||
{0xff,0xff,0xff,0},
|
||||
{0x33,0x66,0x99,0},
|
||||
{0x25,0x84,0x14,0},
|
||||
{0x12,0x34,0x56,0x11}};
|
||||
PALETTEENTRY palEntries2[5];
|
||||
|
||||
/* Test stock palette */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiDoPalette(GetStockObject(DEFAULT_PALETTE), 0, 1, palEntries, GdiPalAnimate, FALSE) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
|
||||
/* Test pEntries = NULL */
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalAnimate, TRUE) == 0);
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalAnimate, FALSE) == 0);
|
||||
DeleteObject(hPal);
|
||||
|
||||
/* Test PC_RESERVED */
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, TRUE) == 2);
|
||||
DeleteObject(hPal);
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 1, 5, palEntries, GdiPalAnimate, TRUE) == 2);
|
||||
DeleteObject(hPal);
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 2, 5, palEntries, GdiPalAnimate, TRUE) == 1);
|
||||
DeleteObject(hPal);
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 3, 5, palEntries, GdiPalAnimate, TRUE) == 1);
|
||||
DeleteObject(hPal);
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 4, 5, palEntries, GdiPalAnimate, TRUE) == 0);
|
||||
DeleteObject(hPal);
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 5, 5, palEntries, GdiPalAnimate, TRUE) == 0);
|
||||
DeleteObject(hPal);
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, FALSE) == 2);
|
||||
DeleteObject(hPal);
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
RTEST(NtGdiDoPalette(hPal, 3, 5, palEntries, GdiPalAnimate, FALSE) == 1);
|
||||
DeleteObject(hPal);
|
||||
|
||||
/* Test if entries are set correctly */
|
||||
hPal = CreateTestPalette();
|
||||
NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalAnimate, TRUE);
|
||||
NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE);
|
||||
RTEST(palEntries2[0].peRed == 1);
|
||||
RTEST(palEntries2[0].peGreen == 2);
|
||||
RTEST(palEntries2[0].peBlue == 3);
|
||||
RTEST(palEntries2[0].peFlags == 0);
|
||||
RTEST(palEntries2[1].peRed == palEntries[1].peRed);
|
||||
RTEST(palEntries2[1].peGreen == palEntries[1].peGreen);
|
||||
RTEST(palEntries2[1].peBlue == palEntries[1].peBlue);
|
||||
RTEST(palEntries2[1].peFlags == palEntries[1].peFlags);
|
||||
RTEST(palEntries2[2].peRed == 11);
|
||||
RTEST(palEntries2[2].peGreen == 55);
|
||||
RTEST(palEntries2[2].peBlue == 77);
|
||||
TEST(palEntries2[2].peFlags == PC_EXPLICIT);
|
||||
RTEST(palEntries2[3].peRed == palEntries[3].peRed);
|
||||
RTEST(palEntries2[3].peGreen == palEntries[3].peGreen);
|
||||
RTEST(palEntries2[3].peBlue == palEntries[3].peBlue);
|
||||
RTEST(palEntries2[3].peFlags == palEntries[3].peFlags);
|
||||
DeleteObject(hPal);
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiDoPalette_GdiPalSetEntries(PTESTINFO pti)
|
||||
{
|
||||
HPALETTE hPal;
|
||||
PALETTEENTRY palEntries[5] = {
|
||||
{0,0,0,0},
|
||||
{0xff,0xff,0xff,0},
|
||||
{0x33,0x66,0x99,0},
|
||||
{0x25,0x84,0x14,0},
|
||||
{0x12,0x34,0x56,0x11}};
|
||||
PALETTEENTRY palEntries2[5];
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
|
||||
/* Test invalid handle */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiDoPalette((HPALETTE)23, 0, 1, palEntries, GdiPalSetEntries, TRUE) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test system palette */
|
||||
RTEST(NtGdiDoPalette(GetStockObject(DEFAULT_PALETTE), 0, 1, palEntries, GdiPalSetEntries, TRUE) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 1, palEntries, GdiPalSetEntries, TRUE) == 1);
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 2, palEntries, GdiPalSetEntries, TRUE) == 2);
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 3, palEntries, GdiPalSetEntries, TRUE) == 3);
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE) == 5);
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 6, palEntries, GdiPalSetEntries, TRUE) == 5);
|
||||
RTEST(NtGdiDoPalette(hPal, 3, 6, palEntries, GdiPalSetEntries, TRUE) == 2);
|
||||
// TEST(NtGdiDoPalette(hPal, 4, 23247, palEntries, GdiPalSetEntries, TRUE) == 0);
|
||||
|
||||
/* Test bInbound == FALSE */
|
||||
NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE);
|
||||
ZeroMemory(palEntries2, sizeof(palEntries2));
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalSetEntries, FALSE) == 5);
|
||||
/* we should get the old values returned in our buffer! */
|
||||
TEST(memcmp(palEntries2, palEntries, sizeof(palEntries)) == 0);
|
||||
|
||||
/* check what we have in our palette now */
|
||||
ZeroMemory(palEntries2, sizeof(palEntries2));
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE) == 5);
|
||||
TEST(memcmp(palEntries2, palEntries, sizeof(palEntries)) == 0);
|
||||
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 4, palEntries2, GdiPalSetEntries, TRUE) == 4);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test if entries are set correctly */
|
||||
hPal = CreateTestPalette();
|
||||
NtGdiDoPalette(hPal, 0, 5, palEntries, GdiPalSetEntries, TRUE);
|
||||
NtGdiDoPalette(hPal, 0, 5, palEntries2, GdiPalGetEntries, FALSE);
|
||||
RTEST(palEntries2[0].peRed == 0);
|
||||
RTEST(palEntries2[0].peGreen == 0);
|
||||
RTEST(palEntries2[0].peBlue == 0);
|
||||
RTEST(palEntries2[0].peFlags == 0);
|
||||
|
||||
/* Test that the buffer was not changed */
|
||||
|
||||
/* Test pEntries = NULL */
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, TRUE) == 0);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiDoPalette_GdiPalGetEntries(PTESTINFO pti)
|
||||
{
|
||||
HPALETTE hPal;
|
||||
|
||||
hPal = CreateTestPalette();
|
||||
|
||||
/* Test pEntries = NULL */
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, TRUE) == 0);
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, FALSE) == 5);
|
||||
RTEST(NtGdiDoPalette(hPal, 2, 1, NULL, GdiPalGetEntries, FALSE) == 5);
|
||||
RTEST(NtGdiDoPalette(hPal, 20, 1, NULL, GdiPalGetEntries, FALSE) == 5);
|
||||
RTEST(NtGdiDoPalette(hPal, -20, 1, NULL, GdiPalGetEntries, FALSE) == 5);
|
||||
RTEST(NtGdiDoPalette(hPal, 2, 0, NULL, GdiPalGetEntries, FALSE) == 5);
|
||||
|
||||
|
||||
// Test flags 0xf0
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiDoPalette_GetSystemPalette(PTESTINFO pti)
|
||||
{
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiDoPalette_GetBIBColorTable(PTESTINFO pti)
|
||||
{
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiDoPalette_SetDIBColorTable(PTESTINFO pti)
|
||||
{
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
INT
|
||||
Test_NtGdiDoPalette(PTESTINFO pti)
|
||||
{
|
||||
INT ret;
|
||||
|
||||
ret = Test_NtGdiDoPalette_GdiPalAnimate(pti);
|
||||
if (ret != APISTATUS_NORMAL)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = Test_NtGdiDoPalette_GdiPalSetEntries(pti);
|
||||
if (ret != APISTATUS_NORMAL)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = Test_NtGdiDoPalette_GdiPalGetEntries(pti);
|
||||
if (ret != APISTATUS_NORMAL)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = Test_NtGdiDoPalette_GetSystemPalette(pti);
|
||||
if (ret != APISTATUS_NORMAL)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = Test_NtGdiDoPalette_GetBIBColorTable(pti);
|
||||
if (ret != APISTATUS_NORMAL)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = Test_NtGdiDoPalette_SetDIBColorTable(pti);
|
||||
if (ret != APISTATUS_NORMAL)
|
||||
{
|
||||
return ret;
|
||||
}
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
|
||||
INT
|
||||
Test_NtGdiEngCreatePalette(PTESTINFO pti)
|
||||
{
|
||||
HPALETTE hPal;
|
||||
ULONG Colors[3] = {1,2,3};
|
||||
PGDI_TABLE_ENTRY pEntry;
|
||||
|
||||
hPal = NtGdiEngCreatePalette(PAL_RGB, 3, Colors, 0xff000000, 0x00ff0000, 0x0000ff00);
|
||||
|
||||
TEST(hPal != 0);
|
||||
TEST(GDI_HANDLE_GET_TYPE(hPal) == GDI_OBJECT_TYPE_PALETTE);
|
||||
pEntry = &GdiHandleTable[GDI_HANDLE_GET_INDEX(hPal)];
|
||||
TEST(pEntry->KernelData != NULL);
|
||||
TEST(pEntry->ProcessId == GetCurrentProcessId());
|
||||
TEST(pEntry->UserData == 0);
|
||||
TEST(pEntry->Type == (((UINT)hPal >> 16) | GDI_OBJECT_TYPE_PALETTE));
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtGdiEngCreatePalette(PTESTINFO pti)
|
||||
{
|
||||
HPALETTE hPal;
|
||||
ULONG Colors[3] = {1,2,3};
|
||||
PGDI_TABLE_ENTRY pEntry;
|
||||
|
||||
hPal = NtGdiEngCreatePalette(PAL_RGB, 3, Colors, 0xff000000, 0x00ff0000, 0x0000ff00);
|
||||
|
||||
TEST(hPal != 0);
|
||||
TEST(GDI_HANDLE_GET_TYPE(hPal) == GDI_OBJECT_TYPE_PALETTE);
|
||||
pEntry = &GdiHandleTable[GDI_HANDLE_GET_INDEX(hPal)];
|
||||
TEST(pEntry->KernelData != NULL);
|
||||
TEST(pEntry->ProcessId == GetCurrentProcessId());
|
||||
TEST(pEntry->UserData == 0);
|
||||
TEST(pEntry->Type == (((UINT)hPal >> 16) | GDI_OBJECT_TYPE_PALETTE));
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
|
|
@ -1,36 +1,36 @@
|
|||
|
||||
INT
|
||||
Test_NtGdiEnumFontOpen(PTESTINFO pti)
|
||||
{
|
||||
HDC hDC;
|
||||
ULONG_PTR idEnum;
|
||||
ULONG ulCount;
|
||||
PGDI_TABLE_ENTRY pEntry;
|
||||
|
||||
hDC = CreateDCW(L"DISPLAY",NULL,NULL,NULL);
|
||||
|
||||
// FIXME: We should load the font first
|
||||
|
||||
idEnum = NtGdiEnumFontOpen(hDC, 2, 0, 32, L"Courier", ANSI_CHARSET, &ulCount);
|
||||
ASSERT(idEnum != 0);
|
||||
|
||||
/* we should have a gdi handle here */
|
||||
TEST(GDI_HANDLE_GET_TYPE(idEnum) == GDI_OBJECT_TYPE_ENUMFONT);
|
||||
pEntry = &GdiHandleTable[GDI_HANDLE_GET_INDEX(idEnum)];
|
||||
TEST(pEntry->KernelData != NULL);
|
||||
TEST(pEntry->ProcessId == GetCurrentProcessId());
|
||||
TEST(pEntry->UserData == 0);
|
||||
TEST(pEntry->Type == ((idEnum >> 16) | GDI_OBJECT_TYPE_ENUMFONT));
|
||||
|
||||
/* We should not be able to use DeleteObject() on the handle */
|
||||
TEST(DeleteObject((HGDIOBJ)idEnum) == FALSE);
|
||||
|
||||
NtGdiEnumFontClose(idEnum);
|
||||
|
||||
// Test no logfont (NULL): should word
|
||||
// Test empty lfFaceName string: should not work
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
INT
|
||||
Test_NtGdiEnumFontOpen(PTESTINFO pti)
|
||||
{
|
||||
HDC hDC;
|
||||
ULONG_PTR idEnum;
|
||||
ULONG ulCount;
|
||||
PGDI_TABLE_ENTRY pEntry;
|
||||
|
||||
hDC = CreateDCW(L"DISPLAY",NULL,NULL,NULL);
|
||||
|
||||
// FIXME: We should load the font first
|
||||
|
||||
idEnum = NtGdiEnumFontOpen(hDC, 2, 0, 32, L"Courier", ANSI_CHARSET, &ulCount);
|
||||
ASSERT(idEnum != 0);
|
||||
|
||||
/* we should have a gdi handle here */
|
||||
TEST(GDI_HANDLE_GET_TYPE(idEnum) == GDI_OBJECT_TYPE_ENUMFONT);
|
||||
pEntry = &GdiHandleTable[GDI_HANDLE_GET_INDEX(idEnum)];
|
||||
TEST(pEntry->KernelData != NULL);
|
||||
TEST(pEntry->ProcessId == GetCurrentProcessId());
|
||||
TEST(pEntry->UserData == 0);
|
||||
TEST(pEntry->Type == ((idEnum >> 16) | GDI_OBJECT_TYPE_ENUMFONT));
|
||||
|
||||
/* We should not be able to use DeleteObject() on the handle */
|
||||
TEST(DeleteObject((HGDIOBJ)idEnum) == FALSE);
|
||||
|
||||
NtGdiEnumFontClose(idEnum);
|
||||
|
||||
// Test no logfont (NULL): should word
|
||||
// Test empty lfFaceName string: should not work
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,62 +1,62 @@
|
|||
INT
|
||||
Test_NtGdiGetBitmapBits(PTESTINFO pti)
|
||||
{
|
||||
BYTE Bits[50] = {0,1,2,3,4,5,6,7,8,9};
|
||||
HBITMAP hBitmap;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetBitmapBits(0, 0, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
/* Test NULL bitmap handle */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetBitmapBits(0, 5, Bits) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
/* Test invalid bitmap handle */
|
||||
hBitmap = (HBITMAP)CreatePen(PS_SOLID, 1, RGB(1,2,3));
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 5, Bits) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
DeleteObject(hBitmap);
|
||||
|
||||
hBitmap = CreateBitmap(3, 3, 1, 8, NULL);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
|
||||
/* test NULL pointer and count buffer size != 0 */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 5, NULL) == 12);
|
||||
|
||||
/* test NULL pointer and buffer size == 0*/
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 0, NULL) == 12);
|
||||
|
||||
/* test bad pointer */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 5, (PBYTE)0x500) == 0);
|
||||
|
||||
/* Test if we can set a number of bytes between lines */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 5, Bits) == 5);
|
||||
|
||||
/* Test alignment */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 4, Bits+1) == 4);
|
||||
|
||||
/* Test 1 byte too much */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 10, Bits) == 10);
|
||||
|
||||
/* Test one row too much */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 12, Bits) == 12);
|
||||
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 13, Bits) == 12);
|
||||
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 100, Bits) == 12);
|
||||
|
||||
/* Test huge bytes count */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 12345678, Bits) == 12);
|
||||
|
||||
/* Test negative bytes count */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, -5, Bits) == 12);
|
||||
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
DeleteObject(hBitmap);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
INT
|
||||
Test_NtGdiGetBitmapBits(PTESTINFO pti)
|
||||
{
|
||||
BYTE Bits[50] = {0,1,2,3,4,5,6,7,8,9};
|
||||
HBITMAP hBitmap;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetBitmapBits(0, 0, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
/* Test NULL bitmap handle */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetBitmapBits(0, 5, Bits) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
/* Test invalid bitmap handle */
|
||||
hBitmap = (HBITMAP)CreatePen(PS_SOLID, 1, RGB(1,2,3));
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 5, Bits) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
DeleteObject(hBitmap);
|
||||
|
||||
hBitmap = CreateBitmap(3, 3, 1, 8, NULL);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
|
||||
/* test NULL pointer and count buffer size != 0 */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 5, NULL) == 12);
|
||||
|
||||
/* test NULL pointer and buffer size == 0*/
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 0, NULL) == 12);
|
||||
|
||||
/* test bad pointer */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 5, (PBYTE)0x500) == 0);
|
||||
|
||||
/* Test if we can set a number of bytes between lines */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 5, Bits) == 5);
|
||||
|
||||
/* Test alignment */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 4, Bits+1) == 4);
|
||||
|
||||
/* Test 1 byte too much */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 10, Bits) == 10);
|
||||
|
||||
/* Test one row too much */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 12, Bits) == 12);
|
||||
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 13, Bits) == 12);
|
||||
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 100, Bits) == 12);
|
||||
|
||||
/* Test huge bytes count */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, 12345678, Bits) == 12);
|
||||
|
||||
/* Test negative bytes count */
|
||||
RTEST(NtGdiGetBitmapBits(hBitmap, -5, Bits) == 12);
|
||||
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
DeleteObject(hBitmap);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
|
|
@ -1,131 +1,131 @@
|
|||
/* taken from gdi32, bitmap.c */
|
||||
UINT
|
||||
FASTCALL
|
||||
DIB_BitmapMaxBitsSize( PBITMAPINFO Info, UINT ScanLines )
|
||||
{
|
||||
UINT MaxBits = 0;
|
||||
|
||||
if (Info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
|
||||
{
|
||||
PBITMAPCOREHEADER Core = (PBITMAPCOREHEADER)Info;
|
||||
MaxBits = Core->bcBitCount * Core->bcPlanes * Core->bcWidth;
|
||||
}
|
||||
else /* assume BITMAPINFOHEADER */
|
||||
{
|
||||
if ((Info->bmiHeader.biCompression) && (Info->bmiHeader.biCompression != BI_BITFIELDS))
|
||||
return Info->bmiHeader.biSizeImage;
|
||||
// Planes are over looked by Yuan. I guess assumed always 1.
|
||||
MaxBits = Info->bmiHeader.biBitCount * Info->bmiHeader.biPlanes * Info->bmiHeader.biWidth;
|
||||
}
|
||||
MaxBits = ((MaxBits + 31) & ~31 ) / 8; // From Yuan, ScanLineSize = (Width * bitcount + 31)/32
|
||||
return (MaxBits * ScanLines); // ret the full Size.
|
||||
}
|
||||
|
||||
|
||||
INT
|
||||
Test_NtGdiGetDIBitsInternal(PTESTINFO pti)
|
||||
{
|
||||
HBITMAP hBitmap;
|
||||
struct
|
||||
{
|
||||
BITMAPINFO bi;
|
||||
RGBQUAD Colors[20];
|
||||
} bmp;
|
||||
// BITMAPINFO bi;
|
||||
INT ScreenBpp;
|
||||
BITMAPCOREINFO bic;
|
||||
DWORD data[20*16];
|
||||
|
||||
HDC hDCScreen = GetDC(NULL);
|
||||
ASSERT(hDCScreen != NULL);
|
||||
|
||||
hBitmap = CreateCompatibleBitmap(hDCScreen, 16, 16);
|
||||
ASSERT(hBitmap != NULL);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal(0, 0, 0, 0, NULL, NULL, 0, 0, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal((HDC)2345, 0, 0, 0, NULL, NULL, 0, 0, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal((HDC)2345, hBitmap, 0, 0, NULL, NULL, 0, 0, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 0, NULL, NULL, 0, 0, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, NULL, 0, 0, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
ZeroMemory(&bmp, sizeof(bmp));
|
||||
bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal((HDC)0, hBitmap, 0, 15, NULL, &bmp.bi, 0, 0, 0) > 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
TEST(bmp.Colors[0].rgbRed == 0x44);
|
||||
|
||||
ZeroMemory(&bmp, sizeof(bmp));
|
||||
bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal((HDC)2345, hBitmap, 0, 15, NULL, &bmp.bi, 0, 0, 0) > 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
TEST(bmp.Colors[0].rgbRed == 0x44);
|
||||
|
||||
ZeroMemory(&bmp, sizeof(bmp));
|
||||
bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, &bmp.bi, DIB_RGB_COLORS,
|
||||
DIB_BitmapMaxBitsSize(&bmp.bi, 15), 0) > 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
ScreenBpp = GetDeviceCaps(hDCScreen, BITSPIXEL);
|
||||
|
||||
RTEST(bmp.bi.bmiHeader.biWidth == 16);
|
||||
RTEST(bmp.bi.bmiHeader.biHeight == 16);
|
||||
RTEST(bmp.bi.bmiHeader.biBitCount == ScreenBpp);
|
||||
RTEST(bmp.bi.bmiHeader.biSizeImage == (16 * 16) * (ScreenBpp / 8));
|
||||
|
||||
TEST(bmp.Colors[0].rgbRed == 0x44);
|
||||
|
||||
/* Test with pointer */
|
||||
// ZeroMemory(&bmp.bi, sizeof(BITMAPINFO));
|
||||
bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
// FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x11223344);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, (void*)data, &bmp.bi, DIB_RGB_COLORS,
|
||||
DIB_BitmapMaxBitsSize(&bmp.bi, 15), 0) > 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
RTEST(bmp.bi.bmiHeader.biWidth == 16);
|
||||
RTEST(bmp.bi.bmiHeader.biHeight == 16);
|
||||
RTEST(bmp.bi.bmiHeader.biBitCount == ScreenBpp);
|
||||
RTEST(bmp.bi.bmiHeader.biSizeImage == (16 * 16) * (ScreenBpp / 8));
|
||||
|
||||
TEST(bmp.Colors[0].rgbRed != 0x44);
|
||||
|
||||
/* Test a BITMAPCOREINFO structure */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ZeroMemory(&bic, sizeof(BITMAPCOREINFO));
|
||||
bic.bmciHeader.bcSize = sizeof(BITMAPCOREHEADER);
|
||||
TEST(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, (PBITMAPINFO)&bic, DIB_RGB_COLORS,
|
||||
DIB_BitmapMaxBitsSize((PBITMAPINFO)&bic, 15), 0) > 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
|
||||
ReleaseDC(NULL, hDCScreen);
|
||||
DeleteObject(hBitmap);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
/* taken from gdi32, bitmap.c */
|
||||
UINT
|
||||
FASTCALL
|
||||
DIB_BitmapMaxBitsSize( PBITMAPINFO Info, UINT ScanLines )
|
||||
{
|
||||
UINT MaxBits = 0;
|
||||
|
||||
if (Info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
|
||||
{
|
||||
PBITMAPCOREHEADER Core = (PBITMAPCOREHEADER)Info;
|
||||
MaxBits = Core->bcBitCount * Core->bcPlanes * Core->bcWidth;
|
||||
}
|
||||
else /* assume BITMAPINFOHEADER */
|
||||
{
|
||||
if ((Info->bmiHeader.biCompression) && (Info->bmiHeader.biCompression != BI_BITFIELDS))
|
||||
return Info->bmiHeader.biSizeImage;
|
||||
// Planes are over looked by Yuan. I guess assumed always 1.
|
||||
MaxBits = Info->bmiHeader.biBitCount * Info->bmiHeader.biPlanes * Info->bmiHeader.biWidth;
|
||||
}
|
||||
MaxBits = ((MaxBits + 31) & ~31 ) / 8; // From Yuan, ScanLineSize = (Width * bitcount + 31)/32
|
||||
return (MaxBits * ScanLines); // ret the full Size.
|
||||
}
|
||||
|
||||
|
||||
INT
|
||||
Test_NtGdiGetDIBitsInternal(PTESTINFO pti)
|
||||
{
|
||||
HBITMAP hBitmap;
|
||||
struct
|
||||
{
|
||||
BITMAPINFO bi;
|
||||
RGBQUAD Colors[20];
|
||||
} bmp;
|
||||
// BITMAPINFO bi;
|
||||
INT ScreenBpp;
|
||||
BITMAPCOREINFO bic;
|
||||
DWORD data[20*16];
|
||||
|
||||
HDC hDCScreen = GetDC(NULL);
|
||||
ASSERT(hDCScreen != NULL);
|
||||
|
||||
hBitmap = CreateCompatibleBitmap(hDCScreen, 16, 16);
|
||||
ASSERT(hBitmap != NULL);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal(0, 0, 0, 0, NULL, NULL, 0, 0, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal((HDC)2345, 0, 0, 0, NULL, NULL, 0, 0, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal((HDC)2345, hBitmap, 0, 0, NULL, NULL, 0, 0, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 0, NULL, NULL, 0, 0, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, NULL, 0, 0, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
ZeroMemory(&bmp, sizeof(bmp));
|
||||
bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal((HDC)0, hBitmap, 0, 15, NULL, &bmp.bi, 0, 0, 0) > 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
TEST(bmp.Colors[0].rgbRed == 0x44);
|
||||
|
||||
ZeroMemory(&bmp, sizeof(bmp));
|
||||
bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal((HDC)2345, hBitmap, 0, 15, NULL, &bmp.bi, 0, 0, 0) > 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
TEST(bmp.Colors[0].rgbRed == 0x44);
|
||||
|
||||
ZeroMemory(&bmp, sizeof(bmp));
|
||||
bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x44);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, &bmp.bi, DIB_RGB_COLORS,
|
||||
DIB_BitmapMaxBitsSize(&bmp.bi, 15), 0) > 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
ScreenBpp = GetDeviceCaps(hDCScreen, BITSPIXEL);
|
||||
|
||||
RTEST(bmp.bi.bmiHeader.biWidth == 16);
|
||||
RTEST(bmp.bi.bmiHeader.biHeight == 16);
|
||||
RTEST(bmp.bi.bmiHeader.biBitCount == ScreenBpp);
|
||||
RTEST(bmp.bi.bmiHeader.biSizeImage == (16 * 16) * (ScreenBpp / 8));
|
||||
|
||||
TEST(bmp.Colors[0].rgbRed == 0x44);
|
||||
|
||||
/* Test with pointer */
|
||||
// ZeroMemory(&bmp.bi, sizeof(BITMAPINFO));
|
||||
bmp.bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
// FillMemory(&bmp.Colors, sizeof(bmp.Colors), 0x11223344);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, (void*)data, &bmp.bi, DIB_RGB_COLORS,
|
||||
DIB_BitmapMaxBitsSize(&bmp.bi, 15), 0) > 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
RTEST(bmp.bi.bmiHeader.biWidth == 16);
|
||||
RTEST(bmp.bi.bmiHeader.biHeight == 16);
|
||||
RTEST(bmp.bi.bmiHeader.biBitCount == ScreenBpp);
|
||||
RTEST(bmp.bi.bmiHeader.biSizeImage == (16 * 16) * (ScreenBpp / 8));
|
||||
|
||||
TEST(bmp.Colors[0].rgbRed != 0x44);
|
||||
|
||||
/* Test a BITMAPCOREINFO structure */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
ZeroMemory(&bic, sizeof(BITMAPCOREINFO));
|
||||
bic.bmciHeader.bcSize = sizeof(BITMAPCOREHEADER);
|
||||
TEST(NtGdiGetDIBitsInternal(hDCScreen, hBitmap, 0, 15, NULL, (PBITMAPINFO)&bic, DIB_RGB_COLORS,
|
||||
DIB_BitmapMaxBitsSize((PBITMAPINFO)&bic, 15), 0) > 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
|
||||
ReleaseDC(NULL, hDCScreen);
|
||||
DeleteObject(hBitmap);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
|
|
@ -1,80 +1,80 @@
|
|||
INT
|
||||
Test_NtGdiGetRandomRgn(PTESTINFO pti)
|
||||
{
|
||||
HWND hWnd;
|
||||
HDC hDC;
|
||||
HRGN hrgn, hrgn2;
|
||||
|
||||
/* Create a window */
|
||||
hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,
|
||||
NULL, NULL, g_hInstance, 0);
|
||||
// UpdateWindow(hWnd);
|
||||
hDC = GetDC(hWnd);
|
||||
|
||||
ASSERT(hDC != NULL);
|
||||
|
||||
hrgn = CreateRectRgn(0,0,0,0);
|
||||
hrgn2 = CreateRectRgn(3,3,10,10);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetRandomRgn(0, hrgn, 0) == -1);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetRandomRgn((HDC)2345, hrgn, 1) == -1);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetRandomRgn((HDC)2345, hrgn, 10) == -1);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetRandomRgn((HDC)2345, (HRGN)10, 10) == -1);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetRandomRgn((HDC)2345, 0, 1) == -1);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, 0, 0) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, 0, 1) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, (HRGN)-5, 0) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, (HRGN)-5, 1) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 0) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 1) == 0);
|
||||
TEST(NtGdiGetRandomRgn(hDC, hrgn, 2) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 3) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 4) == 1);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 5) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 10) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, -10) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SelectClipRgn(hDC, hrgn2);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, 0, 1) == -1);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 1) == 1);
|
||||
RTEST(CombineRgn(hrgn, hrgn, hrgn, RGN_OR) == SIMPLEREGION);
|
||||
RTEST(CombineRgn(hrgn, hrgn, hrgn2, RGN_XOR) == NULLREGION);
|
||||
|
||||
SetRectRgn(hrgn2,0,0,0,0);
|
||||
SelectClipRgn(hDC, hrgn2);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 1) == 1);
|
||||
|
||||
RTEST(CombineRgn(hrgn2, hrgn, hrgn2, RGN_XOR) == NULLREGION);
|
||||
RTEST(CombineRgn(hrgn2, hrgn, hrgn, RGN_OR) == NULLREGION);
|
||||
|
||||
SelectClipRgn(hDC, NULL);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 1) == 0);
|
||||
|
||||
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 4) == 1);
|
||||
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
ReleaseDC(hWnd, hDC);
|
||||
DestroyWindow(hWnd);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
INT
|
||||
Test_NtGdiGetRandomRgn(PTESTINFO pti)
|
||||
{
|
||||
HWND hWnd;
|
||||
HDC hDC;
|
||||
HRGN hrgn, hrgn2;
|
||||
|
||||
/* Create a window */
|
||||
hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,
|
||||
NULL, NULL, g_hInstance, 0);
|
||||
// UpdateWindow(hWnd);
|
||||
hDC = GetDC(hWnd);
|
||||
|
||||
ASSERT(hDC != NULL);
|
||||
|
||||
hrgn = CreateRectRgn(0,0,0,0);
|
||||
hrgn2 = CreateRectRgn(3,3,10,10);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetRandomRgn(0, hrgn, 0) == -1);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetRandomRgn((HDC)2345, hrgn, 1) == -1);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetRandomRgn((HDC)2345, hrgn, 10) == -1);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetRandomRgn((HDC)2345, (HRGN)10, 10) == -1);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetRandomRgn((HDC)2345, 0, 1) == -1);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, 0, 0) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, 0, 1) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, (HRGN)-5, 0) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, (HRGN)-5, 1) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 0) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 1) == 0);
|
||||
TEST(NtGdiGetRandomRgn(hDC, hrgn, 2) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 3) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 4) == 1);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 5) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 10) == 0);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, -10) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
SelectClipRgn(hDC, hrgn2);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, 0, 1) == -1);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 1) == 1);
|
||||
RTEST(CombineRgn(hrgn, hrgn, hrgn, RGN_OR) == SIMPLEREGION);
|
||||
RTEST(CombineRgn(hrgn, hrgn, hrgn2, RGN_XOR) == NULLREGION);
|
||||
|
||||
SetRectRgn(hrgn2,0,0,0,0);
|
||||
SelectClipRgn(hDC, hrgn2);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 1) == 1);
|
||||
|
||||
RTEST(CombineRgn(hrgn2, hrgn, hrgn2, RGN_XOR) == NULLREGION);
|
||||
RTEST(CombineRgn(hrgn2, hrgn, hrgn, RGN_OR) == NULLREGION);
|
||||
|
||||
SelectClipRgn(hDC, NULL);
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 1) == 0);
|
||||
|
||||
|
||||
RTEST(NtGdiGetRandomRgn(hDC, hrgn, 4) == 1);
|
||||
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
ReleaseDC(hWnd, hDC);
|
||||
DestroyWindow(hWnd);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
|
|
@ -1,62 +1,62 @@
|
|||
INT
|
||||
Test_NtGdiSetBitmapBits(PTESTINFO pti)
|
||||
{
|
||||
BYTE Bits[50] = {0,1,2,3,4,5,6,7,8,9};
|
||||
HBITMAP hBitmap;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiSetBitmapBits(0, 0, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test NULL bitnap handle */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiSetBitmapBits(0, 5, Bits) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
/* Test invalid bitmap handle */
|
||||
hBitmap = (HBITMAP)CreatePen(PS_SOLID, 1, RGB(1,2,3));
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 5, Bits) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
DeleteObject(hBitmap);
|
||||
|
||||
hBitmap = CreateBitmap(3, 3, 1, 8, NULL);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
|
||||
/* test NULL pointer and count buffer size != 0 */
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 5, NULL) == 0);
|
||||
|
||||
/* test NULL pointer and buffer size == 0*/
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 0, NULL) == 0);
|
||||
|
||||
/* test bad pointer */
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 5, (PBYTE)0x500) == 0);
|
||||
|
||||
/* Test if we can set a number of bytes between lines */
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 5, Bits) == 5);
|
||||
|
||||
/* Test alignment */
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 4, Bits+1) == 4);
|
||||
|
||||
/* Test 1 byte too much */
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 10, Bits) == 10);
|
||||
|
||||
/* Test one row too much */
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 12, Bits) == 12);
|
||||
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 13, Bits) == 12);
|
||||
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 100, Bits) == 12);
|
||||
|
||||
/* Test huge bytes count */
|
||||
TEST(NtGdiSetBitmapBits(hBitmap, 12345678, Bits) == 0);
|
||||
|
||||
/* Test negative bytes count */
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, -5, Bits) == 0);
|
||||
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
DeleteObject(hBitmap);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
INT
|
||||
Test_NtGdiSetBitmapBits(PTESTINFO pti)
|
||||
{
|
||||
BYTE Bits[50] = {0,1,2,3,4,5,6,7,8,9};
|
||||
HBITMAP hBitmap;
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiSetBitmapBits(0, 0, 0) == 0);
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test NULL bitnap handle */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiSetBitmapBits(0, 5, Bits) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
/* Test invalid bitmap handle */
|
||||
hBitmap = (HBITMAP)CreatePen(PS_SOLID, 1, RGB(1,2,3));
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 5, Bits) == 0);
|
||||
RTEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
DeleteObject(hBitmap);
|
||||
|
||||
hBitmap = CreateBitmap(3, 3, 1, 8, NULL);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
|
||||
/* test NULL pointer and count buffer size != 0 */
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 5, NULL) == 0);
|
||||
|
||||
/* test NULL pointer and buffer size == 0*/
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 0, NULL) == 0);
|
||||
|
||||
/* test bad pointer */
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 5, (PBYTE)0x500) == 0);
|
||||
|
||||
/* Test if we can set a number of bytes between lines */
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 5, Bits) == 5);
|
||||
|
||||
/* Test alignment */
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 4, Bits+1) == 4);
|
||||
|
||||
/* Test 1 byte too much */
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 10, Bits) == 10);
|
||||
|
||||
/* Test one row too much */
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 12, Bits) == 12);
|
||||
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 13, Bits) == 12);
|
||||
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, 100, Bits) == 12);
|
||||
|
||||
/* Test huge bytes count */
|
||||
TEST(NtGdiSetBitmapBits(hBitmap, 12345678, Bits) == 0);
|
||||
|
||||
/* Test negative bytes count */
|
||||
RTEST(NtGdiSetBitmapBits(hBitmap, -5, Bits) == 0);
|
||||
|
||||
RTEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
DeleteObject(hBitmap);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue