Signed-off-by: Andrey Gusev andrey.goosev@gmail.com --- dlls/gdi32/tests/bitmap.c | 23 ++++++++++++++++++++++- dlls/gdi32/tests/brush.c | 7 +++++++ 2 files changed, 29 insertions(+), 1 deletion(-)
diff --git a/dlls/gdi32/tests/bitmap.c b/dlls/gdi32/tests/bitmap.c index a4002c83b5..aa833e3a63 100644 --- a/dlls/gdi32/tests/bitmap.c +++ b/dlls/gdi32/tests/bitmap.c @@ -143,8 +143,10 @@ static void test_createdibitmap(void)
hbm = CreateDIBitmap(hdc, NULL, CBM_INIT, NULL, NULL, 0); ok(hbm == NULL, "CreateDIBitmap should fail\n"); + DeleteObject(hbm); hbm = CreateDIBitmap(hdc, NULL, 0, NULL, NULL, 0); ok(hbm == NULL, "CreateDIBitmap should fail\n"); + DeleteObject(hbm);
/* First create an un-initialised bitmap. The depth of the bitmap should match that of the hdc and not that supplied in bmih. @@ -472,11 +474,13 @@ static void test_dibsections(void) bits = (BYTE*)0xdeadbeef; hdib = CreateDIBSection(hdc, NULL, DIB_RGB_COLORS, (void**)&bits, NULL, 0); ok(hdib == NULL && bits == NULL, "CreateDIBSection failed for invalid parameter: bmi == 0x0\n"); + DeleteObject(hdib);
hdib = CreateDIBSection(hdc, pbmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0); ok(hdib != NULL, "CreateDIBSection error %d\n", GetLastError()); ok(GetObjectW(hdib, sizeof(DIBSECTION), &dibsec) != 0, "GetObject failed for DIBSection\n"); ok(dibsec.dsBm.bmBits == bits, "dibsec.dsBits %p != bits %p\n", dibsec.dsBm.bmBits, bits); + DeleteObject(hdib);
/* test the DIB memory */ ok(VirtualQuery(bits, &info, sizeof(info)) == sizeof(info), @@ -492,7 +496,6 @@ static void test_dibsections(void) test_dib_bits_access( hdib, bits );
test_dib_info(hdib, bits, &pbmi->bmiHeader); - DeleteObject(hdib);
/* Test a top-down DIB. */ pbmi->bmiHeader.biHeight = -100; @@ -508,6 +511,7 @@ static void test_dibsections(void) hdib = CreateDIBSection(hdc, pbmi, DIB_RGB_COLORS, (void**)&bits, NULL, 0); ok(hdib == NULL, "CreateDIBSection should fail when asked to create a compressed DIB section\n"); ok(GetLastError() == 0xdeadbeef, "wrong error %d\n", GetLastError()); + DeleteObject(hdib);
pbmi->bmiHeader.biBitCount = 16; pbmi->bmiHeader.biCompression = BI_BITFIELDS; @@ -1079,6 +1083,7 @@ static void test_dib_formats(void)
hdib = CreateDIBSection(hdc, bi, DIB_RGB_COLORS, &bits, NULL, 0); ok( hdib == NULL, "CreateDIBSection succeeded with null bitfields\n" ); + DeleteObject( hdib ); ret = SetDIBits(hdc, hbmp, 0, 1, data, bi, DIB_RGB_COLORS); ok( !ret, "SetDIBits succeeded with null bitfields\n" ); /* other functions don't check */ @@ -1107,6 +1112,7 @@ static void test_dib_formats(void) *(DWORD *)&bi->bmiColors[2] = 7; hdib = CreateDIBSection(hdc, bi, DIB_RGB_COLORS, &bits, NULL, 0); ok( hdib == NULL, "CreateDIBSection succeeded with null bitfields\n" ); + DeleteObject( hdib ); ret = SetDIBits(hdc, hbmp, 0, 1, data, bi, DIB_RGB_COLORS); ok( !ret, "SetDIBits succeeded with null bitfields\n" );
@@ -1126,8 +1132,10 @@ static void test_dib_formats(void) bi->bmiHeader.biCompression = BI_RGB; hdib = CreateDIBSection(hdc, bi, DIB_RGB_COLORS, &bits, NULL, 0); ok( hdib == NULL, "CreateDIBSection succeeded with negative width\n" ); + DeleteObject( hdib ); hdib = CreateDIBitmap( hdc, &bi->bmiHeader, 0, bits, bi, DIB_RGB_COLORS ); ok( hdib == NULL, "CreateDIBitmap succeeded with negative width\n" ); + DeleteObject( hdib ); ret = SetDIBits(hdc, hbmp, 0, 1, data, bi, DIB_RGB_COLORS); ok( !ret, "SetDIBits succeeded with negative width\n" ); ret = SetDIBitsToDevice( memdc, 0, 0, 1, 1, 0, 0, 0, 1, data, bi, DIB_RGB_COLORS ); @@ -1149,6 +1157,7 @@ static void test_dib_formats(void) bi->bmiHeader.biCompression = BI_RGB; hdib = CreateDIBSection(hdc, bi, DIB_RGB_COLORS, &bits, NULL, 0); ok( hdib == NULL, "CreateDIBSection succeeded with zero width\n" ); + DeleteObject( hdib ); hdib = CreateDIBitmap( hdc, &bi->bmiHeader, 0, bits, bi, DIB_RGB_COLORS ); ok( hdib != NULL, "CreateDIBitmap failed with zero width\n" ); DeleteObject( hdib ); @@ -1173,6 +1182,7 @@ static void test_dib_formats(void) bi->bmiHeader.biCompression = BI_RGB; hdib = CreateDIBSection(hdc, bi, DIB_RGB_COLORS, &bits, NULL, 0); ok( hdib == NULL, "CreateDIBSection succeeded with zero height\n" ); + DeleteObject( hdib ); hdib = CreateDIBitmap( hdc, &bi->bmiHeader, 0, bits, bi, DIB_RGB_COLORS ); ok( hdib != NULL, "CreateDIBitmap failed with zero height\n" ); DeleteObject( hdib ); @@ -1199,6 +1209,7 @@ static void test_dib_formats(void) bi->bmiHeader.biCompression = BI_RGB; hdib = CreateDIBSection(hdc, bi, DIB_PAL_COLORS+1, &bits, NULL, 0); ok( hdib == NULL, "CreateDIBSection succeeded with DIB_PAL_COLORS+1\n" ); + DeleteObject( hdib ); hdib = CreateDIBitmap( hdc, &bi->bmiHeader, 0, bits, bi, DIB_PAL_COLORS+1 ); ok( hdib != NULL, "CreateDIBitmap failed with DIB_PAL_COLORS+1\n" ); DeleteObject( hdib ); @@ -1223,6 +1234,7 @@ static void test_dib_formats(void) bi->bmiHeader.biCompression = BI_RGB; hdib = CreateDIBSection(hdc, bi, DIB_PAL_COLORS+2, &bits, NULL, 0); ok( hdib == NULL, "CreateDIBSection succeeded with DIB_PAL_COLORS+2\n" ); + DeleteObject( hdib ); hdib = CreateDIBitmap( hdc, &bi->bmiHeader, 0, bits, bi, DIB_PAL_COLORS+2 ); ok( hdib == NULL, "CreateDIBitmap succeeded with DIB_PAL_COLORS+2\n" ); DeleteObject( hdib ); @@ -1255,6 +1267,7 @@ static void test_dib_formats(void) bi->bmiHeader.biCompression = BI_RGB; hdib = CreateDIBSection(hdc, bi, DIB_RGB_COLORS, &bits, NULL, 0); ok( hdib == NULL, "CreateDIBSection succeeded with size overflow\n" ); + DeleteObject( hdib );
bi->bmiHeader.biWidth = 1; bi->bmiHeader.biHeight = 0x40000001; @@ -1262,6 +1275,7 @@ static void test_dib_formats(void) bi->bmiHeader.biCompression = BI_RGB; hdib = CreateDIBSection(hdc, bi, DIB_RGB_COLORS, &bits, NULL, 0); ok( hdib == NULL, "CreateDIBSection succeeded with size overflow\n" ); + DeleteObject( hdib );
bi->bmiHeader.biWidth = 2; bi->bmiHeader.biHeight = 0x40000001; @@ -1269,6 +1283,7 @@ static void test_dib_formats(void) bi->bmiHeader.biCompression = BI_RGB; hdib = CreateDIBSection(hdc, bi, DIB_RGB_COLORS, &bits, NULL, 0); ok( hdib == NULL, "CreateDIBSection succeeded with size overflow\n" ); + DeleteObject( hdib );
bi->bmiHeader.biWidth = 0x40000001; bi->bmiHeader.biHeight = 1; @@ -1276,6 +1291,7 @@ static void test_dib_formats(void) bi->bmiHeader.biCompression = BI_RGB; hdib = CreateDIBSection(hdc, bi, DIB_RGB_COLORS, &bits, NULL, 0); ok( hdib == NULL, "CreateDIBSection succeeded with size overflow\n" ); + DeleteObject( hdib );
bi->bmiHeader.biWidth = 0x40000001; bi->bmiHeader.biHeight = 4; @@ -1283,6 +1299,7 @@ static void test_dib_formats(void) bi->bmiHeader.biCompression = BI_RGB; hdib = CreateDIBSection(hdc, bi, DIB_RGB_COLORS, &bits, NULL, 0); ok( hdib == NULL, "CreateDIBSection succeeded with size overflow\n" ); + DeleteObject( hdib );
DeleteDC( memdc ); DeleteObject( hbmp ); @@ -2615,6 +2632,7 @@ static void test_GetDIBits_BI_BITFIELDS(void) dibinfo->bmiHeader.biClrImportant = 0; hbm = CreateDIBSection( hdc, dibinfo, DIB_RGB_COLORS, &ptr, NULL, 0 ); ok( hbm == 0, "creating 24-bpp BI_BITFIELDS dibsection should fail\n" ); + DeleteObject( hbm ); dibinfo->bmiHeader.biCompression = BI_RGB; hbm = CreateDIBSection( hdc, dibinfo, DIB_RGB_COLORS, &ptr, NULL, 0 ); ok( hbm != 0, "failed to create bitmap\n" ); @@ -2876,6 +2894,7 @@ static void test_bitmapinfoheadersize(void)
hdib = CreateDIBSection(hdc, &bmi, 0, NULL, NULL, 0); ok(hdib == NULL, "CreateDIBSection succeeded\n"); + DeleteObject(hdib);
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
@@ -2937,6 +2956,7 @@ static void test_bitmapinfoheadersize(void)
hdib = CreateDIBSection(hdc, (BITMAPINFO *)&bci, 0, NULL, NULL, 0); ok(hdib == NULL, "CreateDIBSection succeeded\n"); + DeleteObject(hdib);
bci.bmciHeader.bcSize = sizeof(BITMAPCOREHEADER);
@@ -2949,6 +2969,7 @@ static void test_bitmapinfoheadersize(void)
hdib = CreateDIBSection(hdc, (BITMAPINFO *)&bci, 0, NULL, NULL, 0); ok(hdib == NULL, "CreateDIBSection succeeded\n"); + DeleteObject(hdib);
bci.bmciHeader.bcSize = sizeof(BITMAPCOREINFO);
diff --git a/dlls/gdi32/tests/brush.c b/dlls/gdi32/tests/brush.c index 1a10429c05..ec5819f042 100644 --- a/dlls/gdi32/tests/brush.c +++ b/dlls/gdi32/tests/brush.c @@ -237,36 +237,43 @@ static void test_pattern_brush(void) DeleteObject( brush ); brush = CreateDIBPatternBrushPt( info, DIB_PAL_COLORS + 2 ); ok( !brush, "CreateDIBPatternBrushPt succeeded\n" ); + DeleteObject( brush ); brush = CreateDIBPatternBrushPt( info, DIB_PAL_COLORS + 3 ); ok( !brush, "CreateDIBPatternBrushPt succeeded\n" ); + DeleteObject( brush );
info->bmiHeader.biBitCount = 8; info->bmiHeader.biCompression = BI_RLE8; brush = CreateDIBPatternBrushPt( info, DIB_RGB_COLORS ); ok( !brush, "CreateDIBPatternBrushPt succeeded\n" ); + DeleteObject( brush );
info->bmiHeader.biBitCount = 4; info->bmiHeader.biCompression = BI_RLE4; brush = CreateDIBPatternBrushPt( info, DIB_RGB_COLORS ); ok( !brush, "CreateDIBPatternBrushPt succeeded\n" ); + DeleteObject( brush );
br.lbStyle = BS_DIBPATTERN8X8; br.lbColor = DIB_RGB_COLORS; br.lbHatch = (ULONG_PTR)mem; brush = CreateBrushIndirect( &br ); ok( !brush, "CreatePatternBrush succeeded\n" ); + DeleteObject( brush );
br.lbStyle = BS_MONOPATTERN; br.lbColor = DIB_RGB_COLORS; br.lbHatch = (ULONG_PTR)mem; brush = CreateBrushIndirect( &br ); ok( !brush, "CreatePatternBrush succeeded\n" ); + DeleteObject( brush );
br.lbStyle = BS_INDEXED; br.lbColor = DIB_RGB_COLORS; br.lbHatch = (ULONG_PTR)mem; brush = CreateBrushIndirect( &br ); ok( !brush, "CreatePatternBrush succeeded\n" ); + DeleteObject( brush );
GlobalFree( mem ); }