[ros-diffs] [greatlrd] 37257: Old code lying around. Adding more test to NtGdiCreateBitmap

greatlrd at svn.reactos.org greatlrd at svn.reactos.org
Sun Nov 9 14:26:16 CET 2008


Author: greatlrd
Date: Sun Nov  9 07:26:15 2008
New Revision: 37257

URL: http://svn.reactos.org/svn/reactos?rev=37257&view=rev
Log:
Old code lying around. 
Adding more test to NtGdiCreateBitmap

Modified:
    branches/reactx/rostests/apitests/w32knapi/ntgdi/NtGdiCreateBitmap.c

Modified: branches/reactx/rostests/apitests/w32knapi/ntgdi/NtGdiCreateBitmap.c
URL: http://svn.reactos.org/svn/reactos/branches/reactx/rostests/apitests/w32knapi/ntgdi/NtGdiCreateBitmap.c?rev=37257&r1=37256&r2=37257&view=diff
==============================================================================
--- branches/reactx/rostests/apitests/w32knapi/ntgdi/NtGdiCreateBitmap.c [iso-8859-1] (original)
+++ branches/reactx/rostests/apitests/w32knapi/ntgdi/NtGdiCreateBitmap.c [iso-8859-1] Sun Nov  9 07:26:15 2008
@@ -5,52 +5,52 @@
 	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);
+    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));
+    SetLastError(ERROR_SUCCESS);
+	TEST(NtGdiCreateBitmap(0, 0, 0, 1, NULL) == NULL);
+	TEST(GetLastError() == ERROR_INVALID_PARAMETER);
+
+    SetLastError(ERROR_SUCCESS);
+	TEST(NtGdiCreateBitmap(0, 0, 1, 0, NULL) == NULL);
+	TEST(GetLastError() == ERROR_INVALID_PARAMETER);
+
+    SetLastError(ERROR_SUCCESS);
+	TEST(NtGdiCreateBitmap(0, 1, 0, 0, NULL) == NULL);
+	TEST(GetLastError() == ERROR_INVALID_PARAMETER);
+
+    SetLastError(ERROR_SUCCESS);
+	TEST(NtGdiCreateBitmap(1, 0, 0, 0, NULL) == NULL);
+	TEST(GetLastError() == ERROR_INVALID_PARAMETER);
+
+    SetLastError(ERROR_SUCCESS);
+	TEST(NtGdiCreateBitmap(1, 0, 0, 1, NULL) == NULL);
+	TEST(GetLastError() == ERROR_INVALID_PARAMETER);
+
+    SetLastError(ERROR_SUCCESS);
+	TEST(NtGdiCreateBitmap(1, 0, 1, 0, NULL) == NULL);
+	TEST(GetLastError() == ERROR_INVALID_PARAMETER);
+
+    SetLastError(ERROR_SUCCESS);
+	TEST(NtGdiCreateBitmap(1, 1, 0, 0, NULL) == NULL);
+	TEST(GetLastError() == ERROR_INVALID_PARAMETER);
+
+    SetLastError(ERROR_SUCCESS);
+	TEST(NtGdiCreateBitmap(1, 1, 0, 1, NULL) == NULL);
+	TEST(GetLastError() == ERROR_INVALID_PARAMETER);
+
+    SetLastError(ERROR_SUCCESS);
+	TEST(NtGdiCreateBitmap(1, 1, 1, 0, NULL) == NULL);
+	TEST(GetLastError() == ERROR_INVALID_PARAMETER);
+
+    SetLastError(ERROR_SUCCESS);
+	TEST( (hBmp =NtGdiCreateBitmap(1, 1, 1, 1, NULL)) != NULL);
+	TEST(GetLastError() == ERROR_INVALID_PARAMETER);	
+
+    RtlZeroMemory(&bitmap,sizeof(BITMAP));
+    TEST(GetObject(hBmp, sizeof(BITMAP), &bitmap) == sizeof(BITMAP));
 	TEST(bitmap.bmType == 0);
 	TEST(bitmap.bmWidth == 1);
 	TEST(bitmap.bmHeight == 1);
@@ -59,18 +59,39 @@
 	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);
+    SetLastError(ERROR_SUCCESS);
+	TEST( (hBmp =NtGdiCreateBitmap(1, 1, 1, -1, NULL)) != NULL);
+	TEST(GetLastError() == ERROR_INVALID_PARAMETER);	
+	DeleteObject(hBmp);
+
+    SetLastError(ERROR_SUCCESS);
+	TEST( (hBmp =NtGdiCreateBitmap(1, 1, -1, 1, NULL)) != NULL);
+	TEST(GetLastError() == ERROR_INVALID_PARAMETER);	
+	DeleteObject(hBmp);
+
+    SetLastError(ERROR_SUCCESS);
+	TEST( (hBmp =NtGdiCreateBitmap(1, -1, 1, 1, NULL)) != NULL);
+	TEST(GetLastError() == ERROR_INVALID_PARAMETER);	
+	DeleteObject(hBmp);
+
+    SetLastError(ERROR_SUCCESS);
+	TEST( (hBmp =NtGdiCreateBitmap(-1, 1, 1, 1, NULL)) != NULL);
+	TEST(GetLastError() == ERROR_INVALID_PARAMETER);	
+	DeleteObject(hBmp);
+
+	
+	
+	
+
+
+	/* 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);
@@ -81,10 +102,28 @@
 	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 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 bad cBPP */
 	SetLastError(ERROR_SUCCESS);
@@ -148,31 +187,14 @@
 	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;



More information about the Ros-diffs mailing list