From: Daniel Lehman dlehman25@gmail.com
--- dlls/oleaut32/tests/olepicture.c | 42 +++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 14 deletions(-)
diff --git a/dlls/oleaut32/tests/olepicture.c b/dlls/oleaut32/tests/olepicture.c index 58d5577631c..d37e95c6401 100644 --- a/dlls/oleaut32/tests/olepicture.c +++ b/dlls/oleaut32/tests/olepicture.c @@ -210,7 +210,7 @@ typedef struct NoStatStreamImpl static IStream* NoStatStream_Construct(HGLOBAL hGlobal);
static void -test_pic_with_stream(LPSTREAM stream, unsigned int imgsize) +test_pic_with_stream(LPSTREAM stream, unsigned int imgsize, int bpp, BOOL todo) { IPicture* pic = NULL; HRESULT hres; @@ -247,8 +247,22 @@ test_pic_with_stream(LPSTREAM stream, unsigned int imgsize) if (handle) { BITMAP bmp; + DIBSECTION dib; + GetObjectA(UlongToHandle(handle), sizeof(BITMAP), &bmp); ok(bmp.bmBits != 0, "not a dib\n"); + todo_wine_if(todo) + ok(bmp.bmBitsPixel == bpp, "expected %d, got %d\n", bpp, bmp.bmBitsPixel); + + GetObjectA(UlongToHandle(handle), sizeof(DIBSECTION), &dib); + ok(dib.dsBm.bmBits != 0, "not a dib\n"); + todo_wine_if(todo) { + ok(dib.dsBm.bmBitsPixel == bpp, "expected %d, got %d\n", bpp, dib.dsBm.bmBitsPixel); + ok(dib.dsBmih.biBitCount == bpp, "expected %d, got %d\n", bpp, dib.dsBmih.biBitCount); + } + ok(dib.dsBmih.biCompression == BI_RGB, "expected %d, got %ld\n", BI_RGB, dib.dsBmih.biCompression); + todo_wine_if(dib.dsBmih.biClrUsed != dib.dsBmih.biClrImportant) + ok(dib.dsBmih.biClrUsed == dib.dsBmih.biClrImportant, "expected %ld, got %ld\n", dib.dsBmih.biClrUsed, dib.dsBmih.biClrImportant); }
width = 0; @@ -282,7 +296,7 @@ test_pic_with_stream(LPSTREAM stream, unsigned int imgsize) }
static void -test_pic(const unsigned char *imgdata, unsigned int imgsize) +test_pic(const unsigned char *imgdata, unsigned int imgsize, int bpp, BOOL todo) { LPSTREAM stream; HGLOBAL hglob; @@ -305,14 +319,14 @@ test_pic(const unsigned char *imgdata, unsigned int imgsize) memset(&seekto,0,sizeof(seekto)); hres = IStream_Seek(stream, seekto, STREAM_SEEK_CUR, &newpos1); ok (hres == S_OK, "istream seek failed? doubt it... hres 0x%08lx\n", hres); - test_pic_with_stream(stream, imgsize); - + test_pic_with_stream(stream, imgsize, bpp, todo); + IStream_Release(stream);
/* again with Non Statable and Non Seekable stream */ stream = NoStatStream_Construct(hglob); hglob = 0; /* Non-statable impl always deletes on release */ - test_pic_with_stream(stream, 0); + test_pic_with_stream(stream, 0, bpp, todo);
IStream_Release(stream); for (i = 1; i <= 8; i++) { @@ -336,14 +350,14 @@ test_pic(const unsigned char *imgdata, unsigned int imgsize) memset(&seekto,0,sizeof(seekto)); hres = IStream_Seek(stream, seekto, STREAM_SEEK_CUR, &newpos1); ok (hres == S_OK, "istream seek failed? doubt it... hres 0x%08lx\n", hres); - test_pic_with_stream(stream, imgsize); - + test_pic_with_stream(stream, imgsize, bpp, todo); + IStream_Release(stream);
/* again with Non Statable and Non Seekable stream */ stream = NoStatStream_Construct(hglob); hglob = 0; /* Non-statable impl always deletes on release */ - test_pic_with_stream(stream, 0); + test_pic_with_stream(stream, 0, bpp, todo);
IStream_Release(stream); } @@ -1702,13 +1716,13 @@ START_TEST(olepicture) }
/* Test regular 1x1 pixel images of gif, jpg, bmp type */ - test_pic(gifimage, sizeof(gifimage)); - test_pic(jpgimage, sizeof(jpgimage)); - test_pic(bmpimage, sizeof(bmpimage)); - test_pic(bmpimage_rle8, sizeof(bmpimage_rle8)); - test_pic(gif4pixel, sizeof(gif4pixel)); + test_pic(gifimage, sizeof(gifimage), 1, TRUE); + test_pic(jpgimage, sizeof(jpgimage), 24, TRUE); + test_pic(bmpimage, sizeof(bmpimage), 1, TRUE); + test_pic(bmpimage_rle8, sizeof(bmpimage_rle8), 4, TRUE); + test_pic(gif4pixel, sizeof(gif4pixel), 4, TRUE); /* FIXME: No PNG support in Windows... */ - if (0) test_pic(pngimage, sizeof(pngimage)); + if (0) test_pic(pngimage, sizeof(pngimage), 32, TRUE); test_empty_image(); test_empty_image_2(); if (pOleLoadPictureEx)