Author: akhaldi
Date: Sun Jul 19 13:31:38 2015
New Revision: 68438
URL:
http://svn.reactos.org/svn/reactos?rev=68438&view=rev
Log:
[GDIPLUS_WINETEST] Sync with Wine Staging 1.7.47. CORE-9924
Modified:
trunk/rostests/winetests/gdiplus/graphics.c
trunk/rostests/winetests/gdiplus/image.c
trunk/rostests/winetests/gdiplus/metafile.c
trunk/rostests/winetests/gdiplus/region.c
Modified: trunk/rostests/winetests/gdiplus/graphics.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/graphic…
==============================================================================
--- trunk/rostests/winetests/gdiplus/graphics.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/gdiplus/graphics.c [iso-8859-1] Sun Jul 19 13:31:38 2015
@@ -2405,6 +2405,27 @@
/* We get the same kind of write-only HDC for a "normal" bitmap */
status = GdipCreateBitmapFromScan0(4, 4, 12, PixelFormat24bppRGB, NULL,
&bitmap);
+ expect(Ok, status);
+
+ status = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics);
+ expect(Ok, status);
+
+ status = GdipGetDC(graphics, &hdc);
+ expect(Ok, status);
+ ok(hdc != NULL, "got NULL hdc\n");
+
+ color = GetPixel(hdc, 0, 0);
+ todo_wine expect(0x0c0b0d, color);
+
+ status = GdipReleaseDC(graphics, hdc);
+ expect(Ok, status);
+
+ GdipDeleteGraphics(graphics);
+
+ GdipDisposeImage((GpImage*)bitmap);
+
+ /* If we don't draw to the HDC, the bits are never accessed */
+ status = GdipCreateBitmapFromScan0(4, 4, 12, PixelFormat24bppRGB, (BYTE*)1,
&bitmap);
expect(Ok, status);
status = GdipGetImageGraphicsContext((GpImage*)bitmap, &graphics);
@@ -3680,6 +3701,62 @@
GdipDeleteFont(font);
}
+ /* Font with units = UnitWorld */
+ for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
+ {
+ GpPointF pt = {0.0, 100.0};
+ GpImage* image;
+ REAL expected_width, expected_height;
+
+ graphics = create_graphics(td[i].res_x, td[i].res_y, td[i].unit,
td[i].page_scale, &image);
+
+ status = GdipTransformPoints(graphics, CoordinateSpaceWorld,
CoordinateSpaceDevice, &pt, 1);
+ expect(Ok, status);
+
+ status = GdipCreateFont(family, pt.Y, FontStyleRegular, UnitWorld, &font);
+ expect(Ok, status);
+
+ status = GdipGetFontUnit(font, &font_unit);
+ expect(Ok, status);
+ expect(UnitWorld, font_unit);
+
+ lf.lfHeight = 0xdeadbeef;
+ status = GdipGetLogFontW(font, graphics, &lf);
+ expect(Ok, status);
+ ok(lf.lfHeight == -100, "%u: expected -100, got %d\n", i,
lf.lfHeight);
+
+ set_rect_empty(&rc);
+ set_rect_empty(&bounds);
+ status = GdipMeasureString(graphics, string, -1, font, &rc, format,
&bounds, &chars, &lines);
+ expect(Ok, status);
+
+ if (i == 0)
+ {
+ base_cx = bounds.Width;
+ base_cy = bounds.Height;
+ }
+
+ pt.X = 1.0;
+ pt.Y = 1.0;
+
+ status = GdipTransformPoints(graphics, CoordinateSpaceWorld,
CoordinateSpaceDevice, &pt, 1);
+ expect(Ok, status);
+
+ /* height is constant in device space, width is proportional to height in world
space */
+ expected_width = base_cx * pt.Y;
+ expected_height = base_cy * pt.Y;
+
+ if (td[i].unit == UnitDisplay || td[i].unit == UnitPixel)
+ ok(fabs(expected_width - bounds.Width) <= 0.001, "%u: expected %f,
got %f\n", i, expected_width, bounds.Width);
+ else
+ todo_wine ok(fabs(expected_width - bounds.Width) <= 0.001, "%u:
expected %f, got %f\n", i, expected_width, bounds.Width);
+ ok(fabs(expected_height - bounds.Height) <= 0.001, "%u: expected %f, got
%f\n", i, expected_height, bounds.Height);
+
+ GdipDeleteGraphics(graphics);
+ GdipDisposeImage(image);
+ GdipDeleteFont(font);
+ }
+
GdipDeleteFontFamily(family);
GdipDeleteStringFormat(format);
}
@@ -3742,6 +3819,128 @@
}
}
+static void test_pen_thickness(void)
+{
+ static const struct test_data
+ {
+ REAL res_x, res_y, scale;
+ GpUnit pen_unit, page_unit;
+ REAL pen_width;
+ INT cx, cy;
+ } td[] =
+ {
+ { 10.0, 10.0, 1.0, UnitPixel, UnitPixel, 1.0, 1, 1 },
+ { 10.0, 10.0, 3.0, UnitPixel, UnitPixel, 2.0, 2, 2 },
+ { 10.0, 10.0, 30.0, UnitPixel, UnitInch, 1.0, 1, 1 },
+ { 10.0, 10.0, 1.0, UnitWorld, UnitPixel, 1.0, 1, 1 },
+ { 10.0, 10.0, 3.0, UnitWorld, UnitPixel, 2.0, 6, 6 },
+ { 10.0, 10.0, 2.0, UnitWorld, UnitInch, 1.0, 20, 20 },
+ };
+ GpStatus status;
+ int i, j;
+ GpGraphics *graphics;
+ union
+ {
+ GpBitmap *bitmap;
+ GpImage *image;
+ } u;
+ GpPen *pen;
+ GpPointF corner;
+ BitmapData bd;
+ INT min, max, size;
+
+ for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
+ {
+ status = GdipCreateBitmapFromScan0(100, 100, 0, PixelFormat24bppRGB, NULL,
&u.bitmap);
+ expect(Ok, status);
+
+ status = GdipBitmapSetResolution(u.bitmap, td[i].res_x, td[i].res_y);
+ expect(Ok, status);
+
+ status = GdipGetImageGraphicsContext(u.image, &graphics);
+ expect(Ok, status);
+
+ status = GdipSetPageUnit(graphics, td[i].page_unit);
+ expect(Ok, status);
+
+ status = GdipSetPageScale(graphics, td[i].scale);
+ expect(Ok, status);
+
+ status = GdipCreatePen1(0xffffffff, td[i].pen_width, td[i].pen_unit, &pen);
+ expect(Ok, status);
+
+ corner.X = corner.Y = 100.0;
+ status = GdipTransformPoints(graphics, CoordinateSpaceWorld,
CoordinateSpaceDevice, &corner, 1);
+ expect(Ok, status);
+
+ status = GdipDrawLine(graphics, pen, corner.X/2, 0, corner.X/2, corner.Y);
+ expect(Ok, status);
+
+ status = GdipDrawLine(graphics, pen, 0, corner.Y/2, corner.X, corner.Y/2);
+ expect(Ok, status);
+
+ status = GdipBitmapLockBits(u.bitmap, NULL, ImageLockModeRead,
PixelFormat24bppRGB, &bd);
+ expect(Ok, status);
+
+ min = -1;
+ max = -2;
+
+ for (j=0; j<100; j++)
+ {
+ if (((BYTE*)bd.Scan0)[j*3] == 0xff)
+ {
+ min = j;
+ break;
+ }
+ }
+
+ for (j=99; j>=0; j--)
+ {
+ if (((BYTE*)bd.Scan0)[j*3] == 0xff)
+ {
+ max = j;
+ break;
+ }
+ }
+
+ size = max-min+1;
+
+ ok(size == td[i].cx, "%u: expected %d, got %d\n", i, td[i].cx, size);
+
+ min = -1;
+ max = -2;
+
+ for (j=0; j<100; j++)
+ {
+ if (((BYTE*)bd.Scan0)[bd.Stride*j] == 0xff)
+ {
+ min = j;
+ break;
+ }
+ }
+
+ for (j=99; j>=0; j--)
+ {
+ if (((BYTE*)bd.Scan0)[bd.Stride*j] == 0xff)
+ {
+ max = j;
+ break;
+ }
+ }
+
+ size = max-min+1;
+
+ ok(size == td[i].cy, "%u: expected %d, got %d\n", i, td[i].cy, size);
+
+ status = GdipBitmapUnlockBits(u.bitmap, &bd);
+ expect(Ok, status);
+
+ GdipDeletePen(pen);
+ GdipDeleteGraphics(graphics);
+ GdipDisposeImage(u.image);
+ }
+}
+
/* Many people on the net ask why there is so much difference in rendered
* text height between gdiplus and gdi32, this test suggests an answer to
* that question. Important: this test assumes that font dpi == device dpi.
@@ -4430,12 +4629,13 @@
static void test_alpha_hdc(void)
{
GpStatus status;
- HDC hdc;
+ HDC hdc, gp_hdc;
HBITMAP hbm, old_hbm;
GpGraphics *graphics;
ULONG *bits;
BITMAPINFO bmi;
GpRectF bounds;
+ COLORREF colorref;
hdc = CreateCompatibleDC(0);
ok(hdc != NULL, "CreateCompatibleDC failed\n");
@@ -4468,6 +4668,21 @@
expect(Ok, status);
expect(0xffaaaaaa, bits[0]);
+
+ bits[0] = 0xdeadbeef;
+
+ status = GdipGetDC(graphics, &gp_hdc);
+ expect(Ok, status);
+
+ colorref = GetPixel(gp_hdc, 0, 4);
+ expect(0xefbead, colorref);
+
+ SetPixel(gp_hdc, 0, 4, 0xffffff);
+
+ expect(0xffffff, bits[0]);
+
+ status = GdipReleaseDC(graphics, gp_hdc);
+ expect(Ok, status);
SelectObject(hdc, old_hbm);
@@ -5641,6 +5856,7 @@
test_measure_string();
test_font_height_scaling();
test_transform();
+ test_pen_thickness();
test_GdipMeasureString();
test_constructor_destructor();
test_save_restore();
Modified: trunk/rostests/winetests/gdiplus/image.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/image.c…
==============================================================================
--- trunk/rostests/winetests/gdiplus/image.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/gdiplus/image.c [iso-8859-1] Sun Jul 19 13:31:38 2015
@@ -1341,6 +1341,12 @@
0x47,0x49,0x46,0x38,0x37,0x61,0x01,0x00,0x01,0x00,0x80,0x00,0x00,0xff,0xff,0xff,
0xff,0xff,0xff,0x2c,0x00,0x00,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0x02,0x02,0x44,
0x01,0x00,0x3b
+};
+/* 1x1 pixel transparent gif */
+static const unsigned char transparentgif[] = {
+0x47,0x49,0x46,0x38,0x39,0x61,0x01,0x00,0x01,0x00,0xf0,0x00,0x00,0x00,0x00,0x00,
+0x00,0x00,0x00,0x21,0xf9,0x04,0x01,0x00,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0x00,
+0x01,0x00,0x01,0x00,0x00,0x02,0x02,0x44,0x01,0x00,0x3b
};
/* 1x1 pixel bmp */
static const unsigned char bmpimage[66] = {
@@ -2430,6 +2436,51 @@
0x00,0x00,0x02,0x02,0x44,0x01,0x00,0x3b
};
+/* Generated with ImageMagick:
+ * convert -transparent black -delay 100 -size 8x2 xc:black \
+ * -dispose none -page +0+0 -size 2x2 xc:red \
+ * -dispose background -page +2+0 -size 2x2 xc:blue \
+ * -dispose previous -page +4+0 -size 2x2 xc:green \
+ * -dispose undefined -page +6+0 -size 2x2 xc:gray \
+ * test.gif
+ */
+static const unsigned char gifanimation2[] = {
+ 0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x08, 0x00,
+ 0x02, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x21, 0xf9, 0x04, 0x01, 0x64,
+ 0x00, 0x00, 0x00, 0x21, 0xff, 0x0b, 0x4e, 0x45,
+ 0x54, 0x53, 0x43, 0x41, 0x50, 0x45, 0x32, 0x2e,
+ 0x30, 0x03, 0x01, 0x00, 0x00, 0x00, 0x2c, 0x00,
+ 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x00, 0x00,
+ 0x02, 0x04, 0x84, 0x8f, 0x09, 0x05, 0x00, 0x21,
+ 0xf9, 0x04, 0x04, 0x64, 0x00, 0x00, 0x00, 0x2c,
+ 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00,
+ 0x81, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff,
+ 0x00, 0x00, 0xff, 0x00, 0x00, 0x02, 0x03, 0x44,
+ 0x34, 0x05, 0x00, 0x21, 0xf9, 0x04, 0x08, 0x64,
+ 0x00, 0x00, 0x00, 0x2c, 0x02, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x02, 0x00, 0x81, 0x00, 0x00, 0xff,
+ 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0x00,
+ 0xff, 0x02, 0x03, 0x44, 0x34, 0x05, 0x00, 0x21,
+ 0xf9, 0x04, 0x0c, 0x64, 0x00, 0x00, 0x00, 0x2c,
+ 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00,
+ 0x81, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x00,
+ 0x80, 0x00, 0x00, 0x80, 0x00, 0x02, 0x03, 0x44,
+ 0x34, 0x05, 0x00, 0x21, 0xf9, 0x04, 0x00, 0x64,
+ 0x00, 0x00, 0x00, 0x2c, 0x06, 0x00, 0x00, 0x00,
+ 0x02, 0x00, 0x02, 0x00, 0x80, 0x7e, 0x7e, 0x7e,
+ 0x00, 0x00, 0x00, 0x02, 0x02, 0x84, 0x51, 0x00,
+ 0x3b
+};
+
+static ARGB gifanimation2_pixels[5][4] = {
+ {0, 0, 0, 0},
+ {0xffff0000, 0, 0, 0},
+ {0xffff0000, 0xff0000ff, 0, 0},
+ {0xffff0000, 0, 0xff008000, 0},
+ {0xffff0000, 0, 0, 0xff7e7e7e}
+};
+
static void test_multiframegif(void)
{
LPSTREAM stream;
@@ -2441,6 +2492,11 @@
ARGB color;
UINT count;
GUID dimension;
+ PixelFormat pixel_format;
+ INT palette_size, i, j;
+ char palette_buf[256];
+ ColorPalette *palette;
+ ARGB *palette_entries;
/* Test frame functions with an animated GIF */
hglob = GlobalAlloc (0, sizeof(gifanimation));
@@ -2459,6 +2515,16 @@
return;
}
+ stat = GdipGetImagePixelFormat((GpImage*)bmp, &pixel_format);
+ expect(Ok, stat);
+ expect(PixelFormat32bppARGB, pixel_format);
+
+ stat = GdipGetImagePaletteSize((GpImage*)bmp, &palette_size);
+ expect(Ok, stat);
+ ok(palette_size == sizeof(ColorPalette) ||
+ broken(palette_size == sizeof(ColorPalette)+sizeof(ARGB[3])),
+ "palette_size = %d\n", palette_size);
+
/* Bitmap starts at frame 0 */
color = 0xdeadbeef;
stat = GdipBitmapGetPixel(bmp, 0, 0, &color);
@@ -2550,6 +2616,10 @@
return;
}
+ stat = GdipGetImagePixelFormat((GpImage*)bmp, &pixel_format);
+ expect(Ok, stat);
+ expect(PixelFormat8bppIndexed, pixel_format);
+
/* Check metadata */
stat = GdipImageGetFrameDimensionsCount((GpImage*)bmp,&count);
expect(Ok, stat);
@@ -2566,6 +2636,98 @@
GdipDisposeImage((GpImage*)bmp);
IStream_Release(stream);
+
+ /* Test with a non-animated transparent gif */
+ hglob = GlobalAlloc (0, sizeof(transparentgif));
+ data = GlobalLock (hglob);
+ memcpy(data, transparentgif, sizeof(transparentgif));
+ GlobalUnlock(hglob);
+
+ hres = CreateStreamOnHGlobal(hglob, TRUE, &stream);
+ ok(hres == S_OK, "Failed to create a stream\n");
+
+ stat = GdipCreateBitmapFromStream(stream, &bmp);
+ IStream_Release(stream);
+ ok(stat == Ok, "Failed to create a Bitmap\n");
+
+ stat = GdipGetImagePixelFormat((GpImage*)bmp, &pixel_format);
+ expect(Ok, stat);
+ expect(PixelFormat8bppIndexed, pixel_format);
+
+ stat = GdipBitmapGetPixel(bmp, 0, 0, &color);
+ expect(Ok, stat);
+ expect(0, color);
+
+ stat = GdipGetImagePaletteSize((GpImage*)bmp, &palette_size);
+ expect(Ok, stat);
+ ok(palette_size == sizeof(ColorPalette)+sizeof(ARGB),
+ "palette_size = %d\n", palette_size);
+
+ memset(palette_buf, 0xfe, sizeof(palette_buf));
+ palette = (ColorPalette*)palette_buf;
+ stat = GdipGetImagePalette((GpImage*)bmp, palette,
+ sizeof(ColorPalette)+sizeof(ARGB));
+ palette_entries = palette->Entries;
+ expect(Ok, stat);
+ expect(PaletteFlagsHasAlpha, palette->Flags);
+ expect(2, palette->Count);
+ expect(0, palette_entries[0]);
+ expect(0xff000000, palette_entries[1]);
+
+ count = 12345;
+ stat = GdipImageGetFrameCount((GpImage*)bmp, &dimension, &count);
+ expect(Ok, stat);
+ expect(1, count);
+
+ GdipDisposeImage((GpImage*)bmp);
+
+ /* Test frame dispose methods */
+ hglob = GlobalAlloc (0, sizeof(gifanimation2));
+ data = GlobalLock (hglob);
+ memcpy(data, gifanimation2, sizeof(gifanimation2));
+ GlobalUnlock(hglob);
+
+ hres = CreateStreamOnHGlobal(hglob, TRUE, &stream);
+ ok(hres == S_OK, "Failed to create a stream\n");
+
+ stat = GdipCreateBitmapFromStream(stream, &bmp);
+ ok(stat == Ok, "Failed to create a Bitmap\n");
+ IStream_Release(stream);
+
+ stat = GdipImageGetFrameDimensionsList((GpImage*)bmp, &dimension, 1);
+ expect(Ok, stat);
+ expect_guid(&FrameDimensionTime, &dimension, __LINE__, FALSE);
+
+ stat = GdipImageGetFrameCount((GpImage*)bmp, &dimension, &count);
+ expect(Ok, stat);
+ expect(5, count);
+
+ stat = GdipBitmapGetPixel(bmp, 0, 0, &color);
+ expect(Ok, stat);
+ expect(0, color);
+
+ stat = GdipImageSelectActiveFrame((GpImage*)bmp, &dimension, 3);
+ stat = GdipBitmapGetPixel(bmp, 2, 0, &color);
+ expect(Ok, stat);
+ ok(color==0 || broken(color==0xff0000ff), "color = %x\n", color);
+ if(color != 0) {
+ win_skip("broken animated gif support\n");
+ GdipDisposeImage((GpImage*)bmp);
+ return;
+ }
+
+ for(i=0; i<6; i++) {
+ stat = GdipImageSelectActiveFrame((GpImage*)bmp, &dimension, i%5);
+ expect(Ok, stat);
+
+ for(j=0; j<4; j++) {
+ stat = GdipBitmapGetPixel(bmp, j*2, 0, &color);
+ expect(Ok, stat);
+ ok(gifanimation2_pixels[i%5][j] == color, "at %d,%d got %x, expected
%x\n", i, j, color, gifanimation2_pixels[i%5][j]);
+ }
+ }
+
+ GdipDisposeImage((GpImage*)bmp);
}
static void test_rotateflip(void)
@@ -3948,8 +4110,9 @@
ok(status == OutOfMemory || broken(status == InvalidParameter) /* before win7
*/,
"expected OutOfMemory, got %d\n", status);
else
+ expect(Ok, status);
+ if (status == Ok)
{
- expect(Ok, status);
status = GdipGetImagePixelFormat(thumb, &format);
expect(Ok, status);
ok(format == PixelFormat32bppPARGB || broken(format != PixelFormat32bppPARGB)
/* before win7 */,
@@ -4388,6 +4551,91 @@
GdipDisposeImage((GpImage *)bitmap);
}
+static BOOL get_encoder_clsid(LPCWSTR mime, GUID *format, CLSID *clsid)
+{
+ GpStatus status;
+ UINT n_codecs, info_size, i;
+ ImageCodecInfo *info;
+ BOOL ret = FALSE;
+
+ status = GdipGetImageEncodersSize(&n_codecs, &info_size);
+ expect(Ok, status);
+
+ info = GdipAlloc(info_size);
+
+ status = GdipGetImageEncoders(n_codecs, info_size, info);
+ expect(Ok, status);
+
+ for (i = 0; i < n_codecs; i++)
+ {
+ if (!lstrcmpW(info[i].MimeType, mime))
+ {
+ *format = info[i].FormatID;
+ *clsid = info[i].Clsid;
+ ret = TRUE;
+ break;
+ }
+ }
+
+ GdipFree(info);
+ return ret;
+}
+
+static void test_supported_encoders(void)
+{
+ static const WCHAR bmp_mimetype[] = {'i', 'm',
'a','g', 'e', '/', 'b', 'm', 'p',
0};
+ static const WCHAR jpeg_mimetype[] =
{'i','m','a','g','e','/','j','p','e','g',
0};
+ static const WCHAR gif_mimetype[] =
{'i','m','a','g','e','/','g','i','f',
0};
+ static const WCHAR tiff_mimetype[] =
{'i','m','a','g','e','/','t','i','f','f',
0};
+ static const WCHAR png_mimetype[] =
{'i','m','a','g','e','/','p','n','g',
0};
+ static const struct test_data
+ {
+ LPCWSTR mime;
+ const GUID *format;
+ BOOL todo;
+ } td[] =
+ {
+ { bmp_mimetype, &ImageFormatBMP, FALSE },
+ { jpeg_mimetype, &ImageFormatJPEG, FALSE },
+ { gif_mimetype, &ImageFormatGIF, TRUE },
+ { tiff_mimetype, &ImageFormatTIFF, FALSE },
+ { png_mimetype, &ImageFormatPNG, FALSE }
+ };
+ GUID format, clsid;
+ BOOL ret;
+ HRESULT hr;
+ GpStatus status;
+ GpBitmap *bm;
+ IStream *stream;
+ HGLOBAL hmem;
+ int i;
+
+ status = GdipCreateBitmapFromScan0(1, 1, 0, PixelFormat24bppRGB, NULL, &bm);
+ ok(status == Ok, "GdipCreateBitmapFromScan0 error %d\n", status);
+
+ for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
+ {
+ ret = get_encoder_clsid(td[i].mime, &format, &clsid);
+ ok(ret, "%s encoder is not in the list\n", wine_dbgstr_w(td[i].mime));
+ expect_guid(td[i].format, &format, __LINE__, FALSE);
+
+ hmem = GlobalAlloc(GMEM_MOVEABLE | GMEM_NODISCARD, 16);
+
+ hr = CreateStreamOnHGlobal(hmem, TRUE, &stream);
+ ok(hr == S_OK, "CreateStreamOnHGlobal error %#x\n", hr);
+
+ status = GdipSaveImageToStream((GpImage *)bm, stream, &clsid, NULL);
+ if (td[i].todo)
+ todo_wine ok(status == Ok, "GdipSaveImageToStream error %d\n",
status);
+ else
+ ok(status == Ok, "GdipSaveImageToStream error %d\n", status);
+
+ IStream_Release(stream);
+ }
+
+ GdipDisposeImage((GpImage *)bm);
+}
+
START_TEST(image)
{
struct GdiplusStartupInput gdiplusStartupInput;
@@ -4400,6 +4648,7 @@
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
+ test_supported_encoders();
test_CloneBitmapArea();
test_ARGB_conversion();
test_DrawImage_scale();
Modified: trunk/rostests/winetests/gdiplus/metafile.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/metafil…
==============================================================================
--- trunk/rostests/winetests/gdiplus/metafile.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/gdiplus/metafile.c [iso-8859-1] Sun Jul 19 13:31:38 2015
@@ -951,6 +951,84 @@
expect(Ok, stat);
}
+static void test_converttoemfplus(void)
+{
+ GpStatus (WINAPI *pGdipConvertToEmfPlus)( const GpGraphics *graphics, GpMetafile
*metafile, BOOL *succ,
+ EmfType emfType, const WCHAR *description, GpMetafile **outmetafile);
+ static const GpRectF frame = {0.0, 0.0, 100.0, 100.0};
+ static const WCHAR description[] =
{'w','i','n','e','t','e','s','t',0};
+ GpStatus stat;
+ GpMetafile *metafile, *metafile2 = NULL, *emhmeta;
+ GpGraphics *graphics;
+ HDC hdc;
+ BOOL succ;
+ HMODULE mod = GetModuleHandleA("gdiplus.dll");
+
+ pGdipConvertToEmfPlus = (void*)GetProcAddress( mod,
"GdipConvertToEmfPlus");
+ if(!pGdipConvertToEmfPlus)
+ {
+ /* GdipConvertToEmfPlus was introduced in Windows Vista. */
+ win_skip("GDIPlus version 1.1 not available\n");
+ return;
+ }
+
+ hdc = CreateCompatibleDC(0);
+
+ stat = GdipRecordMetafile(hdc, MetafileTypeEmf, &frame, MetafileFrameUnitPixel,
description, &metafile);
+ expect(Ok, stat);
+
+ stat = GdipRecordMetafile(hdc, EmfTypeEmfPlusOnly, &frame,
MetafileFrameUnitPixel, description, &emhmeta);
+ expect(Ok, stat);
+
+ DeleteDC(hdc);
+
+ if (stat != Ok)
+ return;
+
+ stat = GdipGetImageGraphicsContext((GpImage*)metafile, &graphics);
+ expect(Ok, stat);
+
+ /* Invalid Parameters */
+ stat = pGdipConvertToEmfPlus(NULL, metafile, &succ, EmfTypeEmfPlusOnly,
description, &metafile2);
+ expect(InvalidParameter, stat);
+
+ stat = pGdipConvertToEmfPlus(graphics, NULL, &succ, EmfTypeEmfPlusOnly,
description, &metafile2);
+ expect(InvalidParameter, stat);
+
+ stat = pGdipConvertToEmfPlus(graphics, metafile, &succ, EmfTypeEmfPlusOnly,
description, NULL);
+ expect(InvalidParameter, stat);
+
+ stat = pGdipConvertToEmfPlus(graphics, metafile, NULL, MetafileTypeInvalid, NULL,
&metafile2);
+ expect(InvalidParameter, stat);
+
+ stat = pGdipConvertToEmfPlus(graphics, metafile, NULL, MetafileTypeEmfPlusDual+1,
NULL, &metafile2);
+ expect(InvalidParameter, stat);
+
+ /* If we are already an Enhanced Metafile then the conversion fails. */
+ stat = pGdipConvertToEmfPlus(graphics, emhmeta, NULL, EmfTypeEmfPlusOnly, NULL,
&metafile2);
+ todo_wine expect(InvalidParameter, stat);
+
+ stat = pGdipConvertToEmfPlus(graphics, metafile, NULL, EmfTypeEmfPlusOnly, NULL,
&metafile2);
+ todo_wine expect(Ok, stat);
+ if(metafile2)
+ GdipDisposeImage((GpImage*)metafile2);
+
+ succ = FALSE;
+ stat = pGdipConvertToEmfPlus(graphics, metafile, &succ, EmfTypeEmfPlusOnly, NULL,
&metafile2);
+ todo_wine expect(Ok, stat);
+ if(metafile2)
+ GdipDisposeImage((GpImage*)metafile2);
+
+ stat = GdipDeleteGraphics(graphics);
+ expect(Ok, stat);
+
+ stat = GdipDisposeImage((GpImage*)metafile);
+ expect(Ok, stat);
+
+ stat = GdipDisposeImage((GpImage*)emhmeta);
+ expect(Ok, stat);
+}
+
START_TEST(metafile)
{
struct GdiplusStartupInput gdiplusStartupInput;
@@ -975,6 +1053,7 @@
test_emfonly();
test_fillrect();
test_pagetransform();
+ test_converttoemfplus();
GdiplusShutdown(gdiplusToken);
}
Modified: trunk/rostests/winetests/gdiplus/region.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/gdiplus/region.…
==============================================================================
--- trunk/rostests/winetests/gdiplus/region.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/gdiplus/region.c [iso-8859-1] Sun Jul 19 13:31:38 2015
@@ -118,13 +118,13 @@
/* Windows always fails to create an empty path in a region */
if (data[4] == RGNDATA_PATH)
{
- struct _path_header
+ struct path_header
{
DWORD size;
DWORD magic;
DWORD count;
DWORD flags;
- } *path_header = (struct _path_header *)(data + 5);
+ } *path_header = (struct path_header *)(data + 5);
if (!path_header->count)
{
ok_(__FILE__, line)(status == GenericError, "expected GenericError, got
%d\n", status);
@@ -2202,6 +2202,68 @@
GdipDeleteMatrix(identity);
}
+static void test_GdipCreateRegionRgnData(void)
+{
+ GpGraphics *graphics = NULL;
+ GpRegion *region, *region2;
+ HDC hdc = GetDC(0);
+ GpStatus status;
+ BYTE buf[512];
+ UINT needed;
+ BOOL ret;
+
+ status = GdipCreateRegionRgnData(NULL, 0, NULL);
+ ok(status == InvalidParameter, "status %d\n", status);
+
+ status = GdipCreateFromHDC(hdc, &graphics);
+ ok(status == Ok, "status %d\n", status);
+
+ status = GdipCreateRegion(®ion);
+ ok(status == Ok, "status %d\n", status);
+
+ /* infinite region */
+ memset(buf, 0xee, sizeof(buf));
+ needed = 0;
+ status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
+ ok(status == Ok, "status %d\n", status);
+ expect(20, needed);
+
+ status = GdipCreateRegionRgnData(buf, needed, NULL);
+ ok(status == InvalidParameter, "status %d\n", status);
+
+ status = GdipCreateRegionRgnData(buf, needed, ®ion2);
+ ok(status == Ok, "status %d\n", status);
+
+ ret = FALSE;
+ status = GdipIsInfiniteRegion(region2, graphics, &ret);
+ ok(status == Ok, "status %d\n", status);
+ ok(ret, "got %d\n", ret);
+ GdipDeleteRegion(region2);
+
+ /* empty region */
+ status = GdipSetEmpty(region);
+ ok(status == Ok, "status %d\n", status);
+
+ memset(buf, 0xee, sizeof(buf));
+ needed = 0;
+ status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
+ ok(status == Ok, "status %d\n", status);
+ expect(20, needed);
+
+ status = GdipCreateRegionRgnData(buf, needed, ®ion2);
+ ok(status == Ok, "status %d\n", status);
+
+ ret = FALSE;
+ status = GdipIsEmptyRegion(region2, graphics, &ret);
+ ok(status == Ok, "status %d\n", status);
+ ok(ret, "got %d\n", ret);
+ GdipDeleteRegion(region2);
+
+ GdipDeleteGraphics(graphics);
+ GdipDeleteRegion(region);
+ ReleaseDC(0, hdc);
+}
+
START_TEST(region)
{
struct GdiplusStartupInput gdiplusStartupInput;
@@ -2228,6 +2290,7 @@
test_isvisiblepoint();
test_isvisiblerect();
test_excludeinfinite();
+ test_GdipCreateRegionRgnData();
GdiplusShutdown(gdiplusToken);
}