Author: tkreuzer
Date: Mon Aug 13 02:33:21 2007
New Revision: 28308
URL:
http://svn.reactos.org/svn/reactos?rev=28308&view=rev
Log:
65 tests for NtGdiCreateBitmap
Added:
trunk/rostests/apitests/w32knapi/ntgdi/NtGdiCreateBitmap.c
trunk/rostests/apitests/w32knapi/ntgdi/NtGdiCreateCompatibleBitmap.c
Modified:
trunk/rostests/apitests/w32knapi/testlist.c
Added: trunk/rostests/apitests/w32knapi/ntgdi/NtGdiCreateBitmap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/w32knapi/ntgdi/N…
==============================================================================
--- trunk/rostests/apitests/w32knapi/ntgdi/NtGdiCreateBitmap.c (added)
+++ trunk/rostests/apitests/w32knapi/ntgdi/NtGdiCreateBitmap.c Mon Aug 13 02:33:21 2007
@@ -1,0 +1,184 @@
+#include "../w32knapi.h"
+
+W32KAPI
+HBITMAP
+APIENTRY
+NtGdiCreateBitmap(
+ IN INT cx,
+ IN INT cy,
+ IN UINT cPlanes,
+ IN UINT cBPP,
+ IN OPTIONAL LPBYTE pjInit
+)
+{
+ return (HBITMAP)Syscall(L"NtGdiCreateBitmap", 5, &cx);
+}
+
+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);
+ ASSERT1(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);
+ ASSERT1(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);
+ ASSERT1(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
+ TEST(bitmap.bmBitsPixel == 4);
+ DeleteObject(hBmp);
+
+ TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 6, NULL)) != NULL);
+ ASSERT1(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
+ TEST(bitmap.bmBitsPixel == 8);
+ DeleteObject(hBmp);
+
+ TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 15, NULL)) != NULL);
+ ASSERT1(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
+ TEST(bitmap.bmBitsPixel == 16);
+ DeleteObject(hBmp);
+
+ TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 17, NULL)) != NULL);
+ ASSERT1(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
+ TEST(bitmap.bmBitsPixel == 24);
+ DeleteObject(hBmp);
+
+ TEST((hBmp = NtGdiCreateBitmap(1, 1, 3, 7, NULL)) != NULL);
+ ASSERT1(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
+ TEST(bitmap.bmBitsPixel == 24);
+ DeleteObject(hBmp);
+
+ TEST((hBmp = NtGdiCreateBitmap(1, 1, 1, 25, NULL)) != NULL);
+ ASSERT1(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);
+ ASSERT1(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);
+
+ 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;
+
+}
Added: trunk/rostests/apitests/w32knapi/ntgdi/NtGdiCreateCompatibleBitmap.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/w32knapi/ntgdi/N…
==============================================================================
--- trunk/rostests/apitests/w32knapi/ntgdi/NtGdiCreateCompatibleBitmap.c (added)
+++ trunk/rostests/apitests/w32knapi/ntgdi/NtGdiCreateCompatibleBitmap.c Mon Aug 13
02:33:21 2007
@@ -1,0 +1,19 @@
+#include "../w32knapi.h"
+
+W32KAPI
+HBITMAP
+APIENTRY
+NtGdiCreateCompatibleBitmap(
+ IN HDC hdc,
+ IN INT cx,
+ IN INT cy
+)
+{
+ return (HBITMAP)Syscall(L"NtGdiCreateCompatibleBitmap", 3, &hdc);
+}
+
+INT
+Test_NtGdiCreateCompatibleBitmap(PTESTINFO pti)
+{
+ return APISTATUS_NORMAL;
+}
Modified: trunk/rostests/apitests/w32knapi/testlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/w32knapi/testlis…
==============================================================================
--- trunk/rostests/apitests/w32knapi/testlist.c (original)
+++ trunk/rostests/apitests/w32knapi/testlist.c Mon Aug 13 02:33:21 2007
@@ -7,6 +7,8 @@
#include "ntdd/NtGdiDdQueryDirectDrawObject.c"
#include "ntgdi/NtGdiArcInternal.c"
+#include "ntgdi/NtGdiCreateBitmap.c"
+#include "ntgdi/NtGdiCreateCompatibleBitmap.c"
//#include "ntgdi/NtGdiDoPalette.c"
#include "ntgdi/NtGdiGetBitmapBits.c"
#include "ntgdi/NtGdiGetRandomRgn.c"
@@ -23,9 +25,10 @@
{ L"NtGdiDdQueryDirectDrawObject", Test_NtGdiDdQueryDirectDrawObject },
{ L"NtGdiDdDeleteDirectDrawObject", Test_NtGdiDdDeleteDirectDrawObject },
-
/* ntgdi */
{ L"NtGdiArcInternal", Test_NtGdiArcInternal },
+ { L"NtGdiCreateBitmap", Test_NtGdiCreateBitmap },
+ { L"NtGdiCreateCompatibleBitmap", Test_NtGdiCreateCompatibleBitmap },
// { L"NtGdiDoPalette", Test_NtGdiDoPalette },
{ L"NtGdiGetBitmapBits", Test_NtGdiGetBitmapBits },
{ L"NtGdiGetRandomRgn", Test_NtGdiGetRandomRgn },