Alexandre Julliard : gdi32: Reject invalid DIB depths in CreateDIBSection.
Alexandre Julliard
julliard at winehq.org
Tue Jul 20 11:20:33 CDT 2010
Module: wine
Branch: master
Commit: 811cdfaf2715c3784f947e70907fc68454bb5e8e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=811cdfaf2715c3784f947e70907fc68454bb5e8e
Author: Alexandre Julliard <julliard at winehq.org>
Date: Tue Jul 20 14:28:51 2010 +0200
gdi32: Reject invalid DIB depths in CreateDIBSection.
---
dlls/gdi32/dib.c | 5 +--
dlls/gdi32/tests/bitmap.c | 2 +-
dlls/gdiplus/tests/graphics.c | 57 +++++++++++++++++++++++-----------------
3 files changed, 36 insertions(+), 28 deletions(-)
diff --git a/dlls/gdi32/dib.c b/dlls/gdi32/dib.c
index ce5ab8b..bf36986 100644
--- a/dlls/gdi32/dib.c
+++ b/dlls/gdi32/dib.c
@@ -1261,11 +1261,10 @@ HBITMAP WINAPI CreateDIBSection(HDC hdc, CONST BITMAPINFO *bmi, UINT usage,
case 8:
case 24:
if (compression == BI_RGB) break;
+ /* fall through */
+ default:
WARN( "invalid %u bpp compression %u\n", bpp, compression );
return 0;
- default:
- FIXME( "should fail %u bpp compression %u\n", bpp, compression );
- break;
}
if (!(dib = HeapAlloc( GetProcessHeap(), 0, sizeof(*dib) ))) return 0;
diff --git a/dlls/gdi32/tests/bitmap.c b/dlls/gdi32/tests/bitmap.c
index 8e5ad2e..3be5734 100644
--- a/dlls/gdi32/tests/bitmap.c
+++ b/dlls/gdi32/tests/bitmap.c
@@ -554,7 +554,7 @@ static void test_dibsections(void)
if (i == 1 || i == 4 || i == 8 || i == 16 || i == 24 || i == 32)
ok(hdib != NULL, "CreateDIBSection bpp %u\n", i);
else
- todo_wine ok(hdib == NULL, "CreateDIBSection bpp %u succeeded\n", i);
+ ok(hdib == NULL, "CreateDIBSection bpp %u succeeded\n", i);
if (hdib) DeleteObject( hdib );
}
diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c
index aaf661d..16f0d31 100644
--- a/dlls/gdiplus/tests/graphics.c
+++ b/dlls/gdiplus/tests/graphics.c
@@ -2346,34 +2346,43 @@ static void test_GdipGetNearestColor(void)
GdipDisposeImage((GpImage*)bitmap);
status = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat48bppRGB, NULL, &bitmap);
- expect(Ok, status);
- status = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics);
- expect(Ok, status);
- status = GdipGetNearestColor(graphics, &color);
- expect(Ok, status);
- expect(0xdeadbeef, color);
- GdipDeleteGraphics(graphics);
- GdipDisposeImage((GpImage*)bitmap);
+ todo_wine expect(Ok, status);
+ if (status == Ok)
+ {
+ status = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics);
+ expect(Ok, status);
+ status = GdipGetNearestColor(graphics, &color);
+ expect(Ok, status);
+ expect(0xdeadbeef, color);
+ GdipDeleteGraphics(graphics);
+ GdipDisposeImage((GpImage*)bitmap);
+ }
status = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat64bppARGB, NULL, &bitmap);
- expect(Ok, status);
- status = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics);
- expect(Ok, status);
- status = GdipGetNearestColor(graphics, &color);
- expect(Ok, status);
- expect(0xdeadbeef, color);
- GdipDeleteGraphics(graphics);
- GdipDisposeImage((GpImage*)bitmap);
+ todo_wine expect(Ok, status);
+ if (status == Ok)
+ {
+ status = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics);
+ expect(Ok, status);
+ status = GdipGetNearestColor(graphics, &color);
+ expect(Ok, status);
+ expect(0xdeadbeef, color);
+ GdipDeleteGraphics(graphics);
+ GdipDisposeImage((GpImage*)bitmap);
+ }
status = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat64bppPARGB, NULL, &bitmap);
- expect(Ok, status);
- status = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics);
- expect(Ok, status);
- status = GdipGetNearestColor(graphics, &color);
- expect(Ok, status);
- expect(0xdeadbeef, color);
- GdipDeleteGraphics(graphics);
- GdipDisposeImage((GpImage*)bitmap);
+ todo_wine expect(Ok, status);
+ if (status == Ok)
+ {
+ status = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics);
+ expect(Ok, status);
+ status = GdipGetNearestColor(graphics, &color);
+ expect(Ok, status);
+ expect(0xdeadbeef, color);
+ GdipDeleteGraphics(graphics);
+ GdipDisposeImage((GpImage*)bitmap);
+ }
status = GdipCreateBitmapFromScan0(10, 10, 10, PixelFormat16bppRGB565, NULL, &bitmap);
expect(Ok, status);
More information about the wine-cvs
mailing list