[GDI32_APITEST] Remove duplicated test in Test_CreateBitmap

This commit is contained in:
Timo Kreuzer 2017-09-19 11:17:12 +02:00
parent 1131d90516
commit 2dfa6f2979

View File

@ -117,7 +117,6 @@ void Test_CreateBitmap()
HBITMAP hbmp;
BITMAP bitmap;
ULONG cjWidthBytes, cBitsPixel, cExpectedBitsPixel;
int result, TestBitsPixel, ExpectedBitsPixel;
hbmp = CreateBitmap(0, 0, 0, 0, NULL);
ok(hbmp != 0, "should get a 1x1 bitmap\n");
@ -136,32 +135,6 @@ void Test_CreateBitmap()
hbmp = CreateBitmap(1, 2, 1, 33, NULL);
ok(hbmp == 0, "should fail\n");
for (TestBitsPixel = 0; TestBitsPixel <= 32; TestBitsPixel++)
{
/* CreateBitmap API accepts any number as BitsPixels param.
but it can only create 1, 4, 8, 16, 24, 32 bpp bitmaps */
if (TestBitsPixel <= 1) ExpectedBitsPixel = 1;
else if(TestBitsPixel <= 4) ExpectedBitsPixel = 4;
else if(TestBitsPixel <= 8) ExpectedBitsPixel = 8;
else if(TestBitsPixel <= 16) ExpectedBitsPixel = 16;
else if(TestBitsPixel <= 24) ExpectedBitsPixel = 24;
else if(TestBitsPixel <= 32) ExpectedBitsPixel = 32;
/* Calculate proper bmWidthBytes */
hbmp = CreateBitmap(1, 2, 1, TestBitsPixel, NULL);
ok(hbmp != 0, "should get a 1x2 bitmap\n");
result = GetObject(hbmp, sizeof(bitmap), &bitmap);
ok(result > 0, "result = %d\n", result);
ok(bitmap.bmType == 0, "bmType = %ld\n", bitmap.bmType);
ok(bitmap.bmWidth == 1, "bmWidth = %ld\n", bitmap.bmWidth);
ok(bitmap.bmHeight == 2, "bmHeight = %ld\n", bitmap.bmHeight);
ok(bitmap.bmPlanes == 1, "bmPlanes = %d\n", bitmap.bmPlanes);
ok(bitmap.bmBitsPixel == ExpectedBitsPixel, "bmBitsPixel = %d ExpectedBitsPixel= %d \n", bitmap.bmBitsPixel, ExpectedBitsPixel);
ok(bitmap.bmBits == 0, "bmBits = %p\n", bitmap.bmBits);
DeleteObject(hbmp);
}
hbmp = CreateBitmap(1, 2, 1, 1, NULL);
ok(hbmp != 0, "should get a 1x2 bitmap\n");
ok_int(GetObject(hbmp, sizeof(bitmap), &bitmap), sizeof(BITMAP));
@ -177,10 +150,10 @@ void Test_CreateBitmap()
for (cBitsPixel = 0; cBitsPixel <= 32; cBitsPixel++)
{
/* CreateBitmap API accepts any number as BitsPixels param.
but it just can create 1, 4, 8, 16, 24, 32 bpp Bitmaps */
if (cBitsPixel <= 1) cExpectedBitsPixel = 1;
else if (cBitsPixel <= 4) cExpectedBitsPixel = 4;
else if (cBitsPixel <= 8) cExpectedBitsPixel = 8;
but it can only create 1, 4, 8, 16, 24, 32 bpp bitmaps */
if (cBitsPixel <= 1) cExpectedBitsPixel = 1;
else if (cBitsPixel <= 4) cExpectedBitsPixel = 4;
else if (cBitsPixel <= 8) cExpectedBitsPixel = 8;
else if (cBitsPixel <= 16) cExpectedBitsPixel = 16;
else if (cBitsPixel <= 24) cExpectedBitsPixel = 24;
else if (cBitsPixel <= 32) cExpectedBitsPixel = 32;
@ -189,8 +162,8 @@ void Test_CreateBitmap()
ok(hbmp != 0, "should get a 1x2 bitmap %ld\n", cBitsPixel);
ok_int(GetObject(hbmp, sizeof(bitmap), &bitmap), sizeof(BITMAP));
/* calculate expected line width */
cjWidthBytes = ((((ULONG)bitmap.bmWidth) * ((ULONG)bitmap.bmBitsPixel) + 15) & ~15) >> 3;
/* Calculate expected line width */
cjWidthBytes = ((bitmap.bmWidth * bitmap.bmBitsPixel + 15) & ~15) >> 3;
ok_int(bitmap.bmType, 0);
ok_int(bitmap.bmWidth, 1);
@ -200,14 +173,10 @@ void Test_CreateBitmap()
ok_int(bitmap.bmWidthBytes, cjWidthBytes);
ok_ptr(bitmap.bmBits, 0);
DeleteObject(hbmp);
}
hbmp = CreateBitmap(1, 2, 1, 33, NULL);
ok(hbmp == 0, "Expected failure for 33 bpp\n");
}
START_TEST(CreateBitmap)