Commit c7ea378f authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

gdiplus: Add a test to show that GdipCloneImage is not supposed to increase…

gdiplus: Add a test to show that GdipCloneImage is not supposed to increase refcount of the source image.
parent 4c3cc501
......@@ -2674,9 +2674,9 @@ static GpImage *load_image(const BYTE *image_data, UINT image_size)
BYTE *data;
HRESULT hr;
GpStatus status;
GpImage *image = NULL;
GpImage *image = NULL, *clone;
ImageType image_type;
LONG refcount;
LONG refcount, old_refcount;
hmem = GlobalAlloc(0, image_size);
data = GlobalLock(hmem);
......@@ -2696,6 +2696,22 @@ static GpImage *load_image(const BYTE *image_data, UINT image_size)
status = GdipGetImageType(image, &image_type);
ok(status == Ok, "GdipGetImageType error %d\n", status);
refcount = obj_refcount(stream);
if (image_type == ImageTypeBitmap)
ok(refcount > 1, "expected stream refcount > 1, got %d\n", refcount);
else
ok(refcount == 1, "expected stream refcount 1, got %d\n", refcount);
old_refcount = refcount;
status = GdipCloneImage(image, &clone);
ok(status == Ok, "GdipCloneImage error %d\n", status);
refcount = obj_refcount(stream);
ok(refcount == old_refcount, "expected stream refcount %d, got %d\n", old_refcount, refcount);
status = GdipDisposeImage(clone);
ok(status == Ok, "GdipDisposeImage error %d\n", status);
refcount = obj_refcount(stream);
ok(refcount == old_refcount, "expected stream refcount %d, got %d\n", old_refcount, refcount);
refcount = IStream_Release(stream);
if (image_type == ImageTypeBitmap)
ok(refcount >= 1, "expected stream refcount != 0\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment